Code Sample |
#!/bin/flua -f -- Archive einsehen if getn(arg) == 1 then archive = arg[1] else print("usage: viewTarGz.lua [archive]") exit(1) end execute('tar -ztf '..archive..' > index.txt') local file,err = openfile("index.txt", "r") if not file then print("Cannot open file index.txt: ".. err) exit(1) end filetable = {} fname = tmpname() filelist = openfile(fname,"w") line = read(file, "*l") while line do result = line if result then tinsert(filetable,result) write(filelist, result .. "\n") end line = read(file,"*l") end closefile(file) closefile(filelist) w = Window{250,300,archive} function w:callback() remove(fname) remove('index.txt') exit(0) end browser = Browser{0,0,250,300} if not browser:load(fname) then print("can't load ", fname) exit(1) end browser.position = 0 w.resizable = browser w:show() |