Mercurial > hg > aboriginal
comparison sources/toys/ccwrap.c @ 1665:98311ea2e4c2
Fix --print-file-name=blah.a
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 02 Jul 2014 20:42:45 -0500 |
parents | 35b8949e9d9c |
children | f63305aa4961 |
comparison
equal
deleted
inserted
replaced
1664:35b8949e9d9c | 1665:98311ea2e4c2 |
---|---|
1 /* Copyright 2013 Rob Landley <rob@landley.net> | 1 /* by Rob Landley <rob@landley.net> |
2 * | 2 * |
3 * C compiler wrapper. Parses command line, supplies path information for | 3 * C compiler wrapper. Parses command line, supplies path information for |
4 * headers and libraries. | 4 * headers and libraries. |
5 * | |
6 * This file is hereby released into the public domain. | |
5 */ | 7 */ |
6 | 8 |
7 #undef _FORTIFY_SOURCE | 9 #undef _FORTIFY_SOURCE |
8 | 10 |
9 #include <errno.h> | 11 #include <errno.h> |
327 printf("install: %s/\nprograms: %s\nlibraries:", | 329 printf("install: %s/\nprograms: %s\nlibraries:", |
328 topdir, getenv("PATH")); | 330 topdir, getenv("PATH")); |
329 } else if (!strcmp(c, "libgcc-file-name")) { | 331 } else if (!strcmp(c, "libgcc-file-name")) { |
330 printf("%s/cc/lib/libgcc.a\n", topdir); | 332 printf("%s/cc/lib/libgcc.a\n", topdir); |
331 exit(0); | 333 exit(0); |
332 } | 334 } else break; |
333 else break; | |
334 | 335 |
335 // Adjust dlist before traversing (move fallback to end, break circle) | 336 // Adjust dlist before traversing (move fallback to end, break circle) |
336 libs = libs->next->next; | 337 libs = libs->next->next; |
337 libs->prev->next = 0; | 338 libs->prev->next = 0; |
338 | 339 |
339 // Either display the list, or find first hit. | 340 // Either display the list, or find first hit. |
340 for (dl = libs; dl; dl = dl->next) { | 341 for (dl = libs; dl; dl = dl->next) { |
342 temp = dl->str; | |
341 if (show) printf(":%s" + (dl==libs), dl->str); | 343 if (show) printf(":%s" + (dl==libs), dl->str); |
342 else if (!access(dl->str, F_OK)) break; | 344 else { |
345 if (*c) temp = xmprintf("%s/%s", dl->str, c); | |
346 if (!access(temp, F_OK)) break; | |
347 if (*c) free(temp); | |
348 } | |
343 } | 349 } |
344 if (dl) printf("%s", dl->str); | 350 if (dl) printf("%s", temp); |
345 printf("\n"); | 351 printf("\n"); |
346 | 352 |
347 return 0; | 353 return 0; |
348 } else if (!strcmp(c, "pg")) SET_FLAG(Cprofile); | 354 } else if (!strcmp(c, "pg")) SET_FLAG(Cprofile); |
349 } else if (*c == 's') { | 355 } else if (*c == 's') { |