shithub: scc

Download patch

ref: 69f4faf966f646c47631261ebb9f8ff4af8906a0
parent: 13b2442ec567821c008cca525ddf9cab3eff3852
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Oct 5 18:03:05 EDT 2015

Ignore leading / in the name of cc1/cpp

--- 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 @@
 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 @@
 
 	atexit(clean);
 
-	if (!strcmp(*argv, "cpp"))
+	arg0 = (cp = strrchr(*argv, '/')) ? cp+1 : *argv;
+	if (!strcmp(arg0, "cpp"))
 		onlycpp = 1;
 	for (;;) {
 	nextiter: