summaryrefslogtreecommitdiff
path: root/com32/lua/src/lua.c
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-02-07 21:57:20 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-02-07 21:57:20 +0100
commitbfcd7b7305c5465eb33acca86109ca96cb37403a (patch)
tree082568fb50331c3ed6e83714f12084d3bae4d525 /com32/lua/src/lua.c
parent04053040997dfb22e104cb4c1ff3048d87994ad4 (diff)
downloadsyslinux-bfcd7b7305c5465eb33acca86109ca96cb37403a.tar.gz
lua: Updating to 5.1.4
Updating base code to 5.1.4 Adding -DSYSLINUX build flag Moving #if 0 to ifndef SYSLINUX
Diffstat (limited to 'com32/lua/src/lua.c')
-rw-r--r--com32/lua/src/lua.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/com32/lua/src/lua.c b/com32/lua/src/lua.c
index 0d2d16c3..daa73c1f 100644
--- a/com32/lua/src/lua.c
+++ b/com32/lua/src/lua.c
@@ -4,13 +4,19 @@
** See Copyright Notice in lua.h
*/
-
-//#include <signal.h>
+#ifndef SYSLINUX
+#include <signal.h>
+#else
+#define signal(x,y)
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef SYSLINUX
#include <console.h>
+#endif
+
#define lua_c
#include "lua.h"
@@ -25,8 +31,7 @@ static lua_State *globalL = NULL;
static const char *progname = LUA_PROGNAME;
-#if 0
-
+#ifndef SYSLINUX
static void lstop (lua_State *L, lua_Debug *ar) {
(void)ar; /* unused arg. */
lua_sethook(L, NULL, 0, 0);
@@ -99,16 +104,15 @@ static int docall (lua_State *L, int narg, int clear) {
int base = lua_gettop(L) - narg; /* function index */
lua_pushcfunction(L, traceback); /* push traceback function */
lua_insert(L, base); /* put it under chunk and args */
- /* signal(SIGINT, laction);*/
+ signal(SIGINT, laction);
status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
-/* signal(SIGINT, SIG_DFL);*/
+ signal(SIGINT, SIG_DFL);
lua_remove(L, base); /* remove traceback function */
/* force a complete garbage collection in case of errors */
if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0);
return status;
}
-
static void print_version (void) {
l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT);
}
@@ -322,7 +326,11 @@ static int runargs (lua_State *L, char **argv, int n) {
static int handle_luainit (lua_State *L) {
- const char *init = /*getenv(LUA_INIT)*/ NULL;
+#ifndef SYSLINUX
+ const char *init = getenv(LUA_INIT);
+#else
+ const char *init = NULL;
+#endif
if (init == NULL) return 0; /* status OK */
else if (init[0] == '@')
return dofile(L, init+1);
@@ -378,9 +386,9 @@ static int pmain (lua_State *L) {
int main (int argc, char **argv) {
int status;
struct Smain s;
-
+#ifdef SYSLINUX
openconsole(&dev_stdcon_r, &dev_stdcon_w);
-
+#endif
lua_State *L = lua_open(); /* create state */
if (L == NULL) {
l_message(argv[0], "cannot create state: not enough memory");