mirror of
https://github.com/reactos/ccache.git
synced 2024-12-03 09:00:43 +00:00
Implement compare_executable_name() helper function
This commit is contained in:
parent
82b7876473
commit
6014657219
4
ccache.c
4
ccache.c
@ -1263,7 +1263,7 @@ static void find_compiler(int argc, char **argv)
|
||||
base = basename(argv[0]);
|
||||
|
||||
/* we might be being invoked like "ccache gcc -c foo.c" */
|
||||
if (strcmp(base, MYNAME) == 0) {
|
||||
if (compare_executable_name(base, MYNAME)) {
|
||||
args_remove_first(orig_args);
|
||||
free(base);
|
||||
if (strchr(argv[1],'/')) {
|
||||
@ -2127,7 +2127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* check if we are being invoked as "ccache" */
|
||||
program_name = basename(argv[0]);
|
||||
if (strcmp(program_name, MYNAME) == 0) {
|
||||
if (compare_executable_name(program_name, MYNAME)) {
|
||||
if (argc < 2) {
|
||||
fputs(USAGE_TEXT, stderr);
|
||||
exit(1);
|
||||
|
1
ccache.h
1
ccache.h
@ -105,6 +105,7 @@ char *gnu_getcwd(void);
|
||||
int create_empty_file(const char *fname);
|
||||
const char *get_home_directory(void);
|
||||
char *get_cwd();
|
||||
int compare_executable_name(const char *s1, const char *s2);
|
||||
size_t common_dir_prefix_length(const char *s1, const char *s2);
|
||||
char *get_relative_path(const char *from, const char *to);
|
||||
int is_absolute_path(const char *path);
|
||||
|
9
util.c
9
util.c
@ -878,6 +878,15 @@ char *get_cwd(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether s1 and s2 have the same executable name.
|
||||
*/
|
||||
int
|
||||
compare_executable_name(const char *s1, const char *s2)
|
||||
{
|
||||
return !strcmp(s1, s2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the length of the longest directory path that is common to two
|
||||
* strings.
|
||||
|
Loading…
Reference in New Issue
Block a user