diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-11-21 07:04:44 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-11-21 07:04:44 +0000 |
commit | a2b780bf7a78c66d54a248fa99b5fc862c12a127 (patch) | |
tree | a9377a265f47439952c9100c594ed789117d9063 | |
parent | 71f483496de874f1200526816528b7b2a4e9e4a6 (diff) | |
download | luasocket-a2b780bf7a78c66d54a248fa99b5fc862c12a127.tar.gz luasocket-a2b780bf7a78c66d54a248fa99b5fc862c12a127.tar.bz2 luasocket-a2b780bf7a78c66d54a248fa99b5fc862c12a127.zip |
Spell checking on the manuals.
David's changes to lp.lua.
-rw-r--r-- | doc/dns.html | 2 | ||||
-rw-r--r-- | doc/ftp.html | 2 | ||||
-rw-r--r-- | doc/http.html | 2 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | doc/installation.html | 13 | ||||
-rw-r--r-- | doc/introduction.html | 2 | ||||
-rw-r--r-- | doc/ltn12.html | 2 | ||||
-rw-r--r-- | doc/mime.html | 2 | ||||
-rw-r--r-- | doc/reference.html | 2 | ||||
-rw-r--r-- | doc/smtp.html | 2 | ||||
-rw-r--r-- | doc/socket.html | 4 | ||||
-rw-r--r-- | doc/tcp.html | 4 | ||||
-rw-r--r-- | doc/udp.html | 2 | ||||
-rw-r--r-- | doc/url.html | 2 | ||||
-rw-r--r-- | etc/lp.lua | 24 |
15 files changed, 36 insertions, 33 deletions
diff --git a/doc/dns.html b/doc/dns.html index af64ce4..826e4a2 100644 --- a/doc/dns.html +++ b/doc/dns.html | |||
@@ -122,7 +122,7 @@ message. | |||
122 | <p> | 122 | <p> |
123 | <small> | 123 | <small> |
124 | Last modified by Diego Nehab on <br> | 124 | Last modified by Diego Nehab on <br> |
125 | Sun Nov 28 03:19:00 EST 2004 | 125 | Mon Nov 21 01:56:09 EST 2005 |
126 | </small> | 126 | </small> |
127 | </p> | 127 | </p> |
128 | </center> | 128 | </center> |
diff --git a/doc/ftp.html b/doc/ftp.html index 1886344..4398a2a 100644 --- a/doc/ftp.html +++ b/doc/ftp.html | |||
@@ -279,7 +279,7 @@ f, e = ftp.put{ | |||
279 | <p> | 279 | <p> |
280 | <small> | 280 | <small> |
281 | Last modified by Diego Nehab on <br> | 281 | Last modified by Diego Nehab on <br> |
282 | Sun Nov 28 03:19:00 EST 2004 | 282 | Mon Nov 21 01:56:32 EST 2005 |
283 | </small> | 283 | </small> |
284 | </p> | 284 | </p> |
285 | </center> | 285 | </center> |
diff --git a/doc/http.html b/doc/http.html index 9d80c23..a60ed25 100644 --- a/doc/http.html +++ b/doc/http.html | |||
@@ -315,7 +315,7 @@ r, c = http.request { | |||
315 | <p> | 315 | <p> |
316 | <small> | 316 | <small> |
317 | Last modified by Diego Nehab on <br> | 317 | Last modified by Diego Nehab on <br> |
318 | Sun Nov 28 03:19:00 EST 2004 | 318 | Mon Nov 21 01:57:03 EST 2005 |
319 | </small> | 319 | </small> |
320 | </p> | 320 | </p> |
321 | </center> | 321 | </center> |
diff --git a/doc/index.html b/doc/index.html index 7ac0d4c..06369a7 100644 --- a/doc/index.html +++ b/doc/index.html | |||
@@ -101,7 +101,7 @@ contains several examples, this user's manual and basic test procedures. | |||
101 | </p> | 101 | </p> |
102 | 102 | ||
103 | <p> | 103 | <p> |
104 | Danilo Tuler is mantaining Win32 binaries for LuaSocket, which are also | 104 | Danilo Tuler is maintaining Win32 binaries for LuaSocket, which are also |
105 | available from LuaForge. These are compatible with the | 105 | available from LuaForge. These are compatible with the |
106 | <a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a> | 106 | <a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a> |
107 | available from LuaForge. | 107 | available from LuaForge. |
@@ -246,7 +246,7 @@ still available for those that have compatibility issues. | |||
246 | <p> | 246 | <p> |
247 | <small> | 247 | <small> |
248 | Last modified by Diego Nehab on <br> | 248 | Last modified by Diego Nehab on <br> |
249 | Sun Nov 28 03:19:00 EST 2004 | 249 | Mon Nov 21 01:56:56 EST 2005 |
250 | </small> | 250 | </small> |
251 | </p> | 251 | </p> |
252 | </center> | 252 | </center> |
diff --git a/doc/installation.html b/doc/installation.html index 4086f41..c8eb5d9 100644 --- a/doc/installation.html +++ b/doc/installation.html | |||
@@ -37,7 +37,7 @@ Installation"> | |||
37 | 37 | ||
38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 38 | <!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
39 | 39 | ||
40 | <h2>Instalation</h2> | 40 | <h2>Installation</h2> |
41 | 41 | ||
42 | <p> LuaSocket 2.0 uses the new package proposal for Lua 5.1. | 42 | <p> LuaSocket 2.0 uses the new package proposal for Lua 5.1. |
43 | All Lua library developers are encouraged to update their libraries so that | 43 | All Lua library developers are encouraged to update their libraries so that |
@@ -48,7 +48,7 @@ standardization and flexibility of the standard. | |||
48 | <p> | 48 | <p> |
49 | The proposal was considered important enough by some of us to justify | 49 | The proposal was considered important enough by some of us to justify |
50 | early adoption, even before release of Lua 5.1. | 50 | early adoption, even before release of Lua 5.1. |
51 | Thus, a compability module | 51 | Thus, a compatibility module |
52 | <a href=http://www.keplerproject.org/compat/>compat-5.1</a> | 52 | <a href=http://www.keplerproject.org/compat/>compat-5.1</a> |
53 | has been released in conjunction with Roberto Ierusalimschy and <a | 53 | has been released in conjunction with Roberto Ierusalimschy and <a |
54 | href=http://www.keplerproject.org/>The Kepler Project</a> team. | 54 | href=http://www.keplerproject.org/>The Kepler Project</a> team. |
@@ -110,7 +110,7 @@ LUA_PATH=<SHARE>/?.lua;?.lua | |||
110 | LUA_CPATH=<LIB>/?.dll;?.dll | 110 | LUA_CPATH=<LIB>/?.dll;?.dll |
111 | </pre> | 111 | </pre> |
112 | 112 | ||
113 | <p> Again, naturally, on Unix systmems the shared library extension would be | 113 | <p> Again, naturally, on Unix systems the shared library extension would be |
114 | <tt>.so</tt> instead of <tt>.dll</tt>.</p> | 114 | <tt>.so</tt> instead of <tt>.dll</tt>.</p> |
115 | 115 | ||
116 | <h3>Using LuaSocket</h3> | 116 | <h3>Using LuaSocket</h3> |
@@ -127,13 +127,12 @@ Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | |||
127 | </pre> | 127 | </pre> |
128 | 128 | ||
129 | <p> Each module loads their dependencies automatically, so you only need to | 129 | <p> Each module loads their dependencies automatically, so you only need to |
130 | load the modues you directly depend upon: <p> | 130 | load the modules you directly depend upon: </p> |
131 | 131 | ||
132 | <pre class=example> | 132 | <pre class=example> |
133 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | 133 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio |
134 | > http = require("socket.http") | 134 | > http = require("socket.http") |
135 | > | 135 | > print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) |
136 | print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) | ||
137 | --> homepage gets dumped to terminal | 136 | --> homepage gets dumped to terminal |
138 | </pre> | 137 | </pre> |
139 | 138 | ||
@@ -152,7 +151,7 @@ print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket")) | |||
152 | <p> | 151 | <p> |
153 | <small> | 152 | <small> |
154 | Last modified by Diego Nehab on <br> | 153 | Last modified by Diego Nehab on <br> |
155 | Sun Nov 28 03:19:00 EST 2004 | 154 | Mon Nov 21 01:57:22 EST 2005 |
156 | </small> | 155 | </small> |
157 | </p> | 156 | </p> |
158 | </center> | 157 | </center> |
diff --git a/doc/introduction.html b/doc/introduction.html index c88fa40..bb55762 100644 --- a/doc/introduction.html +++ b/doc/introduction.html | |||
@@ -323,7 +323,7 @@ and many others are covered by the <a href=reference.html>reference manual</a>. | |||
323 | <p> | 323 | <p> |
324 | <small> | 324 | <small> |
325 | Last modified by Diego Nehab on <br> | 325 | Last modified by Diego Nehab on <br> |
326 | Sun Nov 28 03:19:00 EST 2004 | 326 | Mon Nov 21 01:57:43 EST 2005 |
327 | </small> | 327 | </small> |
328 | </p> | 328 | </p> |
329 | </center> | 329 | </center> |
diff --git a/doc/ltn12.html b/doc/ltn12.html index c5a0f59..7d2842e 100644 --- a/doc/ltn12.html +++ b/doc/ltn12.html | |||
@@ -420,7 +420,7 @@ Creates and returns a source that produces the contents of a | |||
420 | <p> | 420 | <p> |
421 | <small> | 421 | <small> |
422 | Last modified by Diego Nehab on <br> | 422 | Last modified by Diego Nehab on <br> |
423 | Sun Nov 28 03:19:00 EST 2004 | 423 | Mon Nov 21 01:57:47 EST 2005 |
424 | </small> | 424 | </small> |
425 | </p> | 425 | </p> |
426 | </center> | 426 | </center> |
diff --git a/doc/mime.html b/doc/mime.html index 47ab47b..11ec543 100644 --- a/doc/mime.html +++ b/doc/mime.html | |||
@@ -466,7 +466,7 @@ marker. | |||
466 | <p> | 466 | <p> |
467 | <small> | 467 | <small> |
468 | Last modified by Diego Nehab on <br> | 468 | Last modified by Diego Nehab on <br> |
469 | Sun Nov 28 03:19:00 EST 2004 | 469 | Mon Nov 21 01:57:51 EST 2005 |
470 | </small> | 470 | </small> |
471 | </p> | 471 | </p> |
472 | </center> | 472 | </center> |
diff --git a/doc/reference.html b/doc/reference.html index b4b2f1d..ed1702d 100644 --- a/doc/reference.html +++ b/doc/reference.html | |||
@@ -229,7 +229,7 @@ Support, Manual"> | |||
229 | <p> | 229 | <p> |
230 | <small> | 230 | <small> |
231 | Last modified by Diego Nehab on <br> | 231 | Last modified by Diego Nehab on <br> |
232 | Sun Nov 28 03:19:00 EST 2004 | 232 | Mon Nov 21 01:57:56 EST 2005 |
233 | </small> | 233 | </small> |
234 | </p> | 234 | </p> |
235 | </center> | 235 | </center> |
diff --git a/doc/smtp.html b/doc/smtp.html index 14def8a..833aa83 100644 --- a/doc/smtp.html +++ b/doc/smtp.html | |||
@@ -407,7 +407,7 @@ r, e = smtp.send{ | |||
407 | <p> | 407 | <p> |
408 | <small> | 408 | <small> |
409 | Last modified by Diego Nehab on <br> | 409 | Last modified by Diego Nehab on <br> |
410 | Sun Nov 28 03:19:00 EST 2004 | 410 | Mon Nov 21 01:58:01 EST 2005 |
411 | </small> | 411 | </small> |
412 | </p> | 412 | </p> |
413 | </center> | 413 | </center> |
diff --git a/doc/socket.html b/doc/socket.html index 54b12cb..82e958a 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
@@ -230,7 +230,7 @@ sink from a stream socket object. | |||
230 | </p> | 230 | </p> |
231 | 231 | ||
232 | <p class=parameters> | 232 | <p class=parameters> |
233 | <tt>Mode</tt> defines the behaviour of the sink. The following | 233 | <tt>Mode</tt> defines the behavior of the sink. The following |
234 | options are available: | 234 | options are available: |
235 | </p> | 235 | </p> |
236 | <ul> | 236 | <ul> |
@@ -395,7 +395,7 @@ This constant has a string describing the current LuaSocket version. | |||
395 | <p> | 395 | <p> |
396 | <small> | 396 | <small> |
397 | Last modified by Diego Nehab on <br> | 397 | Last modified by Diego Nehab on <br> |
398 | Sun Nov 28 03:19:00 EST 2004 | 398 | Mon Nov 21 01:58:06 EST 2005 |
399 | </small> | 399 | </small> |
400 | </p> | 400 | </p> |
401 | </center> | 401 | </center> |
diff --git a/doc/tcp.html b/doc/tcp.html index 2c687c0..5814e1a 100644 --- a/doc/tcp.html +++ b/doc/tcp.html | |||
@@ -177,7 +177,7 @@ method affects the behavior of <tt>connect</tt>, causing it to return | |||
177 | with an error in case of a timeout. If that happens, you can still call <a | 177 | with an error in case of a timeout. If that happens, you can still call <a |
178 | href=socket.html#select><tt>socket.select</tt></a> with the socket in the | 178 | href=socket.html#select><tt>socket.select</tt></a> with the socket in the |
179 | <tt>sendt</tt> table. The socket will be writable when the connection is | 179 | <tt>sendt</tt> table. The socket will be writable when the connection is |
180 | stablished. | 180 | established. |
181 | </p> | 181 | </p> |
182 | 182 | ||
183 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 183 | <!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
@@ -539,7 +539,7 @@ This function returns 1. | |||
539 | <p> | 539 | <p> |
540 | <small> | 540 | <small> |
541 | Last modified by Diego Nehab on <br> | 541 | Last modified by Diego Nehab on <br> |
542 | Sun Nov 28 03:19:00 EST 2004 | 542 | Mon Nov 21 01:58:10 EST 2005 |
543 | </small> | 543 | </small> |
544 | </p> | 544 | </p> |
545 | </center> | 545 | </center> |
diff --git a/doc/udp.html b/doc/udp.html index ea8f289..60c5ba3 100644 --- a/doc/udp.html +++ b/doc/udp.html | |||
@@ -406,7 +406,7 @@ imperative nature obvious. | |||
406 | <p> | 406 | <p> |
407 | <small> | 407 | <small> |
408 | Last modified by Diego Nehab on <br> | 408 | Last modified by Diego Nehab on <br> |
409 | Sun Nov 28 03:19:00 EST 2004 | 409 | Mon Nov 21 01:58:15 EST 2005 |
410 | </small> | 410 | </small> |
411 | </p> | 411 | </p> |
412 | </center> | 412 | </center> |
diff --git a/doc/url.html b/doc/url.html index ac84d24..5785224 100644 --- a/doc/url.html +++ b/doc/url.html | |||
@@ -319,7 +319,7 @@ The function returns the decoded string. | |||
319 | <p> | 319 | <p> |
320 | <small> | 320 | <small> |
321 | Last modified by Diego Nehab on <br> | 321 | Last modified by Diego Nehab on <br> |
322 | Sun Nov 28 03:19:00 EST 2004 | 322 | Mon Nov 21 01:58:20 EST 2005 |
323 | </small> | 323 | </small> |
324 | </p> | 324 | </p> |
325 | </center> | 325 | </center> |
@@ -11,6 +11,8 @@ | |||
11 | -- make sure LuaSocket is loaded | 11 | -- make sure LuaSocket is loaded |
12 | local io = require("io") | 12 | local io = require("io") |
13 | local base = _G | 13 | local base = _G |
14 | local os = require("os") | ||
15 | local math = require("math") | ||
14 | local string = require("string") | 16 | local string = require("string") |
15 | local socket = require("socket") | 17 | local socket = require("socket") |
16 | local ltn12 = require("ltn12") | 18 | local ltn12 = require("ltn12") |
@@ -192,6 +194,7 @@ local function send_data(con,fh,size) | |||
192 | con.try(size == 0, "file size mismatch") | 194 | con.try(size == 0, "file size mismatch") |
193 | end | 195 | end |
194 | end | 196 | end |
197 | recv_ack(con) -- note the double acknowledgement | ||
195 | send_ack(con) | 198 | send_ack(con) |
196 | recv_ack(con) | 199 | recv_ack(con) |
197 | return size | 200 | return size |
@@ -224,7 +227,7 @@ local control_dflt = { | |||
224 | local seq = 0 | 227 | local seq = 0 |
225 | local function newjob(connection) | 228 | local function newjob(connection) |
226 | seq = seq + 1 | 229 | seq = seq + 1 |
227 | return math.floor(socket.gettime() * 1000 + seq) | 230 | return math.floor(socket.gettime() * 1000 + seq)%1000 |
228 | end | 231 | end |
229 | 232 | ||
230 | 233 | ||
@@ -241,22 +244,24 @@ local format_codes = { | |||
241 | f = 'f' | 244 | f = 'f' |
242 | } | 245 | } |
243 | 246 | ||
244 | -- lp.send | 247 | -- lp.send{option} |
248 | -- requires option.file | ||
245 | 249 | ||
246 | send = socket.protect(function(file, option) | 250 | send = socket.protect(function(option) |
247 | socket.try(file, "invalid file name") | ||
248 | socket.try(option and base.type(option) == "table", "invalid options") | 251 | socket.try(option and base.type(option) == "table", "invalid options") |
252 | local file = option.file | ||
253 | socket.try(file, "invalid file name") | ||
249 | local fh = socket.try(io.open(file,"rb")) | 254 | local fh = socket.try(io.open(file,"rb")) |
250 | local datafile_size = fh:seek("end") -- get total size | 255 | local datafile_size = fh:seek("end") -- get total size |
251 | fh:seek("set") -- go back to start of file | 256 | fh:seek("set") -- go back to start of file |
252 | local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME") | 257 | local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME") |
253 | or "localhost" | 258 | or "localhost" |
254 | local con = connect(localhost, option) | 259 | local con = connect(localhost, option) |
255 | -- format the control file | 260 | -- format the control file |
256 | local jobno = newjob() | 261 | local jobno = newjob() |
257 | local localip = socket.dns.toip(localhost) | 262 | local localip = socket.dns.toip(localhost) |
258 | localhost = string.sub(localhost,1,31) | 263 | localhost = string.sub(localhost,1,31) |
259 | local user = string.sub(option.user or os.getenv("LPRUSER") or | 264 | local user = string.sub(option.user or os.getenv("LPRUSER") or |
260 | os.getenv("USERNAME") or os.getenv("USER") or "anonymous", 1,31) | 265 | os.getenv("USERNAME") or os.getenv("USER") or "anonymous", 1,31) |
261 | local lpfile = string.format("dfA%3.3d%-s", jobno, localhost); | 266 | local lpfile = string.format("dfA%3.3d%-s", jobno, localhost); |
262 | local fmt = format_codes[option.format] or 'l' | 267 | local fmt = format_codes[option.format] or 'l' |
@@ -306,15 +311,14 @@ end) | |||
306 | -- | 311 | -- |
307 | query = socket.protect(function(p) | 312 | query = socket.protect(function(p) |
308 | p = p or {} | 313 | p = p or {} |
309 | local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME") | 314 | local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME") |
310 | or "localhost" | 315 | or "localhost" |
311 | local con = connect(localhost,p) | 316 | local con = connect(localhost,p) |
312 | local fmt | 317 | local fmt |
313 | if string.sub(p.format or 's',1,1) == 's' then fmt = 3 else fmt = 4 end | 318 | if string.sub(p.format or 's',1,1) == 's' then fmt = 3 else fmt = 4 end |
314 | con.try(con.skt:send(string.format("%c%s %s\n", fmt, p.queue or "*", | 319 | con.try(con.skt:send(string.format("%c%s %s\n", fmt, p.queue or "*", |
315 | p.list or ""))) | 320 | p.list or ""))) |
316 | local data = con.try(con.skt:receive("*a")) | 321 | local data = con.try(con.skt:receive("*a")) |
317 | con.skt:close() | 322 | con.skt:close() |
318 | return data | 323 | return data |
319 | end) | 324 | end) |
320 | |||