mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
tcc: -m32 prefix "win32-" when file extension is present
This commit is contained in:
parent
c6f5d819af
commit
8f98573658
18
tcc.c
18
tcc.c
@ -228,10 +228,18 @@ static int expand_args(char ***pargv, const char *str)
|
|||||||
#define CHILD "x86_64"
|
#define CHILD "x86_64"
|
||||||
#endif
|
#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);
|
char *p, *name = tcc_strdup(oldname);
|
||||||
return p?p+1:name;
|
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,
|
static void exec_other_tcc(TCCState *s, int argc,
|
||||||
@ -249,7 +257,9 @@ static void exec_other_tcc(TCCState *s, int argc,
|
|||||||
case ARG:
|
case ARG:
|
||||||
{
|
{
|
||||||
parent = tcc_basename(argv[0]);
|
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)) {
|
if (strcmp(parent, child_name)) {
|
||||||
/* child_path = dirname */
|
/* child_path = dirname */
|
||||||
pstrcpy(child_path, parent - argv[0] + 1, argv[0]);
|
pstrcpy(child_path, parent - argv[0] + 1, argv[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user