36 lines
647 B
Text
36 lines
647 B
Text
|
local tArgs = {...}
|
||
|
local logs = {}
|
||
|
local err = true
|
||
|
local function findArg(arg)
|
||
|
for _,v in ipairs(tArgs) do
|
||
|
if v == arg then
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
if fs.isDir("/var/log") then
|
||
|
logs = fs.list("/var/log")
|
||
|
else
|
||
|
kerneldraw.printAppWarning("log", "Log files non-existent")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if findArg("-l") or findArg("--list") then
|
||
|
shell.run("/bin/ls /var/log")
|
||
|
err = false
|
||
|
end
|
||
|
|
||
|
for _,v in ipairs(logs) do
|
||
|
if findArg(v) then
|
||
|
local logfile = kernel.printFile("/var/log/"..v)
|
||
|
textutils.pagedPrint(logfile)
|
||
|
err = false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
if #tArgs < 1 or err then
|
||
|
kerneldraw.printAppInfo("dmesg", "Arguments not specified")
|
||
|
end
|