aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-02 23:47:52 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-07-02 23:47:52 +0000
commit471334c3d07f398e4b0859c43276341a28b91504 (patch)
treeff1894b013b093280b0878d16f1c827da85a3ea9 /samples
parentc3e0063b430beba5d7e6911c8f59fd37b8017e61 (diff)
downloadluasocket-471334c3d07f398e4b0859c43276341a28b91504.tar.gz
luasocket-471334c3d07f398e4b0859c43276341a28b91504.tar.bz2
luasocket-471334c3d07f398e4b0859c43276341a28b91504.zip
Fixed stupid bugs.
Diffstat (limited to 'samples')
-rw-r--r--samples/lpr.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/samples/lpr.lua b/samples/lpr.lua
index c23ebee..d743026 100644
--- a/samples/lpr.lua
+++ b/samples/lpr.lua
@@ -27,16 +27,14 @@ if not arg or not arg[1] then
27end 27end
28 28
29do 29do
30 local s="opt = {" 30 local opt = {}
31 for i = 2 , table.getn(arg), 1 do 31 local pat = "[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)"
32 s = s .. string.gsub(arg[i],"[%s%c%p]*([%w]*)=([\"]?[%w%s_!@#$%%^&*()<>:;]+[\"]\?\.?)","%1%=\"%2\",\n") 32 for i = 2, table.getn(arg), 1 do
33 string.gsub(arg[i], pat, function(name, value) opt[name] = value end)
33 end 34 end
34 s = s .. "};\n"
35 assert(loadstring(s))();
36 if not arg[2] then 35 if not arg[2] then
37 return usage() 36 return usage()
38 end 37 end
39
40 if arg[1] ~= "query" then 38 if arg[1] ~= "query" then
41 r,e=lp.send(arg[1],opt) 39 r,e=lp.send(arg[1],opt)
42 io.stdout:write(tostring(r or e),'\n') 40 io.stdout:write(tostring(r or e),'\n')