summaryrefslogtreecommitdiff
path: root/clients/lua
diff options
context:
space:
mode:
Diffstat (limited to 'clients/lua')
-rw-r--r--clients/lua/Makefile13
-rw-r--r--clients/lua/lua.c14
2 files changed, 16 insertions, 11 deletions
diff --git a/clients/lua/Makefile b/clients/lua/Makefile
index b76dae3c..7bfde7fe 100644
--- a/clients/lua/Makefile
+++ b/clients/lua/Makefile
@@ -1,21 +1,18 @@
# makefile for lua interpreter
-BIN= $(LUA)/bin
-INC= $(LUA)/include
-LIB= $(LUA)/lib
+LUA= ../..
-CC= gcc
-CFLAGS= $(INCS) $(DEFS) $(WARN) -O2
+include $(LUA)/config
-# in SunOs /usr/5include contains prototypes for standard lib
-INCS= -I/usr/5include -I$(INC)
-WARN= -Wall -Wmissing-prototypes -Wshadow -ansi
+EXTRA_DEFS= $(POSIX)
OBJS= lua.o
SRCS= lua.c
T=$(BIN)/lua
+all: $T
+
$T: $(OBJS)
$(CC) -o $@ $(OBJS) -L$(LIB) -llua -llualib -lm
diff --git a/clients/lua/lua.c b/clients/lua/lua.c
index 33c7adcb..bae09e25 100644
--- a/clients/lua/lua.c
+++ b/clients/lua/lua.c
@@ -3,7 +3,7 @@
** Linguagem para Usuarios de Aplicacao
*/
-char *rcs_lua="$Id: lua.c,v 1.7 1995/10/31 17:05:35 roberto Exp $";
+char *rcs_lua="$Id: lua.c,v 1.10 1996/05/03 19:20:17 roberto Exp $";
#include <stdio.h>
#include <string.h>
@@ -14,11 +14,15 @@ char *rcs_lua="$Id: lua.c,v 1.7 1995/10/31 17:05:35 roberto Exp $";
static int lua_argc;
static char **lua_argv;
+#ifdef POSIX
/*
** although this function is POSIX, there is no standard header file that
** defines it
*/
int isatty (int fd);
+#else
+#define isatty(x) (x==0) /* assume stdin is a tty */
+#endif
/*
%F Allow Lua code to access argv strings.
@@ -41,10 +45,10 @@ static void lua_getargv (void)
static void manual_input (void)
{
- if (isatty(fileno(stdin)))
+ if (isatty(0))
{
char buffer[250];
- while (gets(buffer) != 0)
+ while (fgets(buffer, sizeof(buffer), stdin) != 0)
lua_dostring(buffer);
}
else
@@ -83,7 +87,11 @@ int main (int argc, char *argv[])
printf("%s %s\n(written by %s)\n\n",
LUA_VERSION, LUA_COPYRIGHT, LUA_AUTHORS);
else
+ {
result = lua_dofile (argv[i]);
+ if (result)
+ fprintf(stderr, "lua: error trying to run file %s\n", argv[i]);
+ }
}
}
return result;