Full support for --sysroot.
[deliverable/binutils-gdb.git] / binutils / ar.c
index 5a3406257f6ac185d105b27502ed828d2a65070e..14358b459651e83230fb60179e60a30a496e3bd2 100644 (file)
@@ -7,7 +7,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,7 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 \f
 /*
    Bugs: should use getopt the way tar does (complete w/optional -) and
    when name truncated. No way to specify pos_end. Error messages should be
    more consistent.  */
 
+#include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
 #include "progress.h"
-#include "bucomm.h"
 #include "aout/ar.h"
 #include "libbfd.h"
+#include "bucomm.h"
 #include "arsup.h"
 #include "filenames.h"
 #include "binemul.h"
@@ -153,7 +155,7 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
 
   if (count == 0)
     {
-      for (head = arch->next; head; head = head->next)
+      for (head = arch->archive_next; head; head = head->archive_next)
        {
          PROGRESS (1);
          function (head);
@@ -172,7 +174,7 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
       bfd_boolean found = FALSE;
 
       match_count = 0;
-      for (head = arch->next; head; head = head->next)
+      for (head = arch->archive_next; head; head = head->archive_next)
        {
          PROGRESS (1);
          if (head->filename == NULL)
@@ -758,7 +760,7 @@ open_inarch (const char *archive_filename, const char *file)
       xexit (1);
     }
 
-  last_one = &(arch->next);
+  last_one = &(arch->archive_next);
   /* Read all the contents right away, regardless.  */
   for (next_one = bfd_openr_next_archived_file (arch, NULL);
        next_one;
@@ -766,7 +768,7 @@ open_inarch (const char *archive_filename, const char *file)
     {
       PROGRESS (1);
       *last_one = next_one;
-      last_one = &next_one->next;
+      last_one = &next_one->archive_next;
     }
   *last_one = (bfd *) NULL;
   if (bfd_get_error () != bfd_error_no_more_archived_files)
@@ -922,7 +924,7 @@ write_archive (bfd *iarch)
 {
   bfd *obfd;
   char *old_name, *new_name;
-  bfd *contents_head = iarch->next;
+  bfd *contents_head = iarch->archive_next;
 
   old_name = xmalloc (strlen (bfd_get_filename (iarch)) + 1);
   strcpy (old_name, bfd_get_filename (iarch));
@@ -994,15 +996,15 @@ get_pos_bfd (bfd **contents, enum pos default_pos, const char *default_posname)
   if (realpos == pos_end)
     {
       while (*after_bfd)
-       after_bfd = &((*after_bfd)->next);
+       after_bfd = &((*after_bfd)->archive_next);
     }
   else
     {
-      for (; *after_bfd; after_bfd = &(*after_bfd)->next)
+      for (; *after_bfd; after_bfd = &(*after_bfd)->archive_next)
        if (FILENAME_CMP ((*after_bfd)->filename, realposname) == 0)
          {
            if (realpos == pos_after)
-             after_bfd = &(*after_bfd)->next;
+             after_bfd = &(*after_bfd)->archive_next;
            break;
          }
     }
@@ -1034,7 +1036,7 @@ delete_members (bfd *arch, char **files_to_delete)
 
       found = FALSE;
       match_count = 0;
-      current_ptr_ptr = &(arch->next);
+      current_ptr_ptr = &(arch->archive_next);
       while (*current_ptr_ptr)
        {
          if (FILENAME_CMP (normalize (*files_to_delete, arch),
@@ -1054,12 +1056,12 @@ delete_members (bfd *arch, char **files_to_delete)
                  if (verbose)
                    printf ("d - %s\n",
                            *files_to_delete);
-                 *current_ptr_ptr = ((*current_ptr_ptr)->next);
+                 *current_ptr_ptr = ((*current_ptr_ptr)->archive_next);
                  goto next_file;
                }
            }
 
-         current_ptr_ptr = &((*current_ptr_ptr)->next);
+         current_ptr_ptr = &((*current_ptr_ptr)->archive_next);
        }
 
       if (verbose && !found)
@@ -1088,7 +1090,7 @@ move_members (bfd *arch, char **files_to_move)
 
   for (; *files_to_move; ++files_to_move)
     {
-      current_ptr_ptr = &(arch->next);
+      current_ptr_ptr = &(arch->archive_next);
       while (*current_ptr_ptr)
        {
          bfd *current_ptr = *current_ptr_ptr;
@@ -1098,13 +1100,13 @@ move_members (bfd *arch, char **files_to_move)
              /* Move this file to the end of the list - first cut from
                 where it is.  */
              bfd *link;
-             *current_ptr_ptr = current_ptr->next;
+             *current_ptr_ptr = current_ptr->archive_next;
 
              /* Now glue to end */
-             after_bfd = get_pos_bfd (&arch->next, pos_end, NULL);
+             after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
              link = *after_bfd;
              *after_bfd = current_ptr;
-             current_ptr->next = link;
+             current_ptr->archive_next = link;
 
              if (verbose)
                printf ("m - %s\n", *files_to_move);
@@ -1112,7 +1114,7 @@ move_members (bfd *arch, char **files_to_move)
              goto next_file;
            }
 
-         current_ptr_ptr = &((*current_ptr_ptr)->next);
+         current_ptr_ptr = &((*current_ptr_ptr)->archive_next);
        }
       /* xgettext:c-format */
       fatal (_("no entry %s in archive %s!"), *files_to_move, arch->filename);
@@ -1137,7 +1139,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
     {
       if (! quick)
        {
-         current_ptr = &arch->next;
+         current_ptr = &arch->archive_next;
          while (*current_ptr)
            {
              current = *current_ptr;
@@ -1167,24 +1169,24 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
                        goto next_file;
                    }
 
-                 after_bfd = get_pos_bfd (&arch->next, pos_after,
+                 after_bfd = get_pos_bfd (&arch->archive_next, pos_after,
                                           current->filename);
                  if (ar_emul_replace (after_bfd, *files_to_move,
                                       verbose))
                    {
                      /* Snip out this entry from the chain.  */
-                     *current_ptr = (*current_ptr)->next;
+                     *current_ptr = (*current_ptr)->archive_next;
                      changed = TRUE;
                    }
 
                  goto next_file;
                }
-             current_ptr = &(current->next);
+             current_ptr = &(current->archive_next);
            }
        }
 
       /* Add to the end of the archive.  */
-      after_bfd = get_pos_bfd (&arch->next, pos_end, NULL);
+      after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
 
       if (ar_emul_append (after_bfd, *files_to_move, verbose))
        changed = TRUE;
This page took 0.026133 seconds and 4 git commands to generate.