scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 69f4faf966f646c47631261ebb9f8ff4af8906a0
parent 13b2442ec567821c008cca525ddf9cab3eff3852
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  5 Oct 2015 22:03:05 +0200

Ignore leading / in the name of cc1/cpp

Diffstat:
Mcc1/main.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cc1/main.c b/cc1/main.c @@ -12,7 +12,7 @@ int warnings; jmp_buf recover; -static char *output; +static char *output, *arg0; int onlycpp; static void @@ -27,7 +27,9 @@ clean(void) static void usage(void) { - fputs("usage: cc1 [-E] [-Idir] [-w] [-d] [-o output] [input]\n", stderr); + fprintf(stderr, + "usage: %s [-E] [-Idir] [-w] [-d] [-o output] [input]\n", + arg0); exit(1); } @@ -38,7 +40,8 @@ main(int argc, char *argv[]) atexit(clean); - if (!strcmp(*argv, "cpp")) + arg0 = (cp = strrchr(*argv, '/')) ? cp+1 : *argv; + if (!strcmp(arg0, "cpp")) onlycpp = 1; for (;;) { nextiter: