From: Sergey Poznyakoff Date: Sun, 4 Apr 2010 17:04:55 +0000 (-0700) Subject: Fix option aliasing in argp. X-Git-Tag: fedora/glibc-2.11.90-17~2^2~11 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=8c6de69d00c6be60657ca0d763dda803172c6aab;p=glibc.git Fix option aliasing in argp. --- diff --git a/ChangeLog b/ChangeLog index 5cccc47274..e8b494b1ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-05 Sergey Poznyakoff + + [BZ #11254] + * argp/argp-parse.c (convert_options): Fix improper use of `|' + between character values. + 2010-04-04 Ulrich Drepper [BZ #11276] diff --git a/argp/argp-parse.c b/argp/argp-parse.c index 4718ced81d..604fcf0f3a 100644 --- a/argp/argp-parse.c +++ b/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 . @@ -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, @@ -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} }; @@ -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. */ @@ -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) @@ -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