parse-options: export opterr, optbug

opterror and optbug functions are used by some of parsing routines in parse-options.c to report errors and bugs respectively. Export these functions to allow more custom parsing routines to use them in a uniform way. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dmitry Ivankov committed Aug 11, 2011 at 15:15 UTC 1f275b7c4caebf8ca5c002458f0f1b7994548a97
2 files changed +4 -2
parse-options.c
+2 -2
@@ -12,14 +12,14 @@ static int parse_options_usage(struct parse_opt_ctx_t *ctx,
12 #define OPT_SHORT 1
13 #define OPT_UNSET 2
14
15 -static int optbug(const struct option *opt, const char *reason)
15 +int optbug(const struct option *opt, const char *reason)
16 {
17 if (opt->long_name)
18 return error("BUG: option '%s' %s", opt->long_name, reason);
19 return error("BUG: switch '%c' %s", opt->short_name, reason);
20 }
21
22 -static int opterror(const struct option *opt, const char *reason, int flags)
22 +int opterror(const struct option *opt, const char *reason, int flags)
23 {
24 if (flags & OPT_SHORT)
25 return error("switch `%c' %s", opt->short_name, reason);
parse-options.h
+2
@@ -165,6 +165,8 @@ extern NORETURN void usage_msg_opt(const char *msg,
165 const char * const *usagestr,
166 const struct option *options);
167
168 +extern int optbug(const struct option *opt, const char *reason);
169 +extern int opterror(const struct option *opt, const char *reason, int flags);
170 /*----- incremental advanced APIs -----*/
171
172 enum {