Ignore:
Timestamp:
May 23, 2007, 5:13:11 AM (18 years ago)
Author:
bird
Message:

Load /home/bird/src/Gnu/make/2007-05-23 into vendor/gnumake/current.

File:
1 edited

Legend:

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

    r501 r900  
    2626
    2727#ifndef NO_ARCHIVES
    28 
    2928
    3029#ifdef VMS
     
    136135
    137136long int
    138 ar_scan (char *archive, long int (*function) PARAMS ((void)), long int arg)
     137ar_scan (const char *archive, ar_member_func_t function, const void *arg)
    139138{
    140139  char *p;
     
    304303
    305304long int
    306 ar_scan (char *archive, long int (*function)(), long int arg)
     305ar_scan (const char *archive, ar_member_func_t function, const void *arg)
    307306{
    308307#ifdef AIAMAG
     
    316315#endif
    317316  char *namemap = 0;
    318   register int desc = open (archive, O_RDONLY, 0);
     317  int desc = open (archive, O_RDONLY, 0);
    319318  if (desc < 0)
    320319    return -1;
     
    323322    char buf[SARMAG];
    324323    register int nread = read (desc, buf, SARMAG);
    325     if (nread != SARMAG || bcmp (buf, ARMAG, SARMAG))
     324    if (nread != SARMAG || memcmp (buf, ARMAG, SARMAG))
    326325      {
    327326        (void) close (desc);
     
    332331#ifdef AIAMAG
    333332  {
    334     register int nread = read (desc, (char *) &fl_header, FL_HSZ);
     333    register int nread = read (desc, &fl_header, FL_HSZ);
    335334
    336335    if (nread != FL_HSZ)
     
    342341    /* If this is a "big" archive, then set the flag and
    343342       re-read the header into the "big" structure. */
    344     if (!bcmp (fl_header.fl_magic, AIAMAGBIG, SAIAMAG))
     343    if (!memcmp (fl_header.fl_magic, AIAMAGBIG, SAIAMAG))
    345344      {
    346345        big_archive = 1;
     
    354353
    355354        /* re-read the header into the "big" structure */
    356         nread = read (desc, (char *) &fl_header_big, FL_HSZ_BIG);
     355        nread = read (desc, &fl_header_big, FL_HSZ_BIG);
    357356        if (nread != FL_HSZ_BIG)
    358357          {
     
    364363#endif
    365364       /* Check to make sure this is a "normal" archive. */
    366       if (bcmp (fl_header.fl_magic, AIAMAG, SAIAMAG))
     365      if (memcmp (fl_header.fl_magic, AIAMAG, SAIAMAG))
    367366        {
    368367          (void) close (desc);
     
    458457        if (big_archive)
    459458          {
    460             nread = read (desc, (char *) &member_header_big,
     459            nread = read (desc, &member_header_big,
    461460                          AR_MEMHDR_SZ(member_header_big) );
    462461
     
    490489#endif
    491490          {
    492             nread = read (desc, (char *) &member_header,
     491            nread = read (desc, &member_header,
    493492                          AR_MEMHDR_SZ(member_header) );
    494493
     
    528527
    529528#else   /* Not AIAMAG.  */
    530         nread = read (desc, (char *) &member_header, AR_HDR_SIZE);
     529        nread = read (desc, &member_header, AR_HDR_SIZE);
    531530        if (nread == 0)
    532531          /* No data left means end of file; that is OK.  */
     
    537536            || (
    538537# ifdef ARFMAG
    539                 bcmp (member_header.ar_fmag, ARFMAG, 2)
     538                memcmp (member_header.ar_fmag, ARFMAG, 2)
    540539# else
    541540                1
     
    543542                &&
    544543# ifdef ARFZMAG
    545                 bcmp (member_header.ar_fmag, ARFZMAG, 2)
     544                memcmp (member_header.ar_fmag, ARFZMAG, 2)
    546545# else
    547546                1
     
    556555
    557556        name = namebuf;
    558         bcopy (member_header.ar_name, name, sizeof member_header.ar_name);
     557        memcpy (name, member_header.ar_name, sizeof member_header.ar_name);
    559558        {
    560559          register char *p = name + sizeof member_header.ar_name;
     
    596595              int namesize = atoi (name + 3);
    597596
    598               name = (char *) alloca (namesize + 1);
     597              name = alloca (namesize + 1);
    599598              nread = read (desc, name, namesize);
    600599              if (nread != namesize)
     
    667666            char *limit;
    668667
    669             namemap = (char *) alloca (eltsize);
     668            namemap = alloca (eltsize);
    670669            nread = read (desc, namemap, eltsize);
    671670            if (nread != eltsize)
     
    710709
    711710int
    712 ar_name_equal (char *name, char *mem, int truncated)
     711ar_name_equal (const char *name, const char *mem, int truncated)
    713712{
    714   char *p;
     713  const char *p;
    715714
    716715  p = strrchr (name, '/');
     
    742741/* ARGSUSED */
    743742static long int
    744 ar_member_pos (int desc UNUSED, char *mem, int truncated,
     743ar_member_pos (int desc UNUSED, const char *mem, int truncated,
    745744               long int hdrpos, long int datapos UNUSED, long int size UNUSED,
    746745               long int date UNUSED, int uid UNUSED, int gid UNUSED,
    747                int mode UNUSED, char *name)
     746               int mode UNUSED, const void *name)
    748747{
    749748  if (!ar_name_equal (name, mem, truncated))
     
    760759
    761760int
    762 ar_member_touch (char *arname, char *memname)
     761ar_member_touch (const char *arname, const char *memname)
    763762{
    764   long int pos = ar_scan (arname, ar_member_pos, (long int) memname);
     763  long int pos = ar_scan (arname, ar_member_pos, memname);
    765764  int fd;
    766765  struct ar_hdr ar_hdr;
     
    780779  if (lseek (fd, pos, 0) < 0)
    781780    goto lose;
    782   if (AR_HDR_SIZE != read (fd, (char *) &ar_hdr, AR_HDR_SIZE))
     781  if (AR_HDR_SIZE != read (fd, &ar_hdr, AR_HDR_SIZE))
    783782    goto lose;
    784783  /* Write back the header, thus touching the archive file.  */
    785784  if (lseek (fd, pos, 0) < 0)
    786785    goto lose;
    787   if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
     786  if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
    788787    goto lose;
    789788  /* The file's mtime is the time we we want.  */
     
    805804  if (lseek (fd, pos, 0) < 0)
    806805    goto lose;
    807   if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
     806  if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
    808807    goto lose;
    809808  close (fd);
     
    822821
    823822long int
    824 describe_member (int desc, char *name, int truncated,
     823describe_member (int desc, const char *name, int truncated,
    825824                 long int hdrpos, long int datapos, long int size,
    826                  long int date, int uid, int gid, int mode)
     825                 long int date, int uid, int gid, int mode, const void *arg)
    827826{
    828827  extern char *ctime ();
     
    840839main (int argc, char **argv)
    841840{
    842   ar_scan (argv[1], describe_member);
     841  ar_scan (argv[1], describe_member, NULL);
    843842  return 0;
    844843}
Note: See TracChangeset for help on using the changeset viewer.