[hackers] [scc] Ignore leading / in the name of cc1/cpp || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 5 Oct 2015 22:03:38 +0200 (CEST)

commit 69f4faf966f646c47631261ebb9f8ff4af8906a0
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Oct 5 22:03:05 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Oct 5 22:03:05 2015 +0200

    Ignore leading / in the name of cc1/cpp

diff --git a/cc1/main.c b/cc1/main.c
index 24c380c..2ead794 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -12,7 +12,7 @@
 int warnings;
 jmp_buf recover;
 
-static char *output;
+static char *output, *arg0;
 int onlycpp;
 
 static void
_AT_@ -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);
 }
 
_AT_@ -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:
Received on Mon Oct 05 2015 - 22:03:38 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 05 2015 - 22:12:14 CEST