Skip to content

Commit 1f275b7

Browse files
divanoramagitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1421fd9 commit 1f275b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

parse-options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ static int parse_options_usage(struct parse_opt_ctx_t *ctx,
1212
#define OPT_SHORT 1
1313
#define OPT_UNSET 2
1414

15-
static int optbug(const struct option *opt, const char *reason)
15+
int optbug(const struct option *opt, const char *reason)
1616
{
1717
if (opt->long_name)
1818
return error("BUG: option '%s' %s", opt->long_name, reason);
1919
return error("BUG: switch '%c' %s", opt->short_name, reason);
2020
}
2121

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)
2323
{
2424
if (flags & OPT_SHORT)
2525
return error("switch `%c' %s", opt->short_name, reason);

parse-options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ extern NORETURN void usage_msg_opt(const char *msg,
165165
const char * const *usagestr,
166166
const struct option *options);
167167

168+
extern int optbug(const struct option *opt, const char *reason);
169+
extern int opterror(const struct option *opt, const char *reason, int flags);
168170
/*----- incremental advanced APIs -----*/
169171

170172
enum {

0 commit comments

Comments
 (0)