mirror of
https://github.com/reactos/ccache.git
synced 2024-11-23 19:59:46 +00:00
added args_strip() function for stripping --cacche-* options in
failed()
This commit is contained in:
parent
f9bb806617
commit
70b4385dbe
21
args.c
21
args.c
@ -47,3 +47,24 @@ void args_pop(ARGS *args, int n)
|
||||
args->argv[args->argc] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* strip any arguments beginning with the specified prefix */
|
||||
void args_strip(ARGS *args, const char *prefix)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<args->argc; ) {
|
||||
if (strncmp(args->argv[i], prefix, strlen(prefix)) == 0) {
|
||||
if (i < args->argc-1) {
|
||||
/* note that we can't free the entry we are removing
|
||||
as it may be part of the original argc/argv passed
|
||||
to main() */
|
||||
memmove(&args->argv[i],
|
||||
&args->argv[i+1],
|
||||
(args->argc-1) * sizeof(args->argv[i]));
|
||||
}
|
||||
args->argc--;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
ccache.c
3
ccache.c
@ -97,6 +97,9 @@ static void failed(void)
|
||||
cpp_stderr = NULL;
|
||||
}
|
||||
|
||||
/* strip any local args */
|
||||
args_strip(orig_args, "--ccache-");
|
||||
|
||||
execv(orig_args->argv[0], orig_args->argv);
|
||||
cc_log("execv returned (%s)!\n", strerror(errno));
|
||||
perror(orig_args->argv[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user