mirror of
https://github.com/reactos/ccache.git
synced 2024-12-03 09:00:43 +00:00
Extract print_command function from print_executed_command
This commit is contained in:
parent
4ea12e1d1d
commit
39f48df93b
2
ccache.c
2
ccache.c
@ -249,7 +249,7 @@ static void failed(void)
|
||||
|
||||
cc_log("Failed; falling back to running the real compiler");
|
||||
if (getenv("CCACHE_VERBOSE")) {
|
||||
print_executed_command(orig_args->argv);
|
||||
print_executed_command(stdout, orig_args->argv);
|
||||
}
|
||||
execv(orig_args->argv[0], orig_args->argv);
|
||||
cc_log("execv returned (%s)!", strerror(errno));
|
||||
|
4
ccache.h
4
ccache.h
@ -11,6 +11,7 @@
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ATTR_FORMAT(x, y, z) __attribute__((format (x, y, z)))
|
||||
@ -134,7 +135,8 @@ int execute(char **argv,
|
||||
const char *path_stdout,
|
||||
const char *path_stderr);
|
||||
char *find_executable(const char *name, const char *exclude_name);
|
||||
void print_executed_command(char **argv);
|
||||
void print_command(FILE *fp, char **argv);
|
||||
void print_executed_command(FILE *fp, char **argv);
|
||||
|
||||
typedef struct {
|
||||
char **argv;
|
||||
|
15
execute.c
15
execute.c
@ -46,7 +46,7 @@ int execute(char **argv,
|
||||
int fd;
|
||||
|
||||
if (getenv("CCACHE_VERBOSE")) {
|
||||
print_executed_command(argv);
|
||||
print_executed_command(stdout, argv);
|
||||
}
|
||||
|
||||
unlink(path_stdout);
|
||||
@ -141,12 +141,17 @@ char *find_executable(const char *name, const char *exclude_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void print_executed_command(char **argv)
|
||||
void print_command(FILE *fp, char **argv)
|
||||
{
|
||||
int i;
|
||||
printf("%s: executing ", MYNAME);
|
||||
for (i = 0; argv[i]; i++) {
|
||||
printf("%s%s", (i == 0) ? "" : " ", argv[i]);
|
||||
fprintf(fp, "%s%s", (i == 0) ? "" : " ", argv[i]);
|
||||
}
|
||||
printf("\n");
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
void print_executed_command(FILE *fp, char **argv)
|
||||
{
|
||||
fprintf(fp, "%s: executing ", MYNAME);
|
||||
print_command(fp, argv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user