ref: 791422c1058d4973a6cb98ba17a4d1e2b276a41a
parent: 8831876b2132bb274351cd48749e85c4241a4a30
author: kvik <[email protected]>
date: Sat Apr 24 20:12:29 EDT 2021
luac: make it compile and run
--- a/mkfile
+++ b/mkfile
@@ -3,6 +3,7 @@
CFLAGS=-FTV -p -Ishim -DLUA_USE_PLAN9 -DLUA_UCID
LIB=liblua.a.$O
+LUAC=$O.luac
SHIMOBJS=\
shim.$O\
@@ -46,13 +47,16 @@
ALLOBJS=$SHIMOBJS $COREOBJS $LIBOBJS
-all:V: $LIB
+all:V: $LIB $LUAC
clean:V:
- rm -f *.[$OS] *.a.[$OS]
+ rm -f *.[$OS] *.a.[$OS] [$OS].*
$LIB: $ALLOBJS
ar cr $target $prereq
+
+$O.%: %.$O $LIB
+ $LD -o $target $prereq
%.$O: %.c
$CC $CFLAGS $stem.c
--- a/shim.c
+++ b/shim.c
@@ -19,3 +19,18 @@
rerrstr(err, sizeof err);
return err;
}
+
+void
+exit(int code)
+{
+ char *status;
+
+ switch(code){
+ case EXIT_SUCCESS:
+ status = nil; break;
+ case EXIT_FAILURE:
+ default:
+ status = "failure"; break;
+ }
+ exits(status);
+}
--- a/shim/shim.h
+++ b/shim/shim.h
@@ -100,6 +100,9 @@
#include "/sys/include/stdio.h"
/** stdlib.h **/
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+void exit(int);
/** string.h **/
char *strerror(int);