* ar.c (print_contents): Don't internationalize strings without words.
[deliverable/binutils-gdb.git] / binutils / ar.c
index 6cdd1191d3c4a117ecfc93d3a4ff7ee23b780326..a08a991290a5426ff69b08aded871525347e4d85 100644 (file)
@@ -132,6 +132,8 @@ static bfd_boolean full_pathname = FALSE;
 /* 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
@@ -242,6 +244,7 @@ usage (int help)
       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"));
@@ -303,22 +306,7 @@ normalize (const char *file, bfd *abfd)
   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
@@ -397,24 +385,8 @@ main (int argc, char **argv)
 
   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;
@@ -503,6 +475,8 @@ main (int argc, char **argv)
 
       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);
@@ -747,7 +721,7 @@ open_inarch (const char *archive_filename, const char *file)
 
   bfd_set_error (bfd_error_no_error);
 
-  target = NULL;
+  target = plugin_target;
 
   if (stat (archive_filename, &sbuf) != 0)
     {
@@ -778,7 +752,7 @@ open_inarch (const char *archive_filename, const char *file)
        {
          bfd *obj;
 
-         obj = bfd_openr (file, NULL);
+         obj = bfd_openr (file, target);
          if (obj != NULL)
            {
              if (bfd_check_format (obj, bfd_object))
@@ -846,8 +820,7 @@ print_contents (bfd *abfd)
     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);
 
@@ -1236,7 +1209,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
                  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;
@@ -1252,8 +1225,8 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
       /* 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:;
This page took 0.024911 seconds and 4 git commands to generate.