[hackers] [scc][PATCH] [cc1] search base when argv0 is set

From: Petr Vaněk <arkamar_AT_atlas.cz>
Date: Sat, 18 Jun 2016 17:00:33 +0000

argv0 is unset before ARGBEGIN.
---
 cc1/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cc1/main.c b/cc1/main.c
index d7fa487..dd221e4 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -47,12 +47,6 @@ main(int argc, char *argv[])
 	atexit(clean);
 	icpp();
 
-	/* if run as cpp, only run the preprocessor */
-	if ((base = strrchr(argv0, '/')))
-		++base;
-	else
-		base = argv0;
-
 	ARGBEGIN {
 	case 'D':
 		defmacro(EARGF(usage()));
_AT_@ -79,6 +73,12 @@ main(int argc, char *argv[])
 		usage();
 	} ARGEND
 
+	/* if run as cpp, only run the preprocessor */
+	if ((base = strrchr(argv0, '/')))
+		++base;
+	else
+		base = argv0;
+
 	if (argc > 1)
 		usage();
 
-- 
2.7.3
Received on Sat Jun 18 2016 - 19:00:33 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 18 2016 - 17:00:15 CEST