/* Whether to create a "thin" archive (symbol index only -- no files). */
static bfd_boolean make_thin_archive = FALSE;
+static const char *plugin_target = NULL;
+
int interactive = 0;
static void
fprintf (s, _(" p - print file(s) found in the archive\n"));
fprintf (s, _(" q[f] - quick append file(s) to the archive\n"));
fprintf (s, _(" r[ab][f][u] - replace existing or insert new file(s) into the archive\n"));
+ fprintf (s, _(" s - act as ranlib\n"));
fprintf (s, _(" t - display contents of archive\n"));
fprintf (s, _(" x[o] - extract file(s) from the archive\n"));
fprintf (s, _(" command specific modifiers:\n"));
if (full_pathname)
return file;
- filename = strrchr (file, '/');
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (file, '\\');
-
- if (filename == NULL || (bslash != NULL && bslash > filename))
- filename = bslash;
- if (filename == NULL && file[0] != '\0' && file[1] == ':')
- filename = file + 1;
- }
-#endif
- if (filename != (char *) NULL)
- filename++;
- else
- filename = file;
+ filename = lbasename (file);
if (ar_truncate
&& abfd != NULL
if (is_ranlib < 0)
{
- char *temp;
-
- temp = strrchr (program_name, '/');
-#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- {
- /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
- char *bslash = strrchr (program_name, '\\');
+ const char *temp = lbasename (program_name);
- if (temp == NULL || (bslash != NULL && bslash > temp))
- temp = bslash;
- if (temp == NULL && program_name[0] != '\0' && program_name[1] == ':')
- temp = program_name + 1;
- }
-#endif
- if (temp == NULL)
- temp = program_name;
- else
- ++temp;
if (strlen (temp) >= 6
&& FILENAME_CMP (temp + strlen (temp) - 6, "ranlib") == 0)
is_ranlib = 1;
arg_index += 2;
arg_ptr = argv[arg_index];
+
+ plugin_target = "plugin";
#else
fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
xexit (1);
bfd_set_error (bfd_error_no_error);
- target = NULL;
+ target = plugin_target;
if (stat (archive_filename, &sbuf) != 0)
{
{
bfd *obj;
- obj = bfd_openr (file, NULL);
+ obj = bfd_openr (file, target);
if (obj != NULL)
{
if (bfd_check_format (obj, bfd_object))
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
if (verbose)
- /* xgettext:c-format */
- printf (_("\n<%s>\n\n"), bfd_get_filename (abfd));
+ printf ("\n<%s>\n\n", bfd_get_filename (abfd));
bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
after_bfd = get_pos_bfd (&arch->archive_next, pos_after,
current->filename);
if (ar_emul_replace (after_bfd, *files_to_move,
- verbose))
+ plugin_target, verbose))
{
/* Snip out this entry from the chain. */
*current_ptr = (*current_ptr)->archive_next;
/* Add to the end of the archive. */
after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
- if (ar_emul_append (after_bfd, *files_to_move, verbose,
- make_thin_archive))
+ if (ar_emul_append (after_bfd, *files_to_move, plugin_target,
+ verbose, make_thin_archive))
changed = TRUE;
next_file:;