1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Updated to Lua 5.1.3 (Bug fix release)

Updated stdnse to include tobinary, toocal, and tohex functions.
Minor optimizations to listop.lua
This commit is contained in:
batrick
2008-05-31 01:43:43 +00:00
parent 6692822a34
commit 21a2e7aea6
59 changed files with 627 additions and 386 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: ldblib.c,v 1.104 2005/12/29 15:32:11 roberto Exp $
** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@@ -255,24 +255,25 @@ static void gethooktable (lua_State *L) {
static int db_sethook (lua_State *L) {
int arg;
int arg, mask, count;
lua_Hook func;
lua_State *L1 = getthread(L, &arg);
if (lua_isnoneornil(L, arg+1)) {
lua_settop(L, arg+1);
lua_sethook(L1, NULL, 0, 0); /* turn off hooks */
func = NULL; mask = 0; count = 0; /* turn off hooks */
}
else {
const char *smask = luaL_checkstring(L, arg+2);
int count = luaL_optint(L, arg+3, 0);
luaL_checktype(L, arg+1, LUA_TFUNCTION);
lua_sethook(L1, hookf, makemask(smask, count), count);
count = luaL_optint(L, arg+3, 0);
func = hookf; mask = makemask(smask, count);
}
gethooktable(L1);
lua_pushlightuserdata(L1, L1);
gethooktable(L);
lua_pushlightuserdata(L, L1);
lua_pushvalue(L, arg+1);
lua_xmove(L, L1, 1);
lua_rawset(L1, -3); /* set new hook */
lua_pop(L1, 1); /* remove hook table */
lua_rawset(L, -3); /* set new hook */
lua_pop(L, 1); /* remove hook table */
lua_sethook(L1, func, mask, count); /* set hooks */
return 0;
}
@@ -286,11 +287,10 @@ static int db_gethook (lua_State *L) {
if (hook != NULL && hook != hookf) /* external hook? */
lua_pushliteral(L, "external hook");
else {
gethooktable(L1);
lua_pushlightuserdata(L1, L1);
lua_rawget(L1, -2); /* get hook */
lua_remove(L1, -2); /* remove hook table */
lua_xmove(L1, L, 1);
gethooktable(L);
lua_pushlightuserdata(L, L1);
lua_rawget(L, -2); /* get hook */
lua_remove(L, -2); /* remove hook table */
}
lua_pushstring(L, unmakemask(mask, buff));
lua_pushinteger(L, lua_gethookcount(L1));