Experimental diff for those who want it. Fixed point bits still pending.

-p.

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/lua/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile    8 Feb 2006 04:54:49 -0000       1.21
+++ Makefile    21 May 2006 19:24:24 -0000
@@ -2,10 +2,7 @@
 
 COMMENT=       "powerful, light-weight programming language"
 
-DISTNAME=      lua-5.0.2
-PKGNAME=       ${DISTNAME}p6
-SHARED_LIBS=   lua 5.0 \
-               lualib 5.0
+DISTNAME=      lua-5.1
 CATEGORIES=     lang
 
 MASTER_SITES=  http://www.lua.org/ftp/ \
@@ -28,53 +25,8 @@
 WANTLIB=       c m edit curses
 NO_REGRESS=    Yes
 
-FLAVORS=fixedpoint
-FLAVOR?=
-
-.if ${MACHINE_ARCH} != "m88k" && ${MACHINE_ARCH} != "vax"
-CFLAGS+=       -fPIC
-ALL_TARGET+=   all so sobin
-.endif
-
-MAKE_FLAGS+=   LIBlua_VERSION=${LIBlua_VERSION} \
-               LIBlualib_VERSION=${LIBlualib_VERSION}
-
-post-extract:
-.for f in init luapkg packages
-       @sed -e "s:@pkgconf@:${SYSCONFDIR}/lua/packages.lua:g" \
-               ${FILESDIR}/${f}.lua > ${WRKSRC}/$f.lua
-.endfor
-
 post-patch:
-       @touch ${WRKSRC}/include/luser.h
-.if ${FLAVOR:L:Mfixedpoint}
-       @cp -p ${FILESDIR}/luser_fixedpoint.h ${WRKSRC}/include
-       @echo '#include "luser_fixedpoint.h"' >> ${WRKSRC}/include/luser.h
-.endif
-
-pre-configure:
-       @perl -pi -e 's:[EMAIL PROTECTED]@:${SYSCONFDIR}/lua/init.lua:g;' \
-               ${WRKSRC}/src/lua/lua.c
-
-post-build:
-       cd ${WRKDIST} && ${CC} ${CFLAGS} -o bin/bin2c etc/bin2c.c
-
-do-install:
-       ${INSTALL_DATA_DIR} ${PREFIX}/include
-       ${INSTALL_DATA} ${WRKDIST}/include/*.h ${PREFIX}/include
-       ${INSTALL_DATA} ${WRKDIST}/lib/* ${PREFIX}/lib
-       ${INSTALL_PROGRAM} ${WRKDIST}/bin/lua ${PREFIX}/bin
-       ${INSTALL_PROGRAM} ${WRKDIST}/bin/luac ${PREFIX}/bin
-       ${INSTALL_PROGRAM} ${WRKDIST}/bin/bin2c ${PREFIX}/bin
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/lua
-       ${INSTALL_DATA} ${WRKDIST}/doc/*.html ${WRKDIST}/doc/*.gif \
-               ${PREFIX}/share/doc/lua
-       ${INSTALL_MAN_DIR} ${PREFIX}/man/man1
-       ${INSTALL_MAN} ${WRKDIST}/doc/*.1 ${PREFIX}/man/man1
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/lua
-       ${INSTALL_DATA} ${WRKSRC}/init.lua ${PREFIX}/share/examples/lua
-       ${INSTALL_DATA} ${WRKSRC}/luapkg.lua ${PREFIX}/share/examples/lua
-       ${INSTALL_DATA} ${WRKSRC}/packages.lua \
-               ${PREFIX}/share/examples/lua/packages.lua
+       @cp -p ${FILESDIR}/luser.h ${WRKSRC}/src
+       @echo '#define LUA_ROOT "${PREFIX}/"' >> ${WRKSRC}/src/luser.h
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/lua/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- distinfo    5 Jan 2005 16:58:52 -0000       1.4
+++ distinfo    21 May 2006 19:24:24 -0000
@@ -1,4 +1,4 @@
-MD5 (lua-5.0.2.tar.gz) = dea74646b7e5c621fef7174df83c34b1
-RMD160 (lua-5.0.2.tar.gz) = 5f1a1cf5802e38b3c4dcfc9f3cd0dc33bfdc0a30
-SHA1 (lua-5.0.2.tar.gz) = a200cfd20a9a4c7da1206ae45dddf26186a9e0e7
-SIZE (lua-5.0.2.tar.gz) = 190442
+MD5 (lua-5.1.tar.gz) = 3e8dfe8be00a744cec2f9e766b2f2aee
+RMD160 (lua-5.1.tar.gz) = 90c40dd318be63df86031e4932a09eeba5fa2812
+SHA1 (lua-5.1.tar.gz) = 1ae9ec317511d525c7999c842ca0b1ddde84e374
+SIZE (lua-5.1.tar.gz) = 206877
Index: files/init.lua
===================================================================
RCS file: files/init.lua
diff -N files/init.lua
--- files/init.lua      10 Dec 2005 23:02:05 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
--- $OpenBSD: init.lua,v 1.3 2005/12/10 23:02:05 pedro Exp $
--- Written by Pedro Martelletto <[EMAIL PROTECTED]> in 2004. Public domain.
-
--- add an entry to a path list
-local function
-addpath(path, entry)
-       return (path or "") .. ((path and ";") or "") .. entry
-end
-
--- add an entry to the lua path
-function
-lua_addpath(entry)
-       if package then
-               -- if we are using luacompat, add the entry to package.path
-               package.path = addpath(package.path, entry)
-       else
-               -- otherwise, add it to the normal 'lua_path'
-               LUA_PATH = addpath(LUA_PATH, entry)
-       end
-end
-
--- add an entry to the lua c path
-function
-lua_addcpath(entry)
-       if package then
-               -- if we are using luacompat, add the entry to package.cpath
-               package.cpath = addpath(package.cpath, entry)
-       else
-               -- otherwise, add it to the normal 'lua_cpath'
-               LUA_CPATH = addpath(LUA_CPATH, entry)
-       end
-end
-
--- get the package table
-local f = assert(loadfile("@pkgconf@"))
-setfenv(f, {}) f() local pt = getfenv(f).installed_packages
-
--- iterate over the table, loading each package
-for i, v in pt do
-       local f, e = loadfile(v)
-       if not f then
-               print(string.format("Failed to load package %s, %s", i, e))
-       else f() end -- load the package
-end
-
--- finally, run user's initialization file, if it exists
-local f = loadfile((os.getenv("HOME") or "") .. "/.lua/init.lua")
-if f then f() end
-
-lua_addpath("?;?.lua") -- set the default path
-
--- nuke exported functions
-lua_addpath = nil
-lua_addcpath = nil
Index: files/luapkg.lua
===================================================================
RCS file: files/luapkg.lua
diff -N files/luapkg.lua
--- files/luapkg.lua    16 Dec 2004 13:04:07 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
--- $OpenBSD: luapkg.lua,v 1.1 2004/12/16 13:04:07 pedro Exp $
--- Written by Pedro Martelletto <[EMAIL PROTECTED]> in 2004. Public domain.
-
--- check for valid arguments
-function usage() error("Usage: luapkg add/del <name> <init file>") end
-if table.getn(arg) < 2 or arg[1] ~= "add" and arg[1] ~= "del" then usage() end
-
--- get the package table
-f = assert(loadfile("@pkgconf@"))
-setfenv(f, {}) f() pt = getfenv(f).installed_packages
-
--- do the necessary changes on it
-if arg[1] == "add" then
-       assert(not pt[arg[2]], "Package already installed")
-       pt[arg[2]] = arg[3] or ""
-elseif arg[1] == "del" then
-       assert(pt[arg[2]], "Package not installed")
-       pt[arg[2]] = nil
-end
-
--- dump it back to disk
-f = assert(io.open("@pkgconf@", "w"))
-f:write("installed_packages = {\n")
-for i, v in pairs(pt) do f:write(string.format("\t[%q] = %q,\n", i, v)) end
-f:write("}\n")
-f:close()
Index: files/luser.h
===================================================================
RCS file: files/luser.h
diff -N files/luser.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/luser.h       21 May 2006 19:24:24 -0000
@@ -0,0 +1,2 @@
+/*     $OpenBSD$       */
+
Index: files/luser_fixedpoint.h
===================================================================
RCS file: files/luser_fixedpoint.h
diff -N files/luser_fixedpoint.h
--- files/luser_fixedpoint.h    21 Jan 2006 01:29:40 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-/*     $OpenBSD: luser_fixedpoint.h,v 1.1 2006/01/21 01:29:40 jolan Exp $      
*/
-
-#define LUA_NUMBER              int
-#define LUA_NUMBER_SCAN         "%d"
-#define LUA_NUMBER_FMT          "%d"
-#define lua_str2number(s,p)     ((int) strtol((s), (p), 10))
Index: files/packages.lua
===================================================================
RCS file: files/packages.lua
diff -N files/packages.lua
--- files/packages.lua  16 Dec 2004 13:04:07 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-installed_packages = {
-}
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/lang/lua/patches/patch-Makefile,v
retrieving revision 1.1
diff -u -r1.1 patch-Makefile
--- patches/patch-Makefile      3 Jan 2006 23:00:32 -0000       1.1
+++ patches/patch-Makefile      21 May 2006 19:24:24 -0000
@@ -1,15 +1,28 @@
-$OpenBSD: patch-Makefile,v 1.1 2006/01/03 23:00:32 alek Exp $
---- Makefile.orig      Fri Mar 12 02:50:55 2004
-+++ Makefile   Tue Jan  3 23:45:20 2006
-@@ -38,9 +38,8 @@ install: all strip
+$OpenBSD$
+--- Makefile.orig      Thu Feb 16 13:45:17 2006
++++ Makefile   Fri May 19 13:45:15 2006
+@@ -5,13 +5,13 @@
+ # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT 
=======================
  
