summaryrefslogtreecommitdiffstats
path: root/src/ar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ar.c')
-rw-r--r--src/ar.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/ar.c b/src/ar.c
index 961db241..2d11b1ef 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -55,7 +55,8 @@
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
-void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+
/* Prototypes for local functions. */
static int do_oper_extract (int oper, const char *arfname, char **argv,
int argc, long int instance);
@@ -66,7 +67,7 @@ static int do_oper_insert (int oper, const char *arfname, char **argv,
/* Bug report address. */
-const char *argp_program_bug_address = PACKAGE_BUGREPORT;
+ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
/* Definitions of arguments for argp functions. */
@@ -187,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);
}
@@ -213,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);
}
@@ -236,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);
}
@@ -308,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);
}
@@ -1097,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;
}
@@ -1211,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;
}