History

tcc: -m32 prefix "win32-" when file extension is present

Henry Kroll III committed 15 years ago

Commit 8f985731 parent c6f5d811 file · +14 −4Browse files

Unified · Split

tcc.c+14−4
@@ -228,10 +228,18 @@ static int expand_args(char ***pargv, const char *str) · 227 unmodified lines
228228 #define CHILD "x86_64"
229229 #endif
230230
231−static const char *ssuffix(const char *name, const char sep)
231+static char *ssuffix(const char *oldname, const char sep)
232232 {
233− char *p = strchr(name, sep);
234− return p?p+1:name;
233+ char *p, *name = tcc_strdup(oldname);
234+ p = strchr(name, sep);
235+ if (p)
236+ return p + 1;
237+ /* prefix "win32-" when file extension is present */
238+ if (*tcc_fileextension(name)){
239+ name = tcc_realloc(name, strlen(oldname + 7));
240+ sprintf(name, "win32-%s", oldname);
241+ }
242+ return name;
235243 }
236244
237245 static void exec_other_tcc(TCCState *s, int argc,
@@ -249,7 +257,9 @@ static void exec_other_tcc(TCCState *s, int argc, · 11 unmodified lines
249257 case ARG:
250258 {
251259 parent = tcc_basename(argv[0]);
252− sprintf(child_name, CHILD "-%s", ssuffix(parent,'-'));
260+ child_tcc = ssuffix(parent,'-');
261+ sprintf(child_name, CHILD "-%s", child_tcc);
262+ tcc_free(child_tcc);
253263 if (strcmp(parent, child_name)) {
254264 /* child_path = dirname */
255265 pstrcpy(child_path, parent - argv[0] + 1, argv[0]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t