run-command: conditionally define locate_in_PATH()
This commit doesn't change any behaviour by itself, but allows us to easily define compat replacements for locate_in_PATH(). It prepares us for the next commit that adds a native Windows implementation of locate_in_PATH(). Signed-off-by: Matthias Aßhauer <mha1993@live.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fb7d80edca
commit
bb532b5345
@ -170,6 +170,7 @@ int is_executable(const char *name)
|
|||||||
return st.st_mode & S_IXUSR;
|
return st.st_mode & S_IXUSR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef locate_in_PATH
|
||||||
/*
|
/*
|
||||||
* Search $PATH for a command. This emulates the path search that
|
* Search $PATH for a command. This emulates the path search that
|
||||||
* execvp would perform, without actually executing the command so it
|
* execvp would perform, without actually executing the command so it
|
||||||
@ -218,6 +219,7 @@ static char *locate_in_PATH(const char *file)
|
|||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int exists_in_PATH(const char *command)
|
int exists_in_PATH(const char *command)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user