diff options
| author | Henry Kroll III <henry@comptune.com> | 2010-12-12 23:55:49 -0800 |
|---|---|---|
| committer | Henry Kroll III <henry@comptune.com> | 2010-12-13 00:00:18 -0800 |
| commit | 8f985736580926ac53dc367fc293524bf2810cbb (patch) | |
| tree | 7d038822c6f6eb6c35baa1ebbf8afeba3ae23d47 /tcc.c | |
| parent | c6f5d819af91284959d02bc109dbdb0d9cbb0c15 (diff) | |
| download | tinycc-8f985736580926ac53dc367fc293524bf2810cbb.tar.gz tinycc-8f985736580926ac53dc367fc293524bf2810cbb.tar.bz2 | |
tcc: -m32 prefix "win32-" when file extension is present
Diffstat (limited to 'tcc.c')
| -rw-r--r-- | tcc.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -228,10 +228,18 @@ static int expand_args(char ***pargv, const char *str) #define CHILD "x86_64" #endif -static const char *ssuffix(const char *name, const char sep) +static char *ssuffix(const char *oldname, const char sep) { - char *p = strchr(name, sep); - return p?p+1:name; + char *p, *name = tcc_strdup(oldname); + p = strchr(name, sep); + if (p) + return p + 1; + /* prefix "win32-" when file extension is present */ + if (*tcc_fileextension(name)){ + name = tcc_realloc(name, strlen(oldname + 7)); + sprintf(name, "win32-%s", oldname); + } + return name; } static void exec_other_tcc(TCCState *s, int argc, @@ -249,7 +257,9 @@ static void exec_other_tcc(TCCState *s, int argc, case ARG: { parent = tcc_basename(argv[0]); - sprintf(child_name, CHILD "-%s", ssuffix(parent,'-')); + child_tcc = ssuffix(parent,'-'); + sprintf(child_name, CHILD "-%s", child_tcc); + tcc_free(child_tcc); if (strcmp(parent, child_name)) { /* child_path = dirname */ pstrcpy(child_path, parent - argv[0] + 1, argv[0]); |
