Mercurial > hg > aboriginal
comparison sources/toys/ccwrap.c @ 1452:707beb993e13 1.1.0
Trivial cleanup.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 29 Sep 2011 19:27:00 -0500 |
parents | 5b79ffca554a |
children | 83de80c10db8 |
comparison
equal
deleted
inserted
replaced
1451:2ad7480aa7ca | 1452:707beb993e13 |
---|---|
30 static char nostdlib[] = "-nostdlib"; | 30 static char nostdlib[] = "-nostdlib"; |
31 | 31 |
32 // For C++ | 32 // For C++ |
33 static char nostdinc_plus[] = "-nostdinc++"; | 33 static char nostdinc_plus[] = "-nostdinc++"; |
34 | 34 |
35 // gcc 4.3 generates tons of spurious warnings which you can't shut off. | |
36 | |
37 #define xasprintf(...) do {(void)asprintf(__VA_ARGS__);} while(0) | |
38 | |
39 // Confirm that a regular file exists, and (optionally) has the executable bit. | 35 // Confirm that a regular file exists, and (optionally) has the executable bit. |
40 int is_file(char *filename, int has_exe) | 36 int is_file(char *filename, int has_exe) |
41 { | 37 { |
42 // Confirm it has the executable bit set, if necessary. | 38 // Confirm it has the executable bit set, if necessary. |
43 if (!has_exe || !access(filename, X_OK)) { | 39 if (!has_exe || !access(filename, X_OK)) { |
148 | 144 |
149 if (!path) path = ""; | 145 if (!path) path = ""; |
150 | 146 |
151 // Add that directory to the start of $PATH. (Better safe than sorry.) | 147 // Add that directory to the start of $PATH. (Better safe than sorry.) |
152 *rindex(topdir,'/') = 0; | 148 *rindex(topdir,'/') = 0; |
153 temp = malloc(5+strlen(topdir)+1+strlen(topdir)+14+strlen(path)+1); | 149 asprintf(&temp,"PATH=%s:%s/../tools/bin:%s",topdir,topdir,path); |
154 sprintf(temp,"PATH=%s:%s/../tools/bin:%s",topdir,topdir,path); | |
155 putenv(temp); | 150 putenv(temp); |
156 | 151 |
157 // The directory above the wrapper script should have include, cc, | 152 // The directory above the wrapper script should have include, cc, |
158 // and lib directories. However, the script could have a symlink | 153 // and lib directories. However, the script could have a symlink |
159 // pointing to its directory (ala /bin -> /usr/bin), so append ".." | 154 // pointing to its directory (ala /bin -> /usr/bin), so append ".." |