19 lines
540 B
Text
19 lines
540 B
Text
|
local tArgs = {...}
|
||
|
|
||
|
if #tArgs >= 1 then
|
||
|
path = shell.resolve(tArgs[1])
|
||
|
if fs.isReadOnly(path) and not security.getSU() then
|
||
|
-- prevent users from seeing unauthorized code
|
||
|
-- they should only be able to see their own files and ones in /var/log
|
||
|
exception.throw("SecurityException", path)
|
||
|
return
|
||
|
end
|
||
|
if not fs.exists(path) or fs.isDir(path) then
|
||
|
kerneldraw.printAppInfo("cat", "File or directory not found")
|
||
|
else
|
||
|
textutils.pagedPrint(kernel.printFile(path))
|
||
|
end
|
||
|
else
|
||
|
kerneldraw.printAppInfo("cat", "No file specified")
|
||
|
end
|