# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../lua-posix/update-lua51.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
--- posix/lposix.c	2003-11-06 01:23:48.000000000 +0100
+++ posix-5.1-alpha/lposix.c	2005-09-04 13:59:15.000000000 +0200
@@ -64,7 +64,7 @@
 	}
 	else
 	{
-		int j=luaL_findstring(luaL_checkstring(L, i), S);
+		int j=luaL_checkoption(L, i, NULL, S);
 		if (j==-1) luaL_argerror(L, i, "unknown selector");
 		return F(L, j, data);
 	}
@@ -802,7 +802,7 @@
 	{NULL,			NULL}
 };
 
-LUALIB_API int luaopen_posix (lua_State *L)
+LUALIB_API int luaopen_lposix (lua_State *L)
 {
 	luaL_openlib(L, MYNAME, R, 0);
 	lua_pushliteral(L,"version");		/** version */
--- posix/posix.lua	2003-06-18 14:47:44.000000000 +0200
+++ posix-5.1-alpha/posix.lua	2005-09-04 14:15:14.000000000 +0200
@@ -1,10 +1,4 @@
 -- posix.lua
 -- support code for posix library
--- usage lua -lposix ...
 
-local function so(x)
-	local SOPATH= os.getenv"LUA_SOPATH" or "./"
-	assert(loadlib(SOPATH.."l"..x..".so","luaopen_"..x))()
-end
-
-so"posix"
+require"lposix"
--- posix/test.lua	2003-11-07 12:42:30.000000000 +0100
+++ posix-5.1-alpha/test.lua	2005-09-04 13:51:39.000000000 +0200
@@ -41,7 +41,7 @@
 f"HOME"
 f"SHELL"
 f"absent"
-for k in ox.getenv() do io.write(k,"\t") end io.write"\n"
+for k,_ in pairs(ox.getenv()) do io.write(k,"\t") end io.write"\n"
 
 ------------------------------------------------------------------------------
 testing"putenv"
@@ -179,11 +179,11 @@
 ------------------------------------------------------------------------------
 testing"times"
 a=ox.times()
-for k,v in a do print(k,v) end
+for k,v in pairs(a) do print(k,v) end
 print"sleeping 10 seconds..."
 ox.sleep(10)
 b=ox.times()
-for k,v in b do print(k,v) end
+for k,v in pairs(b) do print(k,v) end
 print""
 print("elapsed",b.elapsed-a.elapsed)
 print("clock",os.clock())