Spell checking on the manuals.

David's changes to lp.lua.
This commit is contained in:
Diego Nehab 2005-11-21 07:04:44 +00:00
parent 71f483496d
commit a2b780bf7a
15 changed files with 36 additions and 33 deletions

View File

@ -122,7 +122,7 @@ message.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:56:09 EST 2005
</small>
</p>
</center>

View File

@ -279,7 +279,7 @@ f, e = ftp.put{
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:56:32 EST 2005
</small>
</p>
</center>

View File

@ -315,7 +315,7 @@ r, c = http.request {
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:03 EST 2005
</small>
</p>
</center>

View File

@ -101,7 +101,7 @@ contains several examples, this user's manual and basic test procedures.
</p>
<p>
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
<a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a>
available from LuaForge.
@ -246,7 +246,7 @@ still available for those that have compatibility issues.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:56:56 EST 2005
</small>
</p>
</center>

View File

@ -37,7 +37,7 @@ Installation">
<!-- installation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2>Instalation</h2>
<h2>Installation</h2>
<p> 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.
<p>
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
<a href=http://www.keplerproject.org/compat/>compat-5.1</a>
has been released in conjunction with Roberto Ierusalimschy and <a
href=http://www.keplerproject.org/>The Kepler Project</a> team.
@ -110,7 +110,7 @@ LUA_PATH=&lt;SHARE&gt;/?.lua;?.lua
LUA_CPATH=&lt;LIB&gt;/?.dll;?.dll
</pre>
<p> Again, naturally, on Unix systmems the shared library extension would be
<p> Again, naturally, on Unix systems the shared library extension would be
<tt>.so</tt> instead of <tt>.dll</tt>.</p>
<h3>Using LuaSocket</h3>
@ -127,13 +127,12 @@ Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
</pre>
<p> Each module loads their dependencies automatically, so you only need to
load the modues you directly depend upon: <p>
load the modules you directly depend upon: </p>
<pre class=example>
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
&gt; http = require("socket.http")
&gt;
print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
&gt; print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
--&gt; homepage gets dumped to terminal
</pre>
@ -152,7 +151,7 @@ print(http.request("http://www.cs.princeton.edu/~diego/professional/luasocket"))
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:22 EST 2005
</small>
</p>
</center>

View File

@ -323,7 +323,7 @@ and many others are covered by the <a href=reference.html>reference manual</a>.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:43 EST 2005
</small>
</p>
</center>

View File

@ -420,7 +420,7 @@ Creates and returns a source that produces the contents of a
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:47 EST 2005
</small>
</p>
</center>

View File

@ -466,7 +466,7 @@ marker.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:51 EST 2005
</small>
</p>
</center>

View File

@ -229,7 +229,7 @@ Support, Manual">
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:57:56 EST 2005
</small>
</p>
</center>

View File

@ -407,7 +407,7 @@ r, e = smtp.send{
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:58:01 EST 2005
</small>
</p>
</center>

View File

@ -230,7 +230,7 @@ sink from a stream socket object.
</p>
<p class=parameters>
<tt>Mode</tt> defines the behaviour of the sink. The following
<tt>Mode</tt> defines the behavior of the sink. The following
options are available:
</p>
<ul>
@ -395,7 +395,7 @@ This constant has a string describing the current LuaSocket version.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:58:06 EST 2005
</small>
</p>
</center>

View File

@ -177,7 +177,7 @@ method affects the behavior of <tt>connect</tt>, causing it to return
with an error in case of a timeout. If that happens, you can still call <a
href=socket.html#select><tt>socket.select</tt></a> with the socket in the
<tt>sendt</tt> table. The socket will be writable when the connection is
stablished.
established.
</p>
<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@ -539,7 +539,7 @@ This function returns 1.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:58:10 EST 2005
</small>
</p>
</center>

View File

@ -406,7 +406,7 @@ imperative nature obvious.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:58:15 EST 2005
</small>
</p>
</center>

View File

@ -319,7 +319,7 @@ The function returns the decoded string.
<p>
<small>
Last modified by Diego Nehab on <br>
Sun Nov 28 03:19:00 EST 2004
Mon Nov 21 01:58:20 EST 2005
</small>
</p>
</center>

View File

@ -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)