diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-11-29 23:11:22 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-29 23:11:22 -0800 |
commit | 44148f2daf6e1ac3fe087dd07da2930411b3bcf2 (patch) | |
tree | dd8fa69cd7023f8cb1f4fd517701272fcb6e4f94 /usage.c | |
parent | ed87465658c83a5a1617920e7b605bd830a78aed (diff) | |
parent | 66abce05dd5b9da9c889034781dc3de38b6e231b (diff) | |
download | git-44148f2daf6e1ac3fe087dd07da2930411b3bcf2.tar.gz git-44148f2daf6e1ac3fe087dd07da2930411b3bcf2.tar.xz |
Merge remote branch 'ko/master' into HEAD
* ko/master: (366 commits)
Update draft release notes to 1.6.6 before merging topics for -rc1
Makefile: do not clean arm directory
Add a notice that only certain functions can print color escape codes
builtin-apply.c: pay attention to -p<n> when determining the name
gitworkflows: Consistently back-quote git commands
Explicitly truncate bswap operand to uint32_t
t1200: fix a timing dependent error
Documentation: update descriptions of revision options related to '--bisect'
Enable support for IPv6 on MinGW
Refactor winsock initialization into a separate function
t/gitweb-lib: Split HTTP response with non-GNU sed
pack-objects: split implications of --all-progress from progress activation
instaweb: restart server if already running
prune-packed: only show progress when stderr is a tty
remote-curl.c: fix rpc_out()
Protect scripted Porcelains from GREP_OPTIONS insanity
mergetool--lib: simplify guess_merge_tool()
strbuf_add_wrapped_text(): skip over colour codes
t4014-format-patch: do not assume 'test' is available as non-builtin
Fix over-simplified documentation for 'git log -z'
...
Diffstat (limited to 'usage.c')
-rw-r--r-- | usage.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -7,14 +7,14 @@ static void report(const char *prefix, const char *err, va_list params) { - char msg[1024]; + char msg[4096]; vsnprintf(msg, sizeof(msg), err, params); fprintf(stderr, "%s%s\n", prefix, msg); } -static NORETURN void usage_builtin(const char *err) +static NORETURN void usage_builtin(const char *err, va_list params) { - fprintf(stderr, "usage: %s\n", err); + report("usage: ", err, params); exit(129); } @@ -36,7 +36,7 @@ static void warn_builtin(const char *warn, va_list params) /* If we are in a dlopen()ed .so write to a global variable would segfault * (ugh), so keep things static. */ -static NORETURN_PTR void (*usage_routine)(const char *err) = usage_builtin; +static NORETURN_PTR void (*usage_routine)(const char *err, va_list params) = usage_builtin; static NORETURN_PTR void (*die_routine)(const char *err, va_list params) = die_builtin; static void (*error_routine)(const char *err, va_list params) = error_builtin; static void (*warn_routine)(const char *err, va_list params) = warn_builtin; @@ -46,9 +46,18 @@ void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list param die_routine = routine; } +void usagef(const char *err, ...) +{ + va_list params; + + va_start(params, err); + usage_routine(err, params); + va_end(params); +} + void usage(const char *err) { - usage_routine(err); + usagef("%s", err); } void die(const char *err, ...) |