diff options
author | Ulrich Drepper <[email protected]> | 2009-02-01 16:19:50 -0800 |
---|---|---|
committer | Ulrich Drepper <[email protected]> | 2009-02-01 16:19:50 -0800 |
commit | c54453b8c7ca3877a2c1765b8046a89ef09d0b09 (patch) | |
tree | 24c53b36f8a73ceda28ede1944f0918807bf8055 /src/ar.c | |
parent | cea5ee3674c1ee515caf605b52c0a447dd7e4845 (diff) |
Fix argument handling in ar.
Diffstat (limited to 'src/ar.c')
-rw-r--r-- | src/ar.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -188,14 +188,16 @@ main (int argc, char *argv[]) if (ipos != ipos_none) { /* Only valid for certain operations. */ - if (operation == oper_extract && operation == oper_delete) + if (operation != oper_move && operation != oper_replace) error (1, 0, gettext ("\ 'a', 'b', and 'i' are only allowed with the 'm' and 'r' options")); if (remaining == argc) { - error (0, 0, gettext ("MEMBER parameter required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + error (0, 0, gettext ("\ +MEMBER parameter required for 'a', 'b', and 'i' modifiers")); + argp_help (&argp, stderr, ARGP_HELP_USAGE | ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -214,7 +216,8 @@ main (int argc, char *argv[]) if (remaining == argc) { error (0, 0, gettext ("COUNT parameter required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + argp_help (&argp, stderr, ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -237,8 +240,8 @@ main (int argc, char *argv[]) /* There must at least be one more parameter specifying the archive. */ if (remaining == argc) { - error (0, 0, gettext ("Archive name required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + error (0, 0, gettext ("archive name required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); exit (EXIT_FAILURE); } @@ -309,7 +312,8 @@ parse_opt (int key, char *arg __attribute__ ((unused)), if (operation != oper_none) { error (0, 0, gettext ("More than one operation specified")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + argp_help (&argp, stderr, ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -1098,7 +1102,8 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, if (fd == -1) { if (!suppress_create_msg) - fprintf (stderr, "%s: creating %s\n", AR, arfname); + fprintf (stderr, "%s: creating %s\n", + program_invocation_short_name, arfname); goto no_old; } @@ -1212,7 +1217,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, if (found[cnt] == NULL) { fprintf (stderr, gettext ("%s: no entry %s in archive!\n"), - AR, argv[cnt]); + program_invocation_short_name, argv[cnt]); status = 1; } |