- # shared libraries (for Linux)
- so:
--      ld -o lib/liblua.so.$V -shared src/*.o
--      ld -o lib/liblualib.so.$V -shared src/lib/*.o
--      cd lib; ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V 
liblualib.so
-+      ld -o lib/liblua.so.${LIBlua_VERSION} -shared src/*.o
-+      ld -o lib/liblualib.so.${LIBlualib_VERSION} -shared src/lib/*.o
+ # Your platform. See PLATS for possible values.
+-PLAT= none
++PLAT= bsd
+ 
+ # Where to install. The installation starts in the src directory, so take care
+ # if INSTALL_TOP is not an absolute path. (Man pages are installed from the
+ # doc directory.)
+ #
+-INSTALL_TOP= /usr/local
++INSTALL_TOP= $(PREFIX)
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+ INSTALL_INC= $(INSTALL_TOP)/include
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+@@ -41,7 +41,7 @@ PLATS= aix ansi bsd generic linux macosx
+ 
+ # What to install.
+ TO_BIN= lua luac
+-TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
++TO_INC= lua.h luser.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+ TO_LIB= liblua.a
+ TO_MAN= lua.1 luac.1
  
- # binaries using shared libraries
- sobin:
Index: patches/patch-config
===================================================================
RCS file: patches/patch-config
diff -N patches/patch-config
--- patches/patch-config        27 Apr 2005 16:41:11 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
---- config.orig        Fri Apr 11 11:00:41 2003
-+++ config     Wed Apr 27 08:09:23 2005
-@@ -25,7 +25,7 @@ USERCONF=
- # interface (e.g., Linux, Solaris, IRIX, BSD, AIX, HPUX, and probably others),
- # uncomment the next two lines.
- #
--#LOADLIB= -DUSE_DLOPEN=1
-+LOADLIB= -DUSE_DLOPEN=1
- #DLLIB= -ldl
- #
- # In Linux with gcc, you should also uncomment the next definition for
-@@ -45,7 +45,7 @@ USERCONF=
- # If your system is not POSIX but has popen and pclose, define USE_POPEN=1.
- # If you don't want to support pipes, define USE_POPEN=0.
- #
--#POPEN= -DUSE_POPEN=1
-+POPEN= -DUSE_POPEN=1
- #POPEN= -DUSE_POPEN=0
- #
- # The form below will probably work in (some) Windows systems.
-@@ -59,7 +59,7 @@ USERCONF=
- # use tmpnam even if you're not compiling with gcc, define USE_TMPNAME=0.
- #
- #TMPNAM= -DUSE_TMPNAME=1
--#TMPNAM= -DUSE_TMPNAME=0
-+TMPNAM= -DUSE_TMPNAME=0
- 
- # The Lua math library (src/lib/lmathlib.c) now operates in radians, unlike
- # previous versions of Lua, which used degrees. To use degrees instead of
-@@ -100,15 +100,15 @@ EXTRA_LIBS= -lm
- # to add -lreadline (and perhaps also -lhistory and -lcurses or -lncurses)
- # to EXTRA_LIBS.
- #
--#USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
--#EXTRA_LIBS= -lm -ldl -lreadline # -lhistory -lcurses -lncurses
-+USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
-+EXTRA_LIBS+= -ledit -lcurses # -lhistory -lcurses -lncurses
- 
- # ------------------------------------------------------------------ C 
compiler
- 
- # You need an ANSI C compiler. gcc is a popular one. We do not use -ansi in
- # WARN because it disables POSIX features used in the libraries.
- #
--CC= gcc
-+#CC= gcc
- WARN= -Wall
- 
- # ------------------------------------------------------------------ C options
-@@ -173,6 +173,6 @@ LIB= $(LUA)/lib
- INCS= -I$(INC) $(EXTRA_INCS)
- DEFS= $(NUMBER) $(EXTRA_DEFS)
- 
--CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
-+CFLAGS+= $(WARN) $(INCS) $(DEFS)
- 
- # (end of config)
Index: patches/patch-include_lua_h
===================================================================
RCS file: patches/patch-include_lua_h
diff -N patches/patch-include_lua_h
--- patches/patch-include_lua_h 21 Jan 2006 01:29:40 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-include_lua_h,v 1.1 2006/01/21 01:29:40 jolan Exp $
---- include/lua.h.orig Thu Mar 11 19:44:52 2004
-+++ include/lua.h      Fri Jan 20 03:49:39 2006
-@@ -77,9 +77,7 @@ typedef int (*lua_Chunkwriter) (lua_Stat
- /*
- ** generic extra include file
- */
--#ifdef LUA_USER_H
--#include LUA_USER_H
--#endif
-+#include "luser.h"
- 
- 
- /* type of numbers in Lua */
Index: patches/patch-src-lib-Makefile
===================================================================
RCS file: patches/patch-src-lib-Makefile
diff -N patches/patch-src-lib-Makefile
--- patches/patch-src-lib-Makefile      3 Dec 2003 00:56:43 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- src/lib/Makefile.orig      2003-03-28 09:49:56.000000000 -0300
-+++ src/lib/Makefile   2003-11-22 12:27:12.000000000 -0200
-@@ -4,7 +4,7 @@ LUA= ../..
- 
- include $(LUA)/config
- 
--EXTRA_DEFS= $(POPEN) $(TMPNAM) $(DEGREES) $(LOADLIB)
-+EXTRA_DEFS+= $(POPEN) $(TMPNAM) $(DEGREES) $(LOADLIB)
- 
- OBJS= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o lstrlib.o 
loadlib.o
- SRCS= lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c ltablib.c lstrlib.c 
loadlib.c
Index: patches/patch-src_Makefile
===================================================================
RCS file: patches/patch-src_Makefile
diff -N patches/patch-src_Makefile
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile  21 May 2006 19:24:24 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- src/Makefile.orig  Thu Feb 16 13:45:09 2006
++++ src/Makefile       Sat May 20 02:30:19 2006
+@@ -7,8 +7,8 @@
+ # Your platform. See PLATS for possible values.
+ PLAT= none
+ 
+-CC= gcc
+-CFLAGS= -O2 -Wall $(MYCFLAGS)
++CC= cc
++CFLAGS+= $(MYCFLAGS)
+ AR= ar rcu
+ RANLIB= ranlib
+ RM= rm -f
+@@ -86,7 +86,7 @@ ansi:
+       $(MAKE) all MYCFLAGS=-DLUA_ANSI
+ 
+ bsd:
+-      $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
++      $(MAKE) all MYCFLAGS=-DLUA_USE_BSD MYLIBS="-Wl,-E -ledit -lcurses"
+ 
+ generic:
+       $(MAKE) all MYCFLAGS=
Index: patches/patch-src_lgc_c
===================================================================
RCS file: patches/patch-src_lgc_c
diff -N patches/patch-src_lgc_c
--- patches/patch-src_lgc_c     26 Jan 2006 16:17:40 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_lgc_c,v 1.1 2006/01/26 16:17:40 pedro Exp $
---- src/lgc.c.orig     Thu Jan 26 11:01:11 2006
-+++ src/lgc.c  Thu Jan 26 11:01:42 2006
-@@ -368,7 +368,7 @@ static int sweeplist (lua_State *L, GCOb
-   GCObject *curr;
-   int count = 0;  /* number of collected items */
-   while ((curr = *p) != NULL) {
--    if (curr->gch.marked > limit) {
-+    if ((curr->gch.marked & ~(KEYWEAK | VALUEWEAK)) > limit) {
-       unmark(curr);
-       p = &curr->gch.next;
-     }
Index: patches/patch-src_lib_lbaselib_c
===================================================================
RCS file: patches/patch-src_lib_lbaselib_c
diff -N patches/patch-src_lib_lbaselib_c
--- patches/patch-src_lib_lbaselib_c    18 Jan 2006 11:17:03 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-$OpenBSD: patch-src_lib_lbaselib_c,v 1.1 2006/01/18 11:17:03 pedro Exp $
---- src/lib/lbaselib.c.orig    Tue Jan 17 13:44:57 2006
-+++ src/lib/lbaselib.c Tue Jan 17 13:45:42 2006
-@@ -340,17 +340,17 @@ static int luaB_tostring (lua_State *L) 
-       lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false"));
-       return 1;
-     case LUA_TTABLE:
--      sprintf(buff, "table: %p", lua_topointer(L, 1));
-+      snprintf(buff, sizeof(buff), "table: %p", lua_topointer(L, 1));
-       break;
-     case LUA_TFUNCTION:
--      sprintf(buff, "function: %p", lua_topointer(L, 1));
-+      snprintf(buff, sizeof(buff), "function: %p", lua_topointer(L, 1));
-       break;
-     case LUA_TUSERDATA:
-     case LUA_TLIGHTUSERDATA:
--      sprintf(buff, "userdata: %p", lua_touserdata(L, 1));
-+      snprintf(buff, sizeof(buff), "userdata: %p", lua_touserdata(L, 1));
-       break;
-     case LUA_TTHREAD:
--      sprintf(buff, "thread: %p", (void *)lua_tothread(L, 1));
-+      snprintf(buff, sizeof(buff), "thread: %p", (void *)lua_tothread(L, 1));
-       break;
-     case LUA_TNIL:
-       lua_pushliteral(L, "nil");
Index: patches/patch-src_lib_liolib_c
===================================================================
RCS file: patches/patch-src_lib_liolib_c
diff -N patches/patch-src_lib_liolib_c
--- patches/patch-src_lib_liolib_c      18 Jan 2006 11:17:03 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-src_lib_liolib_c,v 1.1 2006/01/18 11:17:03 pedro Exp $
---- src/lib/liolib.c.orig      Tue Jan 17 13:46:10 2006
-+++ src/lib/liolib.c   Tue Jan 17 13:46:46 2006
-@@ -178,9 +178,9 @@ static int io_tostring (lua_State *L) {
-   char buff[128];
-   FILE **f = topfile(L, 1);
-   if (*f == NULL)
--    strcpy(buff, "closed");
-+    strlcpy(buff, "closed", sizeof(buff));
-   else
--    sprintf(buff, "%p", lua_touserdata(L, 1));
-+    snprintf(buff, sizeof(buff), "%p", lua_touserdata(L, 1));
-   lua_pushfstring(L, "file (%s)", buff);
-   return 1;
- }
Index: patches/patch-src_lib_lstrlib_c
===================================================================
RCS file: patches/patch-src_lib_lstrlib_c
diff -N patches/patch-src_lib_lstrlib_c
--- patches/patch-src_lib_lstrlib_c     18 Jan 2006 11:17:03 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-$OpenBSD: patch-src_lib_lstrlib_c,v 1.1 2006/01/18 11:17:03 pedro Exp $
---- src/lib/lstrlib.c.orig     Tue Jan 17 13:46:55 2006
-+++ src/lib/lstrlib.c  Tue Jan 17 13:49:37 2006
-@@ -700,16 +700,16 @@ static int str_format (lua_State *L) {
-       strfrmt = scanformat(L, strfrmt, form, &hasprecision);
-       switch (*strfrmt++) {
-         case 'c':  case 'd':  case 'i': {
--          sprintf(buff, form, luaL_checkint(L, arg));
-+          snprintf(buff, sizeof(buff), form, luaL_checkint(L, arg));
-           break;
-         }
-         case 'o':  case 'u':  case 'x':  case 'X': {
--          sprintf(buff, form, (unsigned int)(luaL_checknumber(L, arg)));
-+          snprintf(buff, sizeof(buff), form, (unsigned 
int)(luaL_checknumber(L, arg)));
-           break;
-         }
-         case 'e':  case 'E': case 'f':
-         case 'g': case 'G': {
--          sprintf(buff, form, luaL_checknumber(L, arg));
-+          snprintf(buff, sizeof(buff), form, luaL_checknumber(L, arg));
-           break;
-         }
-         case 'q': {
-@@ -727,7 +727,7 @@ static int str_format (lua_State *L) {
-             continue;  /* skip the `addsize' at the end */
-           }
-           else {
--            sprintf(buff, form, s);
-+            snprintf(buff, sizeof(buff), form, s);
-             break;
-           }
-         }
Index: patches/patch-src_lobject_c
===================================================================
RCS file: /cvs/ports/lang/lua/patches/patch-src_lobject_c,v
retrieving revision 1.1
diff -u -r1.1 patch-src_lobject_c
--- patches/patch-src_lobject_c 18 Jan 2006 11:17:03 -0000      1.1
+++ patches/patch-src_lobject_c 21 May 2006 19:24:24 -0000
@@ -1,10 +1,19 @@
-$OpenBSD: patch-src_lobject_c,v 1.1 2006/01/18 11:17:03 pedro Exp $
---- src/lobject.c.orig Thu Apr  3 10:35:34 2003
-+++ src/lobject.c      Tue Jan 17 14:06:46 2006
-@@ -161,35 +161,33 @@ const char *luaO_pushfstring (lua_State 
+$OpenBSD$
+--- src/lobject.c.orig Fri Feb 10 15:43:52 2006
++++ src/lobject.c      Fri May 19 11:09:38 2006
+@@ -142,7 +142,7 @@ const char *luaO_pushvfstring (lua_State
+       }
+       case 'p': {
+         char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' 
*/
+-        sprintf(buff, "%p", va_arg(argp, void *));
++        snprintf(buff, sizeof(buff), "%p", va_arg(argp, void *));
+         pushstr(L, buff);
+         break;
+       }
+@@ -180,35 +180,33 @@ const char *luaO_pushfstring (lua_State 
  
  
- void luaO_chunkid (char *out, const char *source, int bufflen) {
+ void luaO_chunkid (char *out, const char *source, size_t bufflen) {
 -  if (*source == '=') {
 -    strncpy(out, source+1, bufflen);  /* remove first char */
 -    out[bufflen-1] = '\0';  /* ensures null termination */
@@ -13,31 +22,31 @@
 +    strlcpy(out, source+1, bufflen);  /* remove first char */
    else {  /* out = "source", or "...source" */
      if (*source == '@') {
--      int l;
-+      int l, m;
+-      size_t l;
++      size_t l, m;
        source++;  /* skip the `@' */
--      bufflen -= sizeof(" `...' ");
+-      bufflen -= sizeof(" '...' ");
        l = strlen(source);
 -      strcpy(out, "");
--      if (l>bufflen) {
+-      if (l > bufflen) {
 -        source += (l-bufflen);  /* get last part of file name */
 -        strcat(out, "...");
 +      m = bufflen - sizeof(" '...' ");
 +      strlcpy(out, "", bufflen);
 +      if (l > m) {
 +        source += (l-m);  /* get last part of file name */
-+        strlcat(out, "...", bufflen);
++      strlcat(out, "...", bufflen);
        }
 -      strcat(out, source);
 +      strlcat(out, source, bufflen);
      }
      else {  /* out = [string "string"] */
--      int len = strcspn(source, "\n");  /* stop at first newline */
+-      size_t len = strcspn(source, "\n\r");  /* stop at first newline */
 -      bufflen -= sizeof(" [string \"...\"] ");
 -      if (len > bufflen) len = bufflen;
 -      strcpy(out, "[string \"");
-+      int pos = strcspn(source, "\n\r");  /* stop at first newline */
-+      int len = bufflen - sizeof(" [string \"...\"] ");
++      size_t pos = strcspn(source, "\n\r");  /* stop at first newline */
++      size_t len = bufflen - sizeof(" [string \"...\"] ");
 +      if (pos > len) pos = len;
 +      strlcpy(out, "[string \"", bufflen);
        if (source[len] != '\0') {  /* must truncate? */
Index: patches/patch-src_lstrlib_c
===================================================================
RCS file: patches/patch-src_lstrlib_c
diff -N patches/patch-src_lstrlib_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_lstrlib_c 21 May 2006 19:24:24 -0000
@@ -0,0 +1,55 @@
+$OpenBSD$
+--- src/lstrlib.c.orig Thu Dec 29 13:32:11 2005
++++ src/lstrlib.c      Fri May 19 12:18:02 2006
+@@ -741,10 +741,9 @@ static const char *scanformat (lua_State
+ 
+ static void addintlen (char *form) {
+   size_t l = strlen(form);
+-  char spec = form[l - 1];
+-  strcpy(form + l - 1, LUA_INTFRMLEN);
+-  form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;
+-  form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0';
++  char spec[3] = { 'l', form[l - 1], '\0' };
++  form[l - 1] = '\0';
++  strlcat(form, spec, MAX_FORMAT);
+ }
+ 
+ 
+@@ -767,22 +766,24 @@ static int str_format (lua_State *L) {
+       strfrmt = scanformat(L, strfrmt, form);
+       switch (*strfrmt++) {
+         case 'c': {
+-          sprintf(buff, form, (int)luaL_checknumber(L, arg));
++          snprintf(buff, sizeof(buff), form, (int)luaL_checknumber(L, arg));
+           break;
+         }
+         case 'd':  case 'i': {
+           addintlen(form);
+-          sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
++          snprintf(buff, sizeof(buff), form,
++          (LUA_INTFRM_T)luaL_checknumber(L, arg));
+           break;
+         }
+         case 'o':  case 'u':  case 'x':  case 'X': {
+           addintlen(form);
+-          sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, 
arg));
++          snprintf(buff, sizeof(buff), form,
++          (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
+           break;
+         }
+         case 'e':  case 'E': case 'f':
+         case 'g': case 'G': {
+-          sprintf(buff, form, (double)luaL_checknumber(L, arg));
++          snprintf(buff, sizeof(buff), form, (double)luaL_checknumber(L, 
arg));
+           break;
+         }
+         case 'q': {
+@@ -800,7 +801,7 @@ static int str_format (lua_State *L) {
+             continue;  /* skip the `addsize' at the end */
+           }
+           else {
+-            sprintf(buff, form, s);
++            snprintf(buff, sizeof(buff), form, s);
+             break;
+           }
+         }
Index: patches/patch-src_lua_lua_c
===================================================================
RCS file: patches/patch-src_lua_lua_c
diff -N patches/patch-src_lua_lua_c
--- patches/patch-src_lua_lua_c 16 Dec 2004 13:04:07 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-$OpenBSD: patch-src_lua_lua_c,v 1.1 2004/12/16 13:04:07 pedro Exp $
---- src/lua/lua.c.orig Thu Apr  3 10:34:42 2003
-+++ src/lua/lua.c      Sun Sep  5 21:04:22 2004
-@@ -385,9 +385,16 @@ static void openstdlibs (lua_State *l) {
-   }
- }
- 
-+#ifndef LUA_SYSCONF
-+#define LUA_SYSCONF   "@initconf@"
-+#endif
- 
- static int handle_luainit (void) {
-   const char *init = getenv("LUA_INIT");
-+  /* load system-wide configuration file */
-+  if (file_input(LUA_SYSCONF))
-+      l_message(progname, "warning: couldn't load system-wide "
-+          "configuration file");
-   if (init == NULL) return 0;  /* status OK */
-   else if (init[0] == '@')
-     return file_input(init+1);
Index: patches/patch-src_luaconf_h
===================================================================
RCS file: patches/patch-src_luaconf_h
diff -N patches/patch-src_luaconf_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_luaconf_h 21 May 2006 19:24:24 -0000
@@ -0,0 +1,55 @@
+$OpenBSD$
+--- src/luaconf.h.orig Fri Feb 10 15:44:06 2006
++++ src/luaconf.h      Fri May 19 13:43:05 2006
+@@ -11,6 +11,7 @@
+ #include <limits.h>
+ #include <stddef.h>
+ 
++#include "luser.h"
+ 
+ /*
+ ** ==================================================================
+@@ -33,7 +34,7 @@
+ #define LUA_WIN
+ #endif
+ 
+-#if defined(LUA_USE_LINUX)
++#if defined(LUA_USE_BSD) || defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN                /* needs an extra library: -ldl */
+ #define LUA_USE_READLINE      /* needs some extra libraries */
+@@ -82,7 +83,6 @@
+       ".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+ 
+ #else
+-#define LUA_ROOT      "/usr/local/"
+ #define LUA_LDIR      LUA_ROOT "share/lua/5.1/"
+ #define LUA_CDIR      LUA_ROOT "lib/lua/5.1/"
+ #define LUA_PATH_DEFAULT  \
+@@ -171,7 +171,7 @@
+ #define LUAI_DATA     /* empty */
+ 
+ #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+-      defined(__ELF__)
++      defined(__ELF__) && !defined(LUA_USE_BSD)
+ #define LUAI_FUNC     __attribute__((visibility("hidden"))) extern
+ #define LUAI_DATA     LUAI_FUNC
+ 
+@@ -507,7 +507,7 @@
+ */
+ #define LUA_NUMBER_SCAN               "%lf"
+ #define LUA_NUMBER_FMT                "%.14g"
+-#define lua_number2str(s,n)   sprintf((s), LUA_NUMBER_FMT, (n))
++#define lua_number2str(s,n)   snprintf((s), sizeof((s)), LUA_NUMBER_FMT, (n))
+ #define LUAI_MAXNUMBER2STR    32 /* 16 digits, sign, point, and \0 */
+ #define lua_str2number(s,p)   strtod((s), (p))
+ 
+@@ -620,7 +620,7 @@ union luai_Cast { double l_d; long l_l; 
+ #include <unistd.h>
+ #define LUA_TMPNAMBUFSIZE     32
+ #define lua_tmpnam(b,e)       { \
+-      strcpy(b, "/tmp/lua_XXXXXX"); \
++      strlcpy(b, "/tmp/lua_XXXXXX", sizeof(b)); \
+       e = mkstemp(b); \
+       if (e != -1) close(e); \
+       e = (e == -1); }
Index: patches/patch-src_lvm_c
===================================================================
RCS file: patches/patch-src_lvm_c
diff -N patches/patch-src_lvm_c
--- patches/patch-src_lvm_c     18 Jan 2006 11:17:03 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_lvm_c,v 1.1 2006/01/18 11:17:03 pedro Exp $
---- src/lvm.c.orig     Tue Jan 17 13:53:34 2006
-+++ src/lvm.c  Tue Jan 17 13:56:56 2006
-@@ -32,7 +32,7 @@
- 
- /* function to convert a lua_Number to a string */
- #ifndef lua_number2str
--#define lua_number2str(s,n)     sprintf((s), LUA_NUMBER_FMT, (n))
-+#define lua_number2str(s,n)     snprintf((s), sizeof((s)), LUA_NUMBER_FMT, 
(n))
- #endif
- 
- 
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/lang/lua/pkg/DESCR,v
retrieving revision 1.3
diff -u -r1.3 DESCR
--- pkg/DESCR   21 Jan 2006 01:29:40 -0000      1.3
+++ pkg/DESCR   21 May 2006 19:24:24 -0000
@@ -1,7 +1,3 @@
 Lua is a powerful, light-weight programming language designed for
 extending applications.  Lua is also frequently used as a
 general-purpose, stand-alone language.
-
-FLAVORs:
-
-       fixedpoint - use integers instead of doubles for numbers
Index: pkg/PFRAG.fixedpoint
===================================================================
RCS file: pkg/PFRAG.fixedpoint
diff -N pkg/PFRAG.fixedpoint
--- pkg/PFRAG.fixedpoint        21 Jan 2006 01:29:40 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
[EMAIL PROTECTED] $OpenBSD: PFRAG.fixedpoint,v 1.1 2006/01/21 01:29:40 jolan 
Exp $
-include/luser_fixedpoint.h
Index: pkg/PFRAG.shared
===================================================================
RCS file: pkg/PFRAG.shared
diff -N pkg/PFRAG.shared
--- pkg/PFRAG.shared    3 Jan 2006 23:00:32 -0000       1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
[EMAIL PROTECTED] $OpenBSD: PFRAG.shared,v 1.4 2006/01/03 23:00:32 alek Exp $
[EMAIL PROTECTED] lib/liblua.so.${LIBlua_VERSION}
[EMAIL PROTECTED] lib/liblualib.so.${LIBlualib_VERSION}
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/lang/lua/pkg/PLIST,v
retrieving revision 1.9
diff -u -r1.9 PLIST
--- pkg/PLIST   21 Jan 2006 01:29:40 -0000      1.9
+++ pkg/PLIST   21 May 2006 19:24:24 -0000
@@ -1,29 +1,16 @@
 @comment $OpenBSD: PLIST,v 1.9 2006/01/21 01:29:40 jolan Exp $
-bin/bin2c
 bin/lua
 bin/luac
 include/lauxlib.h
 include/lua.h
+include/lua.hpp
+include/luaconf.h
 include/lualib.h
 include/luser.h
-%%fixedpoint%%
 lib/liblua.a
-lib/liblualib.a
+lib/lua/
+lib/lua/5.1/
 @man man/man1/lua.1
 @man man/man1/luac.1
-share/doc/lua/
-share/doc/lua/contents.html
-share/doc/lua/logo.gif
-share/doc/lua/lua.html
-share/doc/lua/luac.html
-share/doc/lua/manual.html
-share/doc/lua/readme.html
-%%SHARED%%
[EMAIL PROTECTED] ${SYSCONFDIR}/lua/
-share/examples/lua/
-share/examples/lua/init.lua
[EMAIL PROTECTED] ${SYSCONFDIR}/lua/init.lua
-share/examples/lua/luapkg.lua
[EMAIL PROTECTED] ${SYSCONFDIR}/lua/luapkg.lua
-share/examples/lua/packages.lua
[EMAIL PROTECTED] ${SYSCONFDIR}/lua/packages.lua
+share/lua/
+share/lua/5.1/

Reply via email to