From a2b780bf7a78c66d54a248fa99b5fc862c12a127 Mon Sep 17 00:00:00 2001
From: Diego Nehab
Date: Mon, 21 Nov 2005 07:04:44 +0000
Subject: [PATCH] Spell checking on the manuals. David's changes to lp.lua.
---
doc/dns.html | 2 +-
doc/ftp.html | 2 +-
doc/http.html | 2 +-
doc/index.html | 4 ++--
doc/installation.html | 13 ++++++-------
doc/introduction.html | 2 +-
doc/ltn12.html | 2 +-
doc/mime.html | 2 +-
doc/reference.html | 2 +-
doc/smtp.html | 2 +-
doc/socket.html | 4 ++--
doc/tcp.html | 4 ++--
doc/udp.html | 2 +-
doc/url.html | 2 +-
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.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:56:09 EST 2005
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{
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:56:32 EST 2005
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 {
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:03 EST 2005
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.
-Danilo Tuler is mantaining Win32 binaries for LuaSocket, which are also
+Danilo Tuler is maintaining Win32 binaries for LuaSocket, which are also
available from LuaForge. These are compatible with the
LuaBinaries
available from LuaForge.
@@ -246,7 +246,7 @@ still available for those that have compatibility issues.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:56:56 EST 2005
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">
-Instalation
+Installation
LuaSocket 2.0 uses the new package proposal for Lua 5.1.
All Lua library developers are encouraged to update their libraries so that
@@ -48,7 +48,7 @@ standardization and flexibility of the standard.
The proposal was considered important enough by some of us to justify
early adoption, even before release of Lua 5.1.
-Thus, a compability module
+Thus, a compatibility module
compat-5.1
has been released in conjunction with Roberto Ierusalimschy and The Kepler Project team.
@@ -110,7 +110,7 @@ LUA_PATH=<SHARE>/?.lua;?.lua
LUA_CPATH=<LIB>/?.dll;?.dll
-
Again, naturally, on Unix systmems the shared library extension would be
+
Again, naturally, on Unix systems the shared library extension would be
.so instead of .dll.
Using LuaSocket
@@ -127,13 +127,12 @@ Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
Each module loads their dependencies automatically, so you only need to
-load the modues you directly depend upon:
+load the modules you directly depend upon:
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
> http = require("socket.http")
->
-print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
+> print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
--> homepage gets dumped to terminal
@@ -152,7 +151,7 @@ print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:22 EST 2005
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 reference manual.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:43 EST 2005
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
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:47 EST 2005
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.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:51 EST 2005
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">
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:57:56 EST 2005
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{
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:58:01 EST 2005
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.
-Mode defines the behaviour of the sink. The following
+Mode defines the behavior of the sink. The following
options are available:
@@ -395,7 +395,7 @@ This constant has a string describing the current LuaSocket version.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:58:06 EST 2005
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 connect, causing it to return
with an error in case of a timeout. If that happens, you can still call socket.select with the socket in the
sendt table. The socket will be writable when the connection is
-stablished.
+established.
@@ -539,7 +539,7 @@ This function returns 1.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:58:10 EST 2005
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.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:58:15 EST 2005
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.
Last modified by Diego Nehab on
-Sun Nov 28 03:19:00 EST 2004
+Mon Nov 21 01:58:20 EST 2005
diff --git a/etc/lp.lua b/etc/lp.lua
index a60fb86..3757e2d 100644
--- a/etc/lp.lua
+++ b/etc/lp.lua
@@ -11,6 +11,8 @@
-- make sure LuaSocket is loaded
local io = require("io")
local base = _G
+local os = require("os")
+local math = require("math")
local string = require("string")
local socket = require("socket")
local ltn12 = require("ltn12")
@@ -192,6 +194,7 @@ local function send_data(con,fh,size)
con.try(size == 0, "file size mismatch")
end
end
+ recv_ack(con) -- note the double acknowledgement
send_ack(con)
recv_ack(con)
return size
@@ -224,7 +227,7 @@ local control_dflt = {
local seq = 0
local function newjob(connection)
seq = seq + 1
- return math.floor(socket.gettime() * 1000 + seq)
+ return math.floor(socket.gettime() * 1000 + seq)%1000
end
@@ -241,22 +244,24 @@ local format_codes = {
f = 'f'
}
--- lp.send
+-- lp.send{option}
+-- requires option.file
-send = socket.protect(function(file, option)
- socket.try(file, "invalid file name")
+send = socket.protect(function(option)
socket.try(option and base.type(option) == "table", "invalid options")
+ local file = option.file
+ socket.try(file, "invalid file name")
local fh = socket.try(io.open(file,"rb"))
local datafile_size = fh:seek("end") -- get total size
- fh:seek("set") -- go back to start of file
- local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME")
+ fh:seek("set") -- go back to start of file
+ local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME")
or "localhost"
local con = connect(localhost, option)
-- format the control file
local jobno = newjob()
local localip = socket.dns.toip(localhost)
localhost = string.sub(localhost,1,31)
- local user = string.sub(option.user or os.getenv("LPRUSER") or
+ local user = string.sub(option.user or os.getenv("LPRUSER") or
os.getenv("USERNAME") or os.getenv("USER") or "anonymous", 1,31)
local lpfile = string.format("dfA%3.3d%-s", jobno, localhost);
local fmt = format_codes[option.format] or 'l'
@@ -306,15 +311,14 @@ end)
--
query = socket.protect(function(p)
p = p or {}
- local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME")
+ local localhost = socket.dns.gethostname() or os.getenv("COMPUTERNAME")
or "localhost"
local con = connect(localhost,p)
local fmt
if string.sub(p.format or 's',1,1) == 's' then fmt = 3 else fmt = 4 end
- con.try(con.skt:send(string.format("%c%s %s\n", fmt, p.queue or "*",
+ con.try(con.skt:send(string.format("%c%s %s\n", fmt, p.queue or "*",
p.list or "")))
local data = con.try(con.skt:receive("*a"))
con.skt:close()
return data
end)
-