Changeset 1989 in kBuild for vendor/gnumake/current/arscan.c
- Timestamp:
- Oct 28, 2008 11:02:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/arscan.c
r900 r1989 1 1 /* Library function for scanning an archive file. 2 2 Copyright (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.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 7 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 9 Foundation; either version 3 of the License, or (at your option) any later 10 version. 10 11 11 12 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY … … 14 15 15 16 You 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. */ 17 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 18 19 19 #include "make.h" … … 565 565 /* If the member name is "//" or "ARFILENAMES/" this may be 566 566 a list of file name mappings. The maximum file name 567 568 569 570 571 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, "//") 572 572 || !strcmp (name, "ARFILENAMES/")); 573 573 #endif /* Not AIAMAG. */ … … 577 577 578 578 #ifndef AIAMAG 579 580 581 582 583 584 585 586 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) 587 587 { 588 588 name = namemap + atoi (name + 1); 589 589 long_name = 1; 590 590 } 591 592 593 594 595 596 597 598 599 600 601 602 603 604 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'; 605 605 606 606 long_name = 1; 607 607 } 608 608 #endif /* Not AIAMAG. */ 609 609 } … … 646 646 #ifdef AIAMAGBIG 647 647 if (big_archive) 648 648 sscanf (member_header_big.ar_nxtmem, "%20ld", &member_offset); 649 649 else 650 650 #endif … … 658 658 #else 659 659 660 661 662 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. */ 663 663 if (is_namemap) 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 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 } 689 689 690 690 is_namemap = 0; 691 691 } 692 692 693 693 member_offset += AR_HDR_SIZE + eltsize;
Note:
See TracChangeset
for help on using the changeset viewer.