VirtualBox

Changeset 1989 in kBuild for vendor/gnumake/current/arscan.c


Ignore:
Timestamp:
Oct 28, 2008 11:02:45 PM (16 years ago)
Author:
bird
Message:

Load gnumake-2008-10-28-CVS into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/arscan.c

    r900 r1989  
    11/* Library function for scanning an archive file.
    22Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
    4 Inc.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
     4Foundation, Inc.
    55This file is part of GNU Make.
    66
    77GNU Make is free software; you can redistribute it and/or modify it under the
    88terms of the GNU General Public License as published by the Free Software
    9 Foundation; either version 2, or (at your option) any later version.
     9Foundation; either version 3 of the License, or (at your option) any later
     10version.
    1011
    1112GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     
    1415
    1516You should have received a copy of the GNU General Public License along with
    16 GNU Make; see the file COPYING.  If not, write to the Free Software
    17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
     17this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1818
    1919#include "make.h"
     
    565565          /* If the member name is "//" or "ARFILENAMES/" this may be
    566566             a list of file name mappings.  The maximum file name
    567              length supported by the standard archive format is 14
    568              characters.  This member will actually always be the
    569              first or second entry in the archive, but we don't check
    570              that.  */
    571           is_namemap = (!strcmp (name, "//")
     567             length supported by the standard archive format is 14
     568             characters.  This member will actually always be the
     569             first or second entry in the archive, but we don't check
     570             that.  */
     571          is_namemap = (!strcmp (name, "//")
    572572                        || !strcmp (name, "ARFILENAMES/"));
    573573#endif  /* Not AIAMAG. */
     
    577577
    578578#ifndef AIAMAG
    579           /* If the member name starts with a space or a slash, this
    580              is an index into the file name mappings (used by GNU ar).
    581              Otherwise if the member name looks like #1/NUMBER the
    582              real member name appears in the element data (used by
    583              4.4BSD).  */
    584           if (! is_namemap
    585               && (name[0] == ' ' || name[0] == '/')
    586               && namemap != 0)
     579          /* If the member name starts with a space or a slash, this
     580             is an index into the file name mappings (used by GNU ar).
     581             Otherwise if the member name looks like #1/NUMBER the
     582             real member name appears in the element data (used by
     583             4.4BSD).  */
     584          if (! is_namemap
     585              && (name[0] == ' ' || name[0] == '/')
     586              && namemap != 0)
    587587            {
    588588              name = namemap + atoi (name + 1);
    589589              long_name = 1;
    590590            }
    591           else if (name[0] == '#'
    592                    && name[1] == '1'
    593                    && name[2] == '/')
    594             {
    595               int namesize = atoi (name + 3);
    596 
    597               name = alloca (namesize + 1);
    598               nread = read (desc, name, namesize);
    599               if (nread != namesize)
    600                 {
    601                   close (desc);
    602                   return -2;
    603                 }
    604               name[namesize] = '\0';
     591          else if (name[0] == '#'
     592                   && name[1] == '1'
     593                   && name[2] == '/')
     594            {
     595              int namesize = atoi (name + 3);
     596
     597              name = alloca (namesize + 1);
     598              nread = read (desc, name, namesize);
     599              if (nread != namesize)
     600                {
     601                  close (desc);
     602                  return -2;
     603                }
     604              name[namesize] = '\0';
    605605
    606606              long_name = 1;
    607             }
     607            }
    608608#endif /* Not AIAMAG. */
    609609        }
     
    646646#ifdef AIAMAGBIG
    647647        if (big_archive)
    648           sscanf (member_header_big.ar_nxtmem, "%20ld", &member_offset);
     648         sscanf (member_header_big.ar_nxtmem, "%20ld", &member_offset);
    649649        else
    650650#endif
     
    658658#else
    659659
    660         /* If this member maps archive names, we must read it in.  The
    661            name map will always precede any members whose names must
    662            be mapped.  */
     660        /* If this member maps archive names, we must read it in.  The
     661           name map will always precede any members whose names must
     662           be mapped.  */
    663663        if (is_namemap)
    664           {
    665             char *clear;
    666             char *limit;
    667 
    668             namemap = alloca (eltsize);
    669             nread = read (desc, namemap, eltsize);
    670             if (nread != eltsize)
    671               {
    672                 (void) close (desc);
    673                 return -2;
    674               }
    675 
    676             /* The names are separated by newlines.  Some formats have
    677                a trailing slash.  Null terminate the strings for
    678                convenience.  */
    679             limit = namemap + eltsize;
    680             for (clear = namemap; clear < limit; clear++)
    681               {
    682                 if (*clear == '\n')
    683                   {
    684                     *clear = '\0';
    685                     if (clear[-1] == '/')
    686                       clear[-1] = '\0';
    687                   }
    688               }
     664          {
     665            char *clear;
     666            char *limit;
     667
     668            namemap = alloca (eltsize);
     669            nread = read (desc, namemap, eltsize);
     670            if (nread != eltsize)
     671              {
     672                (void) close (desc);
     673                return -2;
     674              }
     675
     676            /* The names are separated by newlines.  Some formats have
     677               a trailing slash.  Null terminate the strings for
     678               convenience.  */
     679            limit = namemap + eltsize;
     680            for (clear = namemap; clear < limit; clear++)
     681              {
     682                if (*clear == '\n')
     683                  {
     684                    *clear = '\0';
     685                    if (clear[-1] == '/')
     686                      clear[-1] = '\0';
     687                  }
     688              }
    689689
    690690            is_namemap = 0;
    691           }
     691          }
    692692
    693693        member_offset += AR_HDR_SIZE + eltsize;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette