summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-12-09 12:29:35 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-12-09 12:29:35 +0000
commitd08d1bcca2d502e5dc28f8300b743147bc029b71 (patch)
treef651451f7f308a821ef39c5551f418c8aeec5feb
parent1f30af71e044521dc0440350b1afeb1354cce3ed (diff)
downloadgnulib-d08d1bcca2d502e5dc28f8300b743147bc029b71.tar.gz
(argp_def): Use gettext wrappers
(argp_default_parser): Use __argp_base_name
-rw-r--r--lib/argp-parse.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/argp-parse.c b/lib/argp-parse.c
index b5d209665b..c3f1ad8c76 100644
--- a/lib/argp-parse.c
+++ b/lib/argp-parse.c
@@ -81,8 +81,8 @@ static const struct argp_option argp_default_options[] =
{
{"help", '?', 0, 0, N_("Give this help list"), -1},
{"usage", OPT_USAGE, 0, 0, N_("Give a short usage message"), 0},
- {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name"), 0},
- {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
+ {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("Set the program name"), 0},
+ {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
N_("Hang for SECS seconds (default 3600)"), 0},
{NULL, 0, 0, 0, NULL, 0}
};
@@ -97,7 +97,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state)
break;
case OPT_USAGE:
__argp_state_help (state, state->out_stream,
- ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
+ ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
break;
case OPT_PROGNAME: /* Set the program name. */
@@ -109,11 +109,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state)
to be that, so we have to be a bit careful here.] */
/* Update what we use for messages. */
- state->name = strrchr (arg, '/');
- if (state->name)
- state->name++;
- else
- state->name = arg;
+ state->name = __argp_base_name (arg);
#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
program_invocation_short_name = state->name;
@@ -562,10 +558,7 @@ parser_init (struct parser *parser, const struct argp *argp,
if (parser->state.argv == argv && argv[0])
/* There's an argv[0]; use it for messages. */
- {
- char *short_name = strrchr (argv[0], '/');
- parser->state.name = short_name ? short_name + 1 : argv[0];
- }
+ parser->state.name = __argp_base_name (argv[0]);
else
parser->state.name = __argp_short_program_name ();