Debian Codegraph @

texk/web2c/luatexdir/luasocket/test/tftptest.lua

raw symbols SCIP
1 -- load tftpclnt.lua
2 local tftp = require("socket.tftp")
3
4 -- needs tftp server running on localhost, with root pointing to
5 -- a directory with index.html in it
6
7 function readfile(file)
8 local f = io.open(file, "r")
9 if not f then return nil end
10 local a = f:read("*a")
11 f:close()
12 return a
13 end
14
15 host = host or "diego.student.princeton.edu"
16 retrieved, err = tftp.get("tftp://" .. host .."/index.html")
17 assert(not err, err)
18 original = readfile("test/index.html")
19 assert(original == retrieved, "files differ!")
20 print("passed")