Mercurial > hg > aboriginal
changeset 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 | ba28c96cba42 |
files | sources/toys/ccwrap.c |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/sources/toys/ccwrap.c Wed Jul 02 20:05:36 2014 -0500 +++ b/sources/toys/ccwrap.c Wed Jul 02 20:42:45 2014 -0500 @@ -1,7 +1,9 @@ -/* Copyright 2013 Rob Landley <rob@landley.net> +/* by Rob Landley <rob@landley.net> * * C compiler wrapper. Parses command line, supplies path information for * headers and libraries. + * + * This file is hereby released into the public domain. */ #undef _FORTIFY_SOURCE @@ -329,8 +331,7 @@ } else if (!strcmp(c, "libgcc-file-name")) { printf("%s/cc/lib/libgcc.a\n", topdir); exit(0); - } - else break; + } else break; // Adjust dlist before traversing (move fallback to end, break circle) libs = libs->next->next; @@ -338,10 +339,15 @@ // Either display the list, or find first hit. for (dl = libs; dl; dl = dl->next) { + temp = dl->str; if (show) printf(":%s" + (dl==libs), dl->str); - else if (!access(dl->str, F_OK)) break; + else { + if (*c) temp = xmprintf("%s/%s", dl->str, c); + if (!access(temp, F_OK)) break; + if (*c) free(temp); + } } - if (dl) printf("%s", dl->str); + if (dl) printf("%s", temp); printf("\n"); return 0;