git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	David Barr <davidbarr@google.com>,
	Stephen Boyd <bebarino@gmail.com>,
	Pierre Habouzit <madcoder@debian.org>,
	Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH/RFC v2 1/2] parse-options: export opterr, optbug
Date: Sun,  3 Jul 2011 17:04:04 +0600	[thread overview]
Message-ID: <1309691045-30180-1-git-send-email-divanorama@gmail.com> (raw)
In-Reply-To: <20110629202959.GJ22556@elie>

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>
---
 parse-options.c |    4 ++--
 parse-options.h |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index 73bd28a..37a1d3b 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -11,14 +11,14 @@ static int parse_options_usage(struct parse_opt_ctx_t *ctx,
 #define OPT_SHORT 1
 #define OPT_UNSET 2
 
-static int optbug(const struct option *opt, const char *reason)
+int optbug(const struct option *opt, const char *reason)
 {
 	if (opt->long_name)
 		return error("BUG: option '%s' %s", opt->long_name, reason);
 	return error("BUG: switch '%c' %s", opt->short_name, reason);
 }
 
-static int opterror(const struct option *opt, const char *reason, int flags)
+int opterror(const struct option *opt, const char *reason, int flags)
 {
 	if (flags & OPT_SHORT)
 		return error("switch `%c' %s", opt->short_name, reason);
diff --git a/parse-options.h b/parse-options.h
index d1b12fe..b392590 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -162,6 +162,8 @@ extern NORETURN void usage_msg_opt(const char *msg,
 				   const char * const *usagestr,
 				   const struct option *options);
 
+extern int optbug(const struct option *opt, const char *reason);
+extern int opterror(const struct option *opt, const char *reason, int flags);
 /*----- incremental advanced APIs -----*/
 
 enum {
-- 
1.7.3.4

  reply	other threads:[~2011-07-03 11:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-25 11:12 [PATCH/RFC] Reduce parse-options.o dependencies Dmitry Ivankov
2011-06-29 20:29 ` Jonathan Nieder
2011-07-03 11:04   ` Dmitry Ivankov [this message]
2011-07-03 11:04   ` [PATCH/RFC v2 2/2] " Dmitry Ivankov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309691045-30180-1-git-send-email-divanorama@gmail.com \
    --to=divanorama@gmail.com \
    --cc=bebarino@gmail.com \
    --cc=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=madcoder@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).