24 lines
666 B
Lua
Executable File
24 lines
666 B
Lua
Executable File
#!/usr/bin/env lua
|
|
|
|
LOG_PATH, file1 = os.getenv("HOME") .. "/.fuse.log", "hello world"
|
|
|
|
local function log_command(args)
|
|
io.open(LOG_PATH, "a"):write(table.concat(args, " ") .. "\n"):close()
|
|
end
|
|
|
|
local function getattr(path)
|
|
if path == "/" then print("16877 2 1000 1000 4096 8")
|
|
elseif path == "/file1" then print(string.format("33188 1 1000 1000 %d 1", #file1))
|
|
else os.exit(1) end
|
|
end
|
|
|
|
local function main(args)
|
|
log_command(args)
|
|
if args[1] == "readdir" then print("file1")
|
|
elseif args[1] == "getattr" then getattr(args[2])
|
|
elseif args[1] == "read" and args[2] == "/file1" then print(file1)
|
|
else os.exit(1) end
|
|
end
|
|
|
|
main({...})
|