blob: cd8660ac2b6ad7cd9365b8ac10e6f7eb244c1a50 [file] [log] [blame] [raw]
local shell = require("shell")
local data = require("data")
local args = shell.parse(...)
if #args == 0 then
local read = ""
repeat
local current = io.read("*a")
read = read .. current
until current ~= ""
io.write(data.deflate(read))
else
local read = ""
local file, reason = io.open(shell.resolve(args[1]))
if not file then
io.stderr:write(tostring(reason) .. "\n")
os.exit(false)
end
repeat
local current = file:read("*a")
read = read .. current
until current ~= ""
file:close()
io.write(data.deflate(read))
end