path: root/git-compat-util.h
diff options
authorJonathan Nieder <>2009-11-09 15:05:02 (GMT)
committerJunio C Hamano <>2009-11-10 20:00:21 (GMT)
commit64b1cb74f8312c0a43ce32f51097172efc69355a (patch)
tree06b27179e155cdfbae74fa50fb59e8e9abf52ba1 /git-compat-util.h
parent99caeed05d3e89176d352104a2b70a77aa7e5d81 (diff)
Introduce usagef() that takes a printf-style format
Some new callers would want to use printf-like formatting, when issuing their usage messages. An option is to change usage() itself also be like printf(), which would make it similar to die() and warn(). But usage() is typically fixed, as opposed to die() and warn() that gives diagnostics depending on the situation. Indeed, the majority of strings given by existing callsites to usage() are fixed strings. If we were to make usage() take printf-style format, they all need to be changed to have "%s" as their first argument. So instead, introduce usagef() so that limited number of callers can use it. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'git-compat-util.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index ef60803..5c59687 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -189,6 +189,7 @@ extern char *gitbasename(char *);
/* General helper functions */
extern NORETURN void usage(const char *err);
+extern NORETURN void usagef(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern NORETURN void die(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern NORETURN void die_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));