xXm0dzXx

Untitled

Jun 3rd, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. olddelete = fs.delete
  2. oldterminate = os.pullEvent
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. function removefile(filename)
  6. if filename == "startup" then
  7. error("Access Denied")
  8. else
  9. olddelete(filename)
  10. end
  11. end
  12.  
  13. fs.delete = removefile
  14.  
  15. local bExit = false
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print(os.version().. " - Used PC")
  19.  
  20.  
  21. -- Read commands and execute them
  22. local tCommandHistory = {}
  23. while not bExit do
  24. write( shell.dir() .. "> " )
  25.  
  26. local sLine = read( nil, tCommandHistory )
  27. table.insert( tCommandHistory, sLine )
  28.  
  29. local tWords = {}
  30. for match in string.gmatch(sLine, "[^ \t]+") do
  31. table.insert( tWords, match )
  32. end
  33.  
  34. local sCommand = tWords[1]
  35. if sCommand then
  36. if sCommand == "edit" and tWords[2] == "startup" then
  37. print("Access Denied")
  38. else
  39. os.pullEvent = oldterminate
  40. shell.run( sCommand, unpack( tWords, 2 ) )
  41. os.pullEvent = os.pullEventRaw
  42. end
  43. end
  44. end
Add Comment
Please, Sign In to add comment