This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/bin/cat

19 lines
540 B
Text
Raw Normal View History

2022-07-18 19:33:40 +02:00
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