Few tweaks in installation, some missing files, etc.

This commit is contained in:
Diego Nehab 2005-11-22 08:33:29 +00:00
parent a2b780bf7a
commit d55a5826e8
26 changed files with 232 additions and 238 deletions

2
config
View File

@ -27,7 +27,7 @@ COMPAT=compat-5.1r4
# Top of your Lua installation # Top of your Lua installation
# Relative paths will be inside the src tree # Relative paths will be inside the src tree
# #
INSTALL_TOP_LUA=share INSTALL_TOP_SHARE=share
INSTALL_TOP_LIB=lib INSTALL_TOP_LIB=lib
INSTALL_DATA=cp INSTALL_DATA=cp

View File

@ -69,22 +69,22 @@ independent files. Let's call these directories <tt>&lt;LIB&gt;</tt>
and <tt>&lt;SHARE&gt;</tt>, respectively. and <tt>&lt;SHARE&gt;</tt>, respectively.
For instance, in my laptop, I use '<tt>/usr/local/lib/lua/5.0</tt>' for For instance, in my laptop, I use '<tt>/usr/local/lib/lua/5.0</tt>' for
<tt>&lt;LIB&gt;</tt> and '<tt>/usr/local/share/lua/5.0</tt>' for <tt>&lt;LIB&gt;</tt> and '<tt>/usr/local/share/lua/5.0</tt>' for
<tt>&lt;SHARE&gt;</tt>. On Windows, only one directory is used, say <tt>&lt;SHARE&gt;</tt>. On Windows, sometimes only one directory is used, say
'<tt>c:\program files\lua\5.0</tt>'. Here is the standard LuaSocket '<tt>c:\program files\lua\5.0</tt>'. Here is the standard LuaSocket
distribution directory structure:</p> distribution directory structure:</p>
<pre class=example> <pre class=example>
&lt;SHARE&gt;/compat-5.1.lua &lt;SHARE&gt;/compat-5.1.lua
&lt;SHARE&gt;/ltn12.lua &lt;SHARE&gt;/ltn12.lua
&lt;SHARE&gt;/mime/mime.lua &lt;SHARE&gt;/socket.lua
&lt;LIB&gt;/mime/core.dll
&lt;SHARE&gt;/socket/socket.lua
&lt;LIB&gt;/socket/core.dll &lt;LIB&gt;/socket/core.dll
&lt;SHARE&gt;/socket/http.lua &lt;SHARE&gt;/socket/http.lua
&lt;SHARE&gt;/socket/tp.lua &lt;SHARE&gt;/socket/tp.lua
&lt;SHARE&gt;/socket/ftp.lua &lt;SHARE&gt;/socket/ftp.lua
&lt;SHARE&gt;/socket/smtp.lua &lt;SHARE&gt;/socket/smtp.lua
&lt;SHARE&gt;/socket/url.lua &lt;SHARE&gt;/socket/url.lua
&lt;SHARE&gt;/mime.lua
&lt;LIB&gt;/mime/core.dll
</pre> </pre>
<p> Naturally, on Unix systems, <tt>core.dll</tt> <p> Naturally, on Unix systems, <tt>core.dll</tt>

View File

@ -210,13 +210,6 @@ Use the <a href=tcp.html#settimeout><tt>settimeout</tt></a>
method or <tt>accept</tt> might block forever. method or <tt>accept</tt> might block forever.
</p> </p>
<p class=note>
Interesting note: as mentioned in some Unix manuals, calling select with both
sets empty and a non-null timeout is a fairly portable way to sleep with
sub-second precision (<b>except it doesn't work on Windows</b>).
</p>
<!-- sink ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> <!-- sink ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<p class=name id=sink> <p class=name id=sink>

View File

@ -6,9 +6,9 @@ include config
#------ #------
# Hopefully no need to change anything below this line # Hopefully no need to change anything below this line
# #
INSTALL_SOCKET_LUA=$(INSTALL_TOP_LUA)/socket INSTALL_SOCKET_SHARE=$(INSTALL_TOP_SHARE)/socket
INSTALL_SOCKET_LIB=$(INSTALL_TOP_LIB)/socket INSTALL_SOCKET_LIB=$(INSTALL_TOP_LIB)/socket
INSTALL_MIME_LUA=$(INSTALL_TOP_LUA)/mime INSTALL_MIME_SHARE=$(INSTALL_TOP_SHARE)/mime
INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime
all clean: all clean:
@ -17,35 +17,34 @@ all clean:
#------ #------
# Files to install # Files to install
# #
TO_SOCKET_LUA:= \ TO_SOCKET_SHARE:= \
socket.lua \
http.lua \ http.lua \
url.lua \ url.lua \
tp.lua \ tp.lua \
ftp.lua \ ftp.lua \
smtp.lua smtp.lua
TO_TOP_LUA:= \ TO_TOP_SHARE:= \
ltn12.lua $(COMPAT)/compat-5.1.lua \
ltn12.lua \
TO_MIME_LUA:= \ socket.lua \
mime.lua mime.lua
TO_MIME_SHARE:=
#------ #------
# Install LuaSocket according to recommendation # Install LuaSocket according to recommendation
# #
install: all install: all
cd src; mkdir -p $(INSTALL_TOP_LUA) cd src; mkdir -p $(INSTALL_TOP_SHARE)
cd src; mkdir -p $(INSTALL_TOP_LIB) cd src; $(INSTALL_DATA) $(TO_TOP_SHARE) $(INSTALL_TOP_SHARE)
cd src; $(INSTALL_DATA) $(COMPAT)/compat-5.1.lua $(INSTALL_TOP_LUA) cd src; mkdir -p $(INSTALL_SOCKET_SHARE)
cd src; $(INSTALL_DATA) ltn12.lua $(INSTALL_TOP_LUA) cd src; $(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE)
cd src; mkdir -p $(INSTALL_SOCKET_LUA)
cd src; mkdir -p $(INSTALL_SOCKET_LIB) cd src; mkdir -p $(INSTALL_SOCKET_LIB)
cd src; $(INSTALL_DATA) $(TO_SOCKET_LUA) $(INSTALL_SOCKET_LUA)
cd src; $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(EXT) cd src; $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(EXT)
cd src; mkdir -p $(INSTALL_MIME_LUA) #cd src; mkdir -p $(INSTALL_MIME_SHARE)
#cd src; $(INSTALL_DATA) $(TO_MIME_SHARE) $(INSTALL_MIME_SHARE)
cd src; mkdir -p $(INSTALL_MIME_LIB) cd src; mkdir -p $(INSTALL_MIME_LIB)
cd src; $(INSTALL_DATA) $(TO_MIME_LUA) $(INSTALL_MIME_LUA)
cd src; $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT) cd src; $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT)
#------ #------

View File

@ -1,13 +1,12 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Distribution makefile # Distribution makefile
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
DIST = luasocket-2.0 DIST = luasocket-2.0
COMPAT = src/compat-5.1r4 COMPAT = src/compat-5.1r4
TEST = \ TEST = \
test/README \
test/testclnt.lua \ test/testclnt.lua \
test/testsrvr.lua \ test/testsrvr.lua \
test/testsupport.lua test/testsupport.lua
@ -33,12 +32,12 @@ ETC = \
etc/eol.lua \ etc/eol.lua \
etc/forward.lua \ etc/forward.lua \
etc/get.lua \ etc/get.lua \
etc/links \
etc/lp.lua \ etc/lp.lua \
etc/qp.lua \ etc/qp.lua \
etc/tftp.lua etc/tftp.lua
SRC = \ SRC = \
src/makefile \
src/auxiliar.c \ src/auxiliar.c \
src/auxiliar.h \ src/auxiliar.h \
src/buffer.c \ src/buffer.c \
@ -108,6 +107,7 @@ dist:
mkdir -p $(DIST) mkdir -p $(DIST)
cp -vf NEW $(DIST) cp -vf NEW $(DIST)
cp -vf LICENSE $(DIST) cp -vf LICENSE $(DIST)
cp -vf README $(DIST)
cp -vf $(MAKE) $(DIST) cp -vf $(MAKE) $(DIST)
mkdir -p $(DIST)/etc mkdir -p $(DIST)/etc

View File

@ -36,7 +36,8 @@ do
return usage() return usage()
end end
if arg[1] ~= "query" then if arg[1] ~= "query" then
r,e=lp.send(arg[1],opt) opt.file = arg[1]
r,e=lp.send(opt)
io.stdout:write(tostring(r or e),'\n') io.stdout:write(tostring(r or e),'\n')
else else
r,e=lp.query(opt) r,e=lp.query(opt)

View File

@ -110,6 +110,7 @@ int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds,
double t = timeout_getretry(tm); double t = timeout_getretry(tm);
tv.tv_sec = (int) t; tv.tv_sec = (int) t;
tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6); tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6);
/* timeout = 0 means no wait */
ret = select(n, rfds, wfds, efds, t >= 0.0 ? &tv: NULL); ret = select(n, rfds, wfds, efds, t >= 0.0 ? &tv: NULL);
} while (ret < 0 && errno == EINTR); } while (ret < 0 && errno == EINTR);
return ret; return ret;