X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git.c;h=c26cac6555e940e1ae5573a99350388f09118b87;hb=806f36d4d7caf75b6d3e098cb0353d85d3477c7d;hp=0975fc7ac2673c952bfdf1372d2e22c001ecf7d5;hpb=9a79c5a8b4e280601bcbeeed22e1e4968d06c10e;p=git.git diff --git a/git.c b/git.c index 0975fc7ac..c26cac655 100644 --- a/git.c +++ b/git.c @@ -8,15 +8,12 @@ #include #include #include +#include "git-compat-util.h" #ifndef PATH_MAX # define PATH_MAX 4096 #endif -#ifdef NO_SETENV -extern int gitsetenv(const char *, const char *, int); -#endif - static const char git_usage[] = "Usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ ARGS ]"; @@ -156,10 +153,10 @@ static void list_commands(const char *exec_path, const char *pattern) } #ifdef __GNUC__ -static void usage(const char *exec_path, const char *fmt, ...) +static void cmd_usage(const char *exec_path, const char *fmt, ...) __attribute__((__format__(__printf__, 2, 3), __noreturn__)); #endif -static void usage(const char *exec_path, const char *fmt, ...) +static void cmd_usage(const char *exec_path, const char *fmt, ...) { if (fmt) { va_list ap; @@ -254,12 +251,12 @@ int main(int argc, char **argv, char **envp) else if (!strcmp(arg, "help")) show_help = 1; else if (!show_help) - usage(NULL, NULL); + cmd_usage(NULL, NULL); } if (i >= argc || show_help) { if (i >= argc) - usage(exec_path, NULL); + cmd_usage(exec_path, NULL); show_man_page(argv[i]); } @@ -289,7 +286,7 @@ int main(int argc, char **argv, char **envp) len += snprintf(git_command + len, sizeof(git_command) - len, "/git-%s", argv[i]); if (sizeof(git_command) <= len) { - fprintf(stderr, "git: command name given is too long (%d)\n", len); + fprintf(stderr, "git: command name given is too long.\n"); exit(1); } @@ -297,7 +294,7 @@ int main(int argc, char **argv, char **envp) execve(git_command, &argv[i], envp); if (errno == ENOENT) - usage(exec_path, "'%s' is not a git-command", argv[i]); + cmd_usage(exec_path, "'%s' is not a git-command", argv[i]); fprintf(stderr, "Failed to run command '%s': %s\n", git_command, strerror(errno));