infra: Ignore boring files.
[runlisp] / runlisp-helper.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <unistd.h>
5
6 #if defined(CMUCL)
7 # define ARGS 3
8 #elif defined(CLISP)
9 # define ARGS 7
10 #else
11 # error "Which Lisp?"
12 #endif
13
14 int main(int argc, char *argv[])
15 {
16 char **args = malloc((ARGS + argc) * sizeof(*args));
17 char *core, *lisp;
18 if ((lisp = getenv("RUNLISP_LISP")) == 0) lisp = LISP;
19 if ((core = getenv("RUNLISP_CORE")) == 0) core = CORE;
20 if (!args) { perror("alloc"); exit(127); }
21 args[0] = lisp;
22 #if defined(CMUCL)
23 args[1] = "-core";
24 args[2] = core;
25 #elif defined(CLISP)
26 args[1] = "-M";
27 args[2] = core;
28 args[3] = "-x";
29 args[4] = "(ext:quit (if (runlisp:run) 0 127))";
30 args[5] = "-q";
31 args[6] = "--";
32 #endif
33 memcpy(args + ARGS, argv + 1, argc * sizeof(*args));
34 execv(args[0], args);
35 perror(argv[1]);
36 exit(127);
37 }