diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-08 16:18:24 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-08 16:18:24 +0200 |
| commit | de6c4a0903325d14fed89de6cef2572dc141c2fe (patch) | |
| tree | 555cdf7408df9d26a18f71635a7fdf2cd22e686f /lib | |
| parent | 81df7a41538faa1f4fbfb54ea33e1448d70cfc76 (diff) | |
| download | abrt-de6c4a0903325d14fed89de6cef2572dc141c2fe.tar.gz abrt-de6c4a0903325d14fed89de6cef2572dc141c2fe.tar.xz abrt-de6c4a0903325d14fed89de6cef2572dc141c2fe.zip | |
Remove arrays in usage text, use a single string instead
Currently, usage is an array of pointers to string.
It is meant to support this:
usage: foo --bar
or: foo --baz
or: foo -z
The patch removes this and makes usage just a string:
usage: foo --bar
Why remove this?
(1) We can achieve old format by using the usage string with many lines:
usage = "foo --bar\n"
" or: foo --baz\n"
" or: foo -z";
(2) We don't use multi-line usage anyway.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils/parse_options.c | 10 | ||||
| -rw-r--r-- | lib/utils/parse_options.h | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/utils/parse_options.c b/lib/utils/parse_options.c index 08fac9ec..af457f3e 100644 --- a/lib/utils/parse_options.c +++ b/lib/utils/parse_options.c @@ -6,12 +6,9 @@ #define USAGE_OPTS_WIDTH 24 #define USAGE_GAP 2 -void parse_usage_and_die(const char * const * usage, const struct options *opt) +void parse_usage_and_die(const char *usage, const struct options *opt) { - fprintf(stderr, _("usage: %s\n"), *usage++); - - while (*usage && **usage) - fprintf(stderr, _(" or: %s\n"), *usage++); + fprintf(stderr, _("Usage: %s\n"), usage); if (opt->type != OPTION_GROUP) fputc('\n', stderr); @@ -65,7 +62,7 @@ static int parse_opt_size(const struct options *opt) } void parse_opts(int argc, char **argv, const struct options *opt, - const char * const usage[]) + const char *usage) { int help = 0; int size = parse_opt_size(opt); @@ -129,7 +126,6 @@ void parse_opts(int argc, char **argv, const struct options *opt, { if (opt[ii].short_name == c) { - switch (opt[ii].type) { case OPTION_BOOL: diff --git a/lib/utils/parse_options.h b/lib/utils/parse_options.h index 9c4758af..0e768eb7 100644 --- a/lib/utils/parse_options.h +++ b/lib/utils/parse_options.h @@ -40,9 +40,9 @@ struct options { #define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), "be verbose") void parse_opts(int argc, char **argv, const struct options *opt, - const char * const usage[]); + const char *usage); -void parse_usage_and_die(const char * const * usage, const struct options *opt); +void parse_usage_and_die(const char *usage, const struct options *opt); #ifdef __cplusplus } |
