* argp/argp-help.c: Likewise.
	* argp/argp-parse.c: Likewise.
This commit is contained in:
Ulrich Drepper 1998-09-07 13:47:26 +00:00
parent cf9f9a1686
commit 94b78bb204
6 changed files with 183 additions and 158 deletions

View File

@ -19,6 +19,8 @@
* stdlib/strtol.c: Likewise.
* string/strcoll.c: Likewise.
* string/strxfrm.c: Likewise.
* argp/argp-help.c: Likewise.
* argp/argp-parse.c: Likewise.
1998-09-07 09:58 Ulrich Drepper <drepper@cygnus.com>

View File

@ -800,6 +800,7 @@ hol_append (struct hol *hol, struct hol *more)
/* Merge entries. */
if (more->num_entries > 0)
{
if (hol->num_entries == 0)
{
hol->num_entries = more->num_entries;
@ -857,6 +858,7 @@ hol_append (struct hol *hol, struct hol *more)
}
}
}
}
*so = '\0';
@ -900,10 +902,14 @@ arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
const char *domain, argp_fmtstream_t stream)
{
if (real->arg)
{
if (real->flags & OPTION_ARG_OPTIONAL)
__argp_fmtstream_printf (stream, opt_fmt, dgettext (domain, real->arg));
__argp_fmtstream_printf (stream, opt_fmt,
dgettext (domain, real->arg));
else
__argp_fmtstream_printf (stream, req_fmt, dgettext (domain, real->arg));
__argp_fmtstream_printf (stream, req_fmt,
dgettext (domain, real->arg));
}
}
/* Helper functions for hol_entry_help. */
@ -1245,6 +1251,7 @@ usage_long_opt (const struct argp_option *opt,
arg = real->arg;
if (! (flags & OPTION_NO_USAGE))
{
if (arg)
{
arg = dgettext (domain, arg);
@ -1255,6 +1262,7 @@ usage_long_opt (const struct argp_option *opt,
}
else
__argp_fmtstream_printf (stream, " [--%s]", opt->name);
}
return 0;
}
@ -1385,6 +1393,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
if (advance && multiple)
{
/* Need to increment our level. */
if (*nl)
/* There's more we can do here. */
@ -1395,6 +1404,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
else if (*our_level > 0)
/* We had multiple levels, but used them up; reset to zero. */
*our_level = 0;
}
return !advance;
}

View File

@ -605,6 +605,7 @@ parser_finalize (struct parser *parser,
err = 0;
if (! err)
{
if (parser->state.next == parser->state.argc)
/* We successfully parsed all arguments! Call all the parsers again,
just a few more times... */
@ -632,12 +633,15 @@ parser_finalize (struct parser *parser,
else
/* No way to return the remaining arguments, they must be bogus. */
{
if (!(parser->state.flags & ARGP_NO_ERRS) && parser->state.err_stream)
if (!(parser->state.flags & ARGP_NO_ERRS)
&& parser->state.err_stream)
fprintf (parser->state.err_stream,
dgettext (parser->argp->argp_domain,
"%s: Too many arguments\n"), parser->state.name);
"%s: Too many arguments\n"),
parser->state.name);
err = EBADKEY;
}
}
/* Okay, we're all done, with either an error or success; call the parsers
to indicate which one. */
@ -849,6 +853,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
opt = KEY_END;
if (opt == KEY_END)
{
/* We're past what getopt considers the options. */
if (parser->state.next >= parser->state.argc
|| (parser->state.flags & ARGP_NO_ARGS))
@ -863,6 +868,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
opt = KEY_ARG;
optarg = parser->state.argv[parser->state.next++];
}
}
if (opt == KEY_ARG)
/* A non-option argument; try each parser in turn. */

View File

@ -404,12 +404,14 @@ noconv:
hexadecimal digits. This is no error case. We return 0 and
ENDPTR points to the `x`. */
if (endptr != NULL)
{
if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
&& save[-2] == L_('0'))
*endptr = (STRING_TYPE *) &save[-1];
else
/* There was no number to convert. */
*endptr = (STRING_TYPE *) nptr;
}
return 0L;
}

View File

@ -172,6 +172,7 @@ STRCOLL (s1, s2, l)
/* We have to increment the index counters. */
if ((forward && ++s1idx >= s1run->data[pass].number)
|| (!forward && --s1idx < 0))
{
if (forward)
{
s1run = s1run->next;
@ -183,9 +184,11 @@ STRCOLL (s1, s2, l)
if (s1run != NULL)
s1idx = s1run->data[pass].number - 1;
}
}
if ((forward && ++s2idx >= s2run->data[pass].number)
|| (!forward && --s2idx < 0))
{
if (forward)
{
s2run = s2run->next;
@ -197,7 +200,7 @@ STRCOLL (s1, s2, l)
if (s2run != NULL)
s2idx = s2run->data[pass].number - 1;
}
}
}
if (s1run != s2run)

View File

@ -250,6 +250,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
/* We have to increment the index counters. */
if ((forward && ++idx >= run->data[pass].number)
|| (!forward && --idx < 0))
{
if (forward)
{
run = run->next;
@ -262,6 +263,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
idx = run->data[pass].number - 1;
}
}
}
/* Write marker for end of word. */
if (pass + 1 < collate_nrules)