Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix option aliasing in argp.
  • Loading branch information
Sergey Poznyakoff authored and Ulrich Drepper committed Apr 4, 2010
1 parent 26f4163 commit 8c6de69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2010-02-05 Sergey Poznyakoff <gray@gnu.org.ua>

[BZ #11254]
* argp/argp-parse.c (convert_options): Fix improper use of `|'
between character values.

2010-04-04 Ulrich Drepper <drepper@redhat.com>

[BZ #11276]
Expand Down
12 changes: 6 additions & 6 deletions argp/argp-parse.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing, layered over getopt
Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 1995-2000, 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
Expand Down Expand Up @@ -99,7 +99,7 @@ static volatile int _argp_hang;

static const struct argp_option argp_default_options[] =
{
{"help", '?', 0, 0, N_("Give this help list"), -1},
{"help", '?', 0, 0, N_("Give this help list"), -1},
{"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")},
{"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
{"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
Expand Down Expand Up @@ -164,7 +164,7 @@ static const struct argp argp_default_argp =

static const struct argp_option argp_version_options[] =
{
{"version", 'V', 0, 0, N_("Print program version"), -1},
{"version", 'V', 0, 0, N_("Print program version"), -1},
{0, 0}
};

Expand Down Expand Up @@ -364,7 +364,7 @@ convert_options (const struct argp *argp,
values (the sign of the lower bits is preserved
however)... */
cvt->long_end->val =
((opt->key | real->key) & USER_MASK)
((opt->key ? opt->key : real->key) & USER_MASK)
+ (((group - cvt->parser->groups) + 1) << USER_BITS);

/* Keep the LONG_OPTS list terminated. */
Expand All @@ -385,7 +385,7 @@ convert_options (const struct argp *argp,

if (children)
/* Assign GROUP's CHILD_INPUTS field some space from
CVT->child_inputs_end.*/
CVT->child_inputs_end.*/
{
unsigned num_children = 0;
while (children[num_children].argp)
Expand Down Expand Up @@ -823,7 +823,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
parser->try_getopt = 0;
if (parser->state.next > 1
&& strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
== 0)
== 0)
/* Not only is this the end of the options, but it's a
`quoted' region, which may have args that *look* like
options, so we definitely shouldn't try to use getopt past
Expand Down

0 comments on commit 8c6de69

Please sign in to comment.