/* ar.c - Archive modify and extract.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of GNU Binutils.
#include "arsup.h"
#include "filenames.h"
#include "binemul.h"
+#include "plugin-api.h"
#include "plugin.h"
#ifdef __GO32___
{
bfd *arch;
+ /* Fail if no files are specified on the command line.
+ (But not for MRI mode which allows for reading arguments
+ and filenames from stdin). */
+ if (argv[arg_index] == NULL)
+ usage (0);
+
/* We don't use do_quick_append any more. Too many systems
expect ar to always rebuild the symbol table even when q is
used. */
default_deterministic ();
if (postype != pos_default)
- posname = argv[arg_index++];
+ {
+ posname = argv[arg_index++];
+ if (posname == NULL)
+ fatal (_("missing position arg."));
+ }
if (counted_name_mode)
{
if (operation != extract && operation != del)
fatal (_("`N' is only meaningful with the `x' and `d' options."));
+ if (argv[arg_index] == NULL)
+ fatal (_("`N' missing value."));
counted_name_counter = atoi (argv[arg_index++]);
if (counted_name_counter <= 0)
fatal (_("Value for `N' must be positive."));
}
inarch_filename = argv[arg_index++];
+ if (inarch_filename == NULL)
+ usage (0);
for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
continue;
if (smart_rename (new_name, old_name, 0) != 0)
xexit (1);
free (old_name);
+ free (new_name);
}
/* Return a pointer to the pointer to the entry which should be rplacd'd