Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-09-24 08:28:01


Applied
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com

----- Original Message -----
From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
To: <jamboost_at_[hidden]>
Sent: Tuesday, September 24, 2002 8:53 AM
Subject: [jamboost] Re: Another patch for vacpp-tools.jam

> David Abrahams wrote:
>
> > I'm interested but busy. If you post it, I'm sure one of us will have
> > a look.
>
> Ok, here is the patch.
>
> Markus
>
>
> To unsubscribe from this group, send an email to:
> jamboost-unsubscribe_at_[hidden]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

---------------------------------------------------------------------------
-----

> Index: fileunix.c
> ===================================================================
> RCS file: /cvsroot/boost/boost/tools/build/jam_src/fileunix.c,v
> retrieving revision 1.5
> diff -u -3 -r1.5 fileunix.c
> --- fileunix.c 16 May 2002 15:42:44 -0000 1.5
> +++ fileunix.c 20 Sep 2002 20:46:01 -0000
> @@ -49,7 +49,7 @@
> # endif
>
> # if defined( OS_MVS ) || \
> - defined( OS_INTERIX ) || defined(OS_AIX)
> + defined( OS_INTERIX )
>
> #define ARMAG "!<arch>\n"
> #define SARMAG 8
> @@ -77,6 +77,14 @@
> # endif
>
> # ifndef HAVE_AR
> +
> +# ifdef OS_AIX
> +/* Define those for AIX to get the definitions for both the small and
the
> + * big variant of the archive file format. */
> +# define __AR_SMALL__
> +# define __AR_BIG__
> +# endif
> +
> # include <ar.h>
> # endif
>
> @@ -287,63 +295,129 @@
>
> # else /* AIAMAG - RS6000 AIX */
>
> -void
> -file_archscan(
> - char *archive,
> - scanback func,
> - void *closure )
> +static void file_archscan_small(
> + int fd, char const *archive, scanback func, void *closure)
> {
> - struct fl_hdr fl_hdr;
> + struct fl_hdr fl_hdr;
>
> - struct {
> - struct ar_hdr hdr;
> - char pad[ 256 ];
> - } ar_hdr ;
> + struct {
> + struct ar_hdr hdr;
> + char pad[ 256 ];
> + } ar_hdr ;
> +
> + char buf[ MAXJPATH ];
> + long offset;
> +
> + if( read( fd, (char *)&fl_hdr, FL_HSZ ) != FL_HSZ)
> + return;
> +
> + sscanf( fl_hdr.fl_fstmoff, "%ld", &offset );
> +
> + if( DEBUG_BINDSCAN )
> + printf( "scan archive %s\n", archive );
> +
> + while( offset > 0
> + && lseek( fd, offset, 0 ) >= 0
> + && read( fd, &ar_hdr, sizeof( ar_hdr ) ) >= sizeof( ar_hdr.hdr ) )
> + {
> + long lar_date;
> + int lar_namlen;
> +
> + sscanf( ar_hdr.hdr.ar_namlen, "%d", &lar_namlen );
> + sscanf( ar_hdr.hdr.ar_date, "%ld", &lar_date );
> + sscanf( ar_hdr.hdr.ar_nxtmem, "%ld", &offset );
> +
> + if( !lar_namlen )
> + continue;
> +
> + ar_hdr.hdr._ar_name.ar_name[ lar_namlen ] = '\0';
>
> - char buf[ MAXJPATH ];
> - long offset;
> - int fd;
> + sprintf( buf, "%s(%s)", archive, ar_hdr.hdr._ar_name.ar_name );
>
> - if( ( fd = open( archive, O_RDONLY, 0 ) ) < 0 )
> - return;
> + (*func)( closure, buf, 1 /* time valid */, (time_t)lar_date );
> + }
> +}
>
> - if( read( fd, (char *)&fl_hdr, FL_HSZ ) != FL_HSZ ||
> - strncmp( AIAMAG, fl_hdr.fl_magic, SAIAMAG ) )
> - {
> - close( fd );
> - return;
> - }
> +/* Check for OS version which supports the big variant. */
> +#ifdef AR_HSZ_BIG
>
> - sscanf( fl_hdr.fl_fstmoff, "%ld", &offset );
> +static void file_archscan_big(
> + int fd, char const *archive, scanback func, void *closure)
> +{
> + struct fl_hdr_big fl_hdr;
>
> - if( DEBUG_BINDSCAN )
> - printf( "scan archive %s\n", archive );
> + struct {
> + struct ar_hdr_big hdr;
> + char pad[ 256 ];
> + } ar_hdr ;
>
> - while( offset > 0 &&
> - lseek( fd, offset, 0 ) >= 0 &&
> - read( fd, &ar_hdr, sizeof( ar_hdr ) ) >= sizeof( ar_hdr.hdr ) )
> - {
> - long lar_date;
> - int lar_namlen;
> + char buf[ MAXJPATH ];
> + long long offset;
>
> - sscanf( ar_hdr.hdr.ar_namlen, "%d", &lar_namlen );
> - sscanf( ar_hdr.hdr.ar_date, "%ld", &lar_date );
> - sscanf( ar_hdr.hdr.ar_nxtmem, "%ld", &offset );
> + if( read( fd, (char *)&fl_hdr, FL_HSZ_BIG) != FL_HSZ_BIG)
> + return;
>
> - if( !lar_namlen )
> - continue;
> + sscanf( fl_hdr.fl_fstmoff, "%lld", &offset );
>
> - ar_hdr.hdr._ar_name.ar_name[ lar_namlen ] = '\0';
> + if( DEBUG_BINDSCAN )
> + printf( "scan archive %s\n", archive );
>
> - sprintf( buf, "%s(%s)", archive, ar_hdr.hdr._ar_name.ar_name );
> + while( offset > 0
> + && lseek( fd, offset, 0 ) >= 0
> + && read( fd, &ar_hdr, sizeof( ar_hdr ) ) >= sizeof( ar_hdr.hdr ) )
> + {
> + long lar_date;
> + int lar_namlen;
>
> - (*func)( closure, buf, 1 /* time valid */, (time_t)lar_date );
> - }
> + sscanf( ar_hdr.hdr.ar_namlen, "%d", &lar_namlen );
> + sscanf( ar_hdr.hdr.ar_date, "%ld", &lar_date );
> + sscanf( ar_hdr.hdr.ar_nxtmem, "%lld", &offset );
> +
> + if( !lar_namlen )
> + continue;
> +
> + ar_hdr.hdr._ar_name.ar_name[ lar_namlen ] = '\0';
> +
> + sprintf( buf, "%s(%s)", archive, ar_hdr.hdr._ar_name.ar_name );
> +
> + (*func)( closure, buf, 1 /* time valid */, (time_t)lar_date );
> + }
>
> - close( fd );
> +}
> +
> +#endif /* AR_HSZ_BIG */
> +
> +void file_archscan(char *archive, scanback func, void *closure)
> +{
> + int fd;
> + char fl_magic[SAIAMAG];
> +
> + if(( fd = open(archive, O_RDONLY, 0)) < 0)
> + return;
> +
> + if(read( fd, fl_magic, SAIAMAG) != SAIAMAG
> + || lseek(fd, 0, SEEK_SET) == -1)
> + {
> + close(fd);
> + return;
> + }
> +
> + if (strncmp(AIAMAG, fl_magic, SAIAMAG) == 0)
> + {
> + /* read small variant */
> + file_archscan_small(fd, archive, func, closure);
> + }
> +#ifdef AR_HSZ_BIG
> + else if (strncmp(AIAMAGBIG, fl_magic, SAIAMAG) == 0)
> + {
> + /* read big variant */
> + file_archscan_big(fd, archive, func, closure);
> + }
> +#endif
> +
> + close( fd );
> }
>
> # endif /* AIAMAG - RS6000 AIX */
>
> # endif /* USE_FILEUNIX */
> -
>

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk