diff --git a/ChangeLog b/ChangeLog index f8c8898af..998306ced 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ +2001-03-12 Werner Koch + + * INSTALL: Add a note to VPATH builds. + 2001-03-08 Werner Koch + * debian/: Applied update from James. + Added copyright and license notices to some more files. 2001-01-18 Werner Koch diff --git a/INSTALL b/INSTALL index a1a6800a7..37317b170 100644 --- a/INSTALL +++ b/INSTALL @@ -239,13 +239,14 @@ Or, on systems that have the `env' program, you can do it like this: Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the same -time by placing the object files for each architecture in their own -directory. To do this, you must use a version of `make', such as GNU `make', -that supports the `VPATH' variable. `cd' to the directory where you want the -object files and executables to go and run the `configure' script. -`configure' automatically checks for the source code in the directory that -`configure' is in and in `..'. + You can compile the package for more than one kind of computer at +the same time by placing the object files for each architecture in +their own directory. To do this, you must use a version of `make', +such as GNU `make', that supports the `VPATH' variable. `cd' to the +directory where you want the object files and executables to go and +run the `configure' script; please use a relative filename name to +invoke `configure'. `configure' automatically checks for the source +code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time diff --git a/NEWS b/NEWS index 235176480..b7f08ee71 100644 --- a/NEWS +++ b/NEWS @@ -1,13 +1,4 @@ - * The verification status of self-signatures are now cached. To increase - the speed of key list operations for existing keys you can do the - following in yout GnuPG homedir (~/.gnupg): - $ cp pubring.gpg pubring.gpg.save - $ gpg --export-all >x - $ rm pubring.gpg - $ gpg --import x - Note, that only v4 keys (i.e no old RSA keys) benefit from this caching. - * WARNING: The semantics of --verify have changed to address a problem with detached signature detection. --verify now ignores signed material given on stdin unless this is requested by using a "-" as the name for @@ -20,6 +11,20 @@ * Secret keys are no longer imported unless you use the new option --allow-secret-key-import. + * There is now a notation of a primary user ID. For example this one is + printed with a signature verifaction as the first user ID, revoked user + IDs are not printed there anymore. I general the primary user ID is the + one with the latest self-signature. + + * The verification status of self-signatures are now cached. To increase + the speed of key list operations for existing keys you can do the + following in yout GnuPG homedir (~/.gnupg): + $ cp pubring.gpg pubring.gpg.save + $ gpg --export-all >x + $ rm pubring.gpg + $ gpg --import x + Note, that only v4 keys (i.e no old RSA keys) benefit from this caching. + * Support for the gpg-agent from gpg 1.1 and other changes needed by gpgme. diff --git a/THANKS b/THANKS index 93e10e3fc..d64cb90b9 100644 --- a/THANKS +++ b/THANKS @@ -38,6 +38,7 @@ Dimitri dmitri@advantrix.com Dirk Lattermann dlatt@t-online.de Ed Boraas ecxjo@esperanto.org Edmund GRIMLEY EVANS edmundo@rano.org +Edwin Woudt edwin@woudt.nl Enzo Michelangeli em@MailAndNews.com Ernst Molitor ernst.molitor@uni-bonn.de Fabio Coatti cova@ferrara.linux.it @@ -74,6 +75,7 @@ Jens Bachem bachem@rrz.uni-koeln.de Jeroen C. van Gelderen jeroen@vangelderen.org J Horacio MG homega@ciberia.es J. Michael Ashley jashley@acm.org +Jim Bauer jfbauer@home.com Jim Small cavenewt@my-deja.com Joachim Backes backes@rhrk.uni-kl.de John A. Martin jam@jamux.com diff --git a/TODO b/TODO index 64b0dbd95..e59ae875e 100644 --- a/TODO +++ b/TODO @@ -8,8 +8,6 @@ * Can we output things like the preferences? - * Add Dave's UTS patches - ** Check whether the use of -u and --clearsign created 2 signatures. removed dups from the skclist. @@ -106,6 +104,3 @@ Nice to have trustdb. * Evaluate whether it make sense to replace the namehashs either by using the user ID directly or by using pointers into the trustdb. - - - diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 84f22d98f..6b2134da2 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,16 @@ +2001-03-12 Werner Koch + + * twofish.c (gnupgext_enum_func): Add some static when comnpiled + as a module. + + * tiger.c (tiger_get_info): Return "TIGER192" and not just + "TIGER". By Edwin Woudt. + +2001-03-08 Werner Koch + + * random.c: Always include time.h - standard requirement. Thanks + to James Troup. + 2001-01-18 Werner Koch * rndw32.c: Fixed typo and wrong ifdef for VER_PLATFORM* macro diff --git a/cipher/random.c b/cipher/random.c index 02fc2ba3a..de4bcf6c1 100644 --- a/cipher/random.c +++ b/cipher/random.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -43,9 +44,6 @@ #ifdef HAVE_GETTIMEOFDAY #include #endif -#ifdef HAVE_CLOCK_GETTIME - #include -#endif #ifdef HAVE_GETRUSAGE #include #endif diff --git a/cipher/tiger.c b/cipher/tiger.c index e4a7c4daa..193017076 100644 --- a/cipher/tiger.c +++ b/cipher/tiger.c @@ -904,7 +904,7 @@ tiger_get_info( int algo, size_t *contextsize, *(void (**)(TIGER_CONTEXT *))r_final = tiger_final; *(byte *(**)(TIGER_CONTEXT *))r_read = tiger_read; - return "TIGER"; + return "TIGER192"; } diff --git a/cipher/twofish.c b/cipher/twofish.c index 12982e123..e5a66520c 100644 --- a/cipher/twofish.c +++ b/cipher/twofish.c @@ -1004,6 +1004,8 @@ twofish_get_info (int algo, size_t *keylen, } +#ifdef IS_MODULE +static const char * const gnupgext_version = "TWOFISH ($Revision$)"; static struct { @@ -1034,7 +1036,7 @@ static struct { * version = interface version of the function/pointer * (currently this is 1 for all functions) */ -void * +static void * gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) { void *ret; @@ -1062,4 +1064,4 @@ gnupgext_enum_func ( int what, int *sequence, int *class, int *vers ) *sequence = i; return ret; } - +#endif diff --git a/debian/changelog b/debian/changelog index 823429d99..2f39aaae9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,40 @@ +gnupg (1.0.4-3) unstable; urgency=medium + + * debian/rules (binary): make gpg binary suid, closes: #86433. + * debian/postinst: don't use suidregister. + * debian/postrm: removed (only called suidunregister). + * debian/control: conflict with suidmanager << 0.50. + * mpi/longlong.h: apply fix for ARM long long artimetic from Philip + Blundell , closes: #87487. + * debian/preinst: the old GnuPG debs have moved to people.debian.org. + * cipher/random.c: #include as well as + * g10/misc.c: likewise. + * debian/rules: define a strip alias which removes the .comment and + .note sections. + * debian/rules (binary-arch): use it. + * debian/lintian.override: new file; override the SUID warning from + lintian. + * debian/rules (binary-arch): install it. + + -- James Troup Sun, 25 Feb 2001 05:24:58 +0000 + +gnupg (1.0.4-2) stable unstable; urgency=high + + * Apply security fix patch from Werner. + * Apply another patch from Werner to fix bogus warning on Rijndael + usage. + * Change section to 'non-US'. + + -- James Troup Mon, 12 Feb 2001 07:47:02 +0000 + +gnupg (1.0.4-1) stable unstable; urgency=high + + * New upstream version. + * Fixes a serious bug which could lead to false signature verification + results when more than one signature is fed to gpg. + + -- James Troup Tue, 17 Oct 2000 17:26:17 +0100 + gnupg (1.0.3b-1) unstable; urgency=low * New upstream snapshot version. diff --git a/debian/control b/debian/control index 28eb808c0..5b158daf5 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Source: gnupg -Section: utils +Section: non-US Priority: optional Maintainer: James Troup Standards-Version: 3.1.1.1 @@ -9,7 +9,7 @@ Package: gnupg Architecture: any Depends: ${shlibs:Depends}, makedev (>= 2.3.1-13) Suggests: gnupg-doc -Conflicts: gpg-rsa, gpg-rsaref +Conflicts: gpg-rsa, gpg-rsaref, suidmanager (<< 0.50) Replaces: gpg-rsa, gpg-rsaref Provides: gpg-rsa, gpg-rsaref Description: GNU privacy guard - a free PGP replacement. diff --git a/debian/lintian.override b/debian/lintian.override new file mode 100644 index 000000000..c35ed27b3 --- /dev/null +++ b/debian/lintian.override @@ -0,0 +1 @@ +gnupg: setuid-binary usr/bin/gpg 4755 root/root diff --git a/debian/preinst b/debian/preinst index 8369e2013..607944c7c 100644 --- a/debian/preinst +++ b/debian/preinst @@ -34,7 +34,7 @@ EOF If at any stage you need a pre-0.3.3 gnupg, you can find source and binaries for i386, m68k, alpha, powerpc and hurd-i386 at - http://james.nocrew.org/gnupg/ + http://people.debian.org/~troup/gnupg/ Press return to continue EOF diff --git a/debian/rules b/debian/rules index d194653ef..d596a024d 100644 --- a/debian/rules +++ b/debian/rules @@ -9,6 +9,8 @@ # paternity under the Copyright, Designs and Patents Act 1988.) # This file may have to be extensively modified +STRIP=strip --remove-section=.comment --remove-section=.note + build: $(checkdir) ./configure --prefix=/usr --with-included-gettext @@ -34,11 +36,12 @@ binary-arch: checkroot build # test install -d debian/tmp/DEBIAN/ install -m 755 debian/preinst debian/prerm debian/postinst debian/postrm debian/tmp/DEBIAN/ $(MAKE) prefix=`pwd`/debian/tmp/usr mandir=`pwd`/debian/tmp/usr/share/man install - strip debian/tmp/usr/bin/* + $(STRIP) debian/tmp/usr/bin/* + chmod 4755 debian/tmp/usr/bin/gpg chmod 644 debian/tmp/usr/lib/gnupg/* sed -e "s#../g10/gpg#gpg#" < tools/lspgpot > debian/tmp/usr/bin/lspgpot chmod 755 debian/tmp/usr/bin/lspgpot - strip --strip-unneeded debian/tmp/usr/lib/gnupg/* + $(STRIP) --strip-unneeded debian/tmp/usr/lib/gnupg/* # In response to #53714... no idea if it's correct, will check with upstream mv debian/tmp/usr/share/locale/es_ES debian/tmp/usr/share/locale/es sed -e "s#/usr/local/#/usr/#" < debian/tmp/usr/share/man/man1/gpg.1 \ @@ -57,6 +60,8 @@ binary-arch: checkroot build # test gzip -9v debian/tmp/usr/share/doc/gnupg/* ln -s changelog.g10.gz debian/tmp/usr/share/doc/gnupg/changelog.gz install -m 644 debian/copyright debian/tmp/usr/share/doc/gnupg/ + install -d debian/tmp/usr/share/lintian/overrides/ + install -m 644 debian/lintian.override debian/tmp/usr/share/lintian/overrides/gnupg dpkg-shlibdeps g10/gpg dpkg-gencontrol -isp chown -R root.root debian/tmp diff --git a/g10/ChangeLog b/g10/ChangeLog index 315ef5b79..5acdaf4a1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,8 +1,53 @@ +2001-03-12 Werner Koch + + * armor.c (parse_header_line): Removed double empty line check. + (parse_header_line): Replaced trim_trailing_ws with a counting + function so that we can adjust for the next read. + + * options.skel: Fixed 3 typos. By Thomas Klausner. Replaced the + keyserver example by a better working server. + + * parse-packet.c (parse_symkeyenc): Return Invalid_Packet on error. + (parse_pubkeyenc): Ditto. + (parse_onepass_sig): Ditto. + (parse_plaintext): Ditto. + (parse_encrypted): Ditto. + (parse_signature): Return error at other places too. + (parse_key): Ditto. + * g10.c (main): Set opt.list_packets to another value when invoked + with the --list-packets command. + * mainproc.c (do_proc_packets): Don's stop processing when running + under --list-packets command. + + * signal.c (do_sigaction): Removed. + (init_one_signal): New to replace the above. Needed to support + systems without sigactions. Suggested by Dave Dykstra. + (got_fatal_signal,init_signals): Use the above here. + (do_block): Use sigset() if sigprocmask() is not available. + + * armor.c (parse_hash_header): Test on TIGER192, which is the + correct value as per rfc2440. By Edwin Woudt. + 2001-03-08 Werner Koch + * misc.c: Include time.h. By James Troup. + * getkey.c: Re-enabled the unknown user Id and PK caches and increased their sizes. + * getkey.c (merge_selfsigs_main): Set expire date and continue + processing even if we found a revoked key. + (merge_selfsigs_subkeys): Ditto. + + * packet.h: Add an is_revoked flag to the user_id packet. + * getkey.c (fixup_uidnode): Set that flag here. + (merge_selfsigs_main): Fix so that the latest signature is used to + find the self-signature for an UID. + * parse-packet.c (parse_user_id): Zero out all fields. + * mainproc.c (check_sig_and_print): Print the primary user ID + according the the node flag and then all other non-revoked user IDs. + (is_uid_revoked): Removed; it is now handled by the key selection code. + Changed the year list of all copyright notices. 2001-03-07 Werner Koch diff --git a/g10/armor.c b/g10/armor.c index f07cf8e1d..03d52b1fe 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -245,7 +245,9 @@ parse_hash_header( const char *line ) found |= 2; else if( !strncmp( s, "MD5", s2-s ) ) found |= 4; - else if( !strncmp( s, "TIGER", s2-s ) ) + else if( !strncmp( s, "TIGER192", s2-s ) ) + found |= 8; + else if( !strncmp( s, "TIGER", s2-s ) ) /* used by old versions */ found |= 8; else return 0; @@ -312,19 +314,19 @@ is_armor_header( byte *line, unsigned len ) * >0: Good header line */ static int -parse_header_line( armor_filter_context_t *afx, byte *line, unsigned len ) +parse_header_line( armor_filter_context_t *afx, byte *line, unsigned int len ) { byte *p; int hashes=0; + unsigned int len2; - /* fixme: why this double check? I think the original code w/o the - * second check for an empty line was done from an early draft of - * of OpenPGP - or simply very stupid code */ - if( *line == '\n' || ( len && (*line == '\r' && line[1]=='\n') ) ) - return 0; /* empty line */ - len = trim_trailing_ws( line, len ); - if( !len ) - return 0; /* WS only same as empty line */ + len2 = check_trailing_ws( line, len ); + if( !len2 ) { + afx->buffer_pos = len2; /* (it is not the fine way to do it here) */ + return 0; /* WS only: same as empty line */ + } + len = len2; + line[len2] = 0; p = strchr( line, ':'); if( !p || !p[1] ) { diff --git a/g10/g10.c b/g10/g10.c index 9278dc56e..f0f9e8caa 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -1574,7 +1574,7 @@ main( int argc, char **argv ) break; case aListPackets: - opt.list_packets=1; + opt.list_packets=2; default: if( argc > 1 ) wrong_args(_("[filename]")); diff --git a/g10/getkey.c b/g10/getkey.c index 75222bde8..d00a2ebd9 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1354,12 +1354,13 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode ) uid->created = 0; /* not created == invalid */ if ( !signode ) return; /* no self-signature */ - if ( IS_UID_REV ( sig ) ) + if ( IS_UID_REV ( sig ) ) { + uid->is_revoked = 1; return; /* has been revoked */ + } uid->created = sig->timestamp; /* this one is okay */ - /* store the key flags in the helper variable for later processing */ uid->help_key_usage = 0; p = parse_sig_subpkt ( sig->hashed_data, SIGSUBPKT_KEY_FLAGS, &n ); @@ -1434,13 +1435,15 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) ; /* signature did not verify */ else if ( IS_KEY_REV (sig) ){ /* key has been revoked - there is no way to override - * such a revocation, so we can stop now. - * we can't cope with expiration times for revocations - * here because we have to assumethat an attacker can - * generate all kinds of signatures. + * such a revocation, so we theoretically can stop now. + * We should not cope with expiration times for revocations + * here because we have to assume that an attacker can + * generate all kinds of signatures. However due to the + * fact that the key has been revoked it does not harm + * either and by continuing we gather some more info on + * that key. */ *r_revoked = 1; - return; } else if ( IS_KEY_SIG (sig) && sig->timestamp >= sigdate ) { const byte *p; @@ -1511,8 +1514,9 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) if ( sig->keyid[0] == kid[0] && sig->keyid[1]==kid[1] ) { if ( check_key_signature( keyblock, k, NULL ) ) ; /* signature did not verify */ - else if ( IS_UID_SIG (sig) || IS_UID_REV (sig)) { - /* Note: we allow to invalidated cert revocations + else if ( (IS_UID_SIG (sig) || IS_UID_REV (sig)) + && sig->timestamp >= sigdate ) { + /* Note: we allow to invalidate cert revocations * by a newer signature. An attacker can't use this * because a key should be revoced with a key revocation. * The reason why we have to allow for that is that at @@ -1583,10 +1587,9 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) } pk->pubkey_usage = key_usage; - if ( !key_expire_seen ) { /* find the latest valid user ID with a key expiration set - * Note, that this may be a diferent one from the above because + * Note, that this may be a different one from the above because * some user IDs may have no expiration date set */ uiddate = 0; for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; @@ -1603,8 +1606,10 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) } pk->has_expired = key_expire >= curtime? 0 : key_expire; - /* FIXME: we should see how to get rid of the expiretime fields */ - + if ( pk->version >= 4 ) + pk->expiredate = key_expire; + /* Fixme: we should see how to get rid of the expiretime fields but + * this needs changes at other palces too. */ /* and now find the real primary user ID and delete all others */ uiddate = uiddate2 = 0; @@ -1681,12 +1686,10 @@ merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode ) if ( check_key_signature( keyblock, k, NULL ) ) ; /* signature did not verify */ else if ( IS_SUBKEY_REV (sig) ) { - /* key has been revoked - given the fact that it is easy - * to create a new subkey, it does not make sense to - * revive a revoked key. So we can stop here. - */ subpk->is_revoked = 1; - return; + /* although we could stop now, we continue to + * figure out other information like the old expiration + * time */ } else if ( IS_SUBKEY_SIG (sig) && sig->timestamp >= sigdate ) { p = parse_sig_subpkt( sig->hashed_data, @@ -1735,6 +1738,7 @@ merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode ) else key_expire = 0; subpk->has_expired = key_expire >= curtime? 0 : key_expire; + subpk->expiredate = key_expire; } diff --git a/g10/mainproc.c b/g10/mainproc.c index f05350e15..71d6a0f7f 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -245,8 +245,8 @@ proc_symkey_enc( CTX c, PACKET *pkt ) PKT_symkey_enc *enc; enc = pkt->pkt.symkey_enc; - if( enc->seskeylen ) - log_error( "symkey_enc packet with session keys are not supported!\n"); + if (enc->seskeylen) + log_error ("symkey_enc packet with session keys are not supported!\n"); else { c->last_was_session_key = 2; c->dek = passphrase_to_dek( NULL, 0, enc->cipher_algo, &enc->s2k, 0 ); @@ -1040,7 +1040,9 @@ do_proc_packets( CTX c, IOBUF a ) any_data = 1; if( rc ) { free_packet(pkt); - if( rc == G10ERR_INVALID_PACKET ) + /* stop processing hwne an invalid packet has been encountered + * but don't do so when we are doing a --list-packet. */ + if( rc == G10ERR_INVALID_PACKET && opt.list_packets != 2 ) break; continue; } @@ -1163,68 +1165,6 @@ do_proc_packets( CTX c, IOBUF a ) } -/* fixme: This code is a duplicate fro keylist.c and should be replaced - * by flags set in getkey.c. gpg 1.1 already does this */ -static int -is_uid_revoked ( KBNODE keyblock, KBNODE uidnode, u32 *mainkid ) -{ - KBNODE node; - PKT_signature *selfsig = NULL; /* the latest valid self signature */ - - assert ( uidnode->pkt->pkttype == PKT_USER_ID ); - - /* first find out about the latest valid self-signature */ - for ( node = uidnode->next; node; node = node->next ) { - PKT_signature *sig; - - if ( node->pkt->pkttype == PKT_USER_ID - || node->pkt->pkttype == PKT_PHOTO_ID - || node->pkt->pkttype == PKT_PUBLIC_SUBKEY - || node->pkt->pkttype == PKT_SECRET_SUBKEY ) - break; - if ( node->pkt->pkttype != PKT_SIGNATURE ) - continue; - sig = node->pkt->pkt.signature; - if ( mainkid[0] != sig->keyid[0] || mainkid[1] != sig->keyid[1] ) - continue; /* we only care about self-signatures for now */ - - if ( (sig->sig_class&~3) == 0x10 ) { /* regular self signature */ - if ( !check_key_signature( keyblock, node, NULL ) ) { - if ( !selfsig ) - selfsig = sig; /* use the first valid sig */ - else if ( sig->timestamp > selfsig->timestamp - && sig->sig_class >= selfsig->sig_class ) - selfsig = sig; /* but this one is newer */ - } - } - } - - /* watch out for a newer revocation */ - for ( node = uidnode->next; node; node = node->next ) { - PKT_signature *sig; - - if ( node->pkt->pkttype == PKT_USER_ID - || node->pkt->pkttype == PKT_PHOTO_ID - || node->pkt->pkttype == PKT_PUBLIC_SUBKEY - || node->pkt->pkttype == PKT_SECRET_SUBKEY ) - break; - if ( node->pkt->pkttype != PKT_SIGNATURE ) - continue; - sig = node->pkt->pkt.signature; - if ( mainkid[0] != sig->keyid[0] || mainkid[1] != sig->keyid[1] ) - continue; /* we only care about self-signatures */ - - if ( sig->sig_class == 0x30 - && (!selfsig || sig->timestamp >= selfsig->timestamp) ) { - if ( !check_key_signature( keyblock, node, NULL ) ) - return 1; - } - } - return 0; -} - - - static int check_sig_and_print( CTX c, KBNODE node ) { @@ -1282,8 +1222,6 @@ check_sig_and_print( CTX c, KBNODE node ) KBNODE un, keyblock; char *us; int count=0; - u32 mainkid[2]; - int mainkid_ok = 0; keyblock = get_pubkeyblock( sig->keyid ); @@ -1291,35 +1229,45 @@ check_sig_and_print( CTX c, KBNODE node ) write_status_text( rc? STATUS_BADSIG : STATUS_GOODSIG, us ); m_free(us); - /* fixme: list only user ids which are valid and add information - * about the trustworthiness of each user id, sort them. - * Integrate this with check_signatures_trust(). */ + /* find an print the primary user ID */ for( un=keyblock; un; un = un->next ) { - if ( !mainkid_ok && un->pkt->pkttype == PKT_PUBLIC_KEY ) { - keyid_from_pk( un->pkt->pkt.public_key, mainkid ); - mainkid_ok = 1; - } - if( !mainkid_ok || un->pkt->pkttype != PKT_USER_ID ) + if( un->pkt->pkttype != PKT_USER_ID ) continue; - if ( is_uid_revoked (keyblock, un, mainkid ) ) + if ( un->pkt->pkt.user_id->is_revoked ) continue; - - if( !count++ ) - log_info(rc? _("BAD signature from \"") - : _("Good signature from \"")); - else - log_info( _(" aka \"")); + if ( !un->pkt->pkt.user_id->is_primary ) + continue; + + log_info(rc? _("BAD signature from \"") + : _("Good signature from \"")); print_utf8_string( log_stream(), un->pkt->pkt.user_id->name, un->pkt->pkt.user_id->len ); fputs("\"\n", log_stream() ); - if( rc ) - break; /* print only one id in this case */ + count++; } if( !count ) { /* just in case that we have no userid */ log_info(rc? _("BAD signature from \"") : _("Good signature from \"")); fputs("[?]\"\n", log_stream() ); } + + /* If we have a good signature and already printed + * the primary user ID, print all the other user IDs */ + if ( count && !rc ) { + for( un=keyblock; un; un = un->next ) { + if( un->pkt->pkttype != PKT_USER_ID ) + continue; + if ( un->pkt->pkt.user_id->is_revoked ) + continue; + if ( un->pkt->pkt.user_id->is_primary ) + continue; + + log_info( _(" aka \"")); + print_utf8_string( log_stream(), un->pkt->pkt.user_id->name, + un->pkt->pkt.user_id->len ); + fputs("\"\n", log_stream() ); + } + } release_kbnode( keyblock ); if( !rc ) print_notation_data( sig ); diff --git a/g10/misc.c b/g10/misc.c index c1936aeee..573ff1b50 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -29,6 +29,7 @@ #include #endif #ifdef HAVE_SETRLIMIT + #include #include #include #endif diff --git a/g10/options.h b/g10/options.h index 2d0a9c529..20e60e6b9 100644 --- a/g10/options.h +++ b/g10/options.h @@ -44,7 +44,7 @@ struct { int fingerprint; /* list fingerprints */ int list_sigs; /* list signatures */ int no_armor; - int list_packets; /* list-packets mode */ + int list_packets; /* list-packets mode: 1=normal, 2=invoked by command*/ int def_cipher_algo; int force_v3_sigs; int force_mdc; diff --git a/g10/options.skel b/g10/options.skel index 43c3c0ab2..f2a117e23 100644 --- a/g10/options.skel +++ b/g10/options.skel @@ -48,7 +48,7 @@ force-v3-sigs # Because some mailers change lines starting with "From " to ">From " # it is good to handle such lines in a special way when creating -# cleartext signatures; all other PGP versions it this way too. +# cleartext signatures; all other PGP versions do it this way too. # To enable full OpenPGP compliance you have to remove this option. escape-from-lines @@ -81,12 +81,12 @@ lock-once # GnuPG can import a key from a HKP keyerver if one is missing -# for sercain operations. Is you set this option to a keyserver +# for certain operations. Is you set this option to a keyserver # you will be asked in such a case whether GnuPG should try to # import the key from that server (server do syncronize with each -# others and DNS Round-Robin may give you a random server each time). +# other and DNS Round-Robin may give you a random server each time). # Use "host -l pgp.net | grep www" to figure out a keyserver. -#keyserver wwwkeys.eu.pgp.net +#keyserver wwwkeys.nl.pgp.net # The environment variable http_proxy is only used when the # this option is set. diff --git a/g10/packet.h b/g10/packet.h index a1788336d..034ebdd47 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -178,6 +178,7 @@ typedef struct { int help_key_usage; u32 help_key_expire; int is_primary; + int is_revoked; u32 created; /* according to the self-signature */ char name[1]; } PKT_user_id; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index eca931b16..32b33bec8 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -576,19 +576,23 @@ static int parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) { PKT_symkey_enc *k; + int rc = 0; int i, version, s2kmode, cipher_algo, hash_algo, seskeylen, minlen; if( pktlen < 4 ) { log_error("packet(%d) too short\n", pkttype); + rc = G10ERR_INVALID_PACKET; goto leave; } version = iobuf_get_noeof(inp); pktlen--; if( version != 4 ) { log_error("packet(%d) with unknown version %d\n", pkttype, version); + rc = G10ERR_INVALID_PACKET; goto leave; } if( pktlen > 200 ) { /* (we encode the seskeylen in a byte) */ log_error("packet(%d) too large\n", pkttype); + rc = G10ERR_INVALID_PACKET; goto leave; } cipher_algo = iobuf_get_noeof(inp); pktlen--; @@ -610,6 +614,7 @@ parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) } if( minlen > pktlen ) { log_error("packet with S2K %d too short\n", s2kmode ); + rc = G10ERR_INVALID_PACKET; goto leave; } seskeylen = pktlen - minlen; @@ -646,24 +651,27 @@ parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) leave: skip_rest(inp, pktlen); - return 0; + return rc; } static int parse_pubkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) { - unsigned n; + unsigned int n; + int rc = 0; int i, ndata; PKT_pubkey_enc *k; k = packet->pkt.pubkey_enc = m_alloc_clear(sizeof *packet->pkt.pubkey_enc); if( pktlen < 12 ) { log_error("packet(%d) too short\n", pkttype); + rc = G10ERR_INVALID_PACKET; goto leave; } k->version = iobuf_get_noeof(inp); pktlen--; if( k->version != 2 && k->version != 3 ) { log_error("packet(%d) with unknown version %d\n", pkttype, k->version); + rc = G10ERR_INVALID_PACKET; goto leave; } k->keyid[0] = read_32(inp); pktlen -= 4; @@ -695,7 +703,7 @@ parse_pubkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) leave: skip_rest(inp, pktlen); - return 0; + return rc; } @@ -1088,6 +1096,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen, is_v4=1; else if( sig->version != 2 && sig->version != 3 ) { log_error("packet(%d) with unknown version %d\n", pkttype, sig->version); + rc = G10ERR_INVALID_PACKET; goto leave; } @@ -1223,14 +1232,17 @@ parse_onepass_sig( IOBUF inp, int pkttype, unsigned long pktlen, PKT_onepass_sig *ops ) { int version; + int rc = 0; if( pktlen < 13 ) { log_error("packet(%d) too short\n", pkttype); + rc = G10ERR_INVALID_PACKET; goto leave; } version = iobuf_get_noeof(inp); pktlen--; if( version != 3 ) { log_error("onepass_sig with unknown version %d\n", version); + rc = G10ERR_INVALID_PACKET; goto leave; } ops->sig_class = iobuf_get_noeof(inp); pktlen--; @@ -1249,7 +1261,7 @@ parse_onepass_sig( IOBUF inp, int pkttype, unsigned long pktlen, leave: skip_rest(inp, pktlen); - return 0; + return rc; } @@ -1289,11 +1301,13 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen, is_v4=1; else if( version != 2 && version != 3 ) { log_error("packet(%d) with unknown version %d\n", pkttype, version); + rc = G10ERR_INVALID_PACKET; goto leave; } if( pktlen < 11 ) { log_error("packet(%d) too short\n", pkttype); + rc = G10ERR_INVALID_PACKET; goto leave; } @@ -1572,6 +1586,12 @@ parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) packet->pkt.user_id->len = pktlen; packet->pkt.user_id->photo = NULL; packet->pkt.user_id->photolen = 0; + packet->pkt.user_id->is_primary = 0; + packet->pkt.user_id->is_revoked = 0; + packet->pkt.user_id->created = 0; + packet->pkt.user_id->help_key_usage = 0; + packet->pkt.user_id->help_key_expire = 0; + p = packet->pkt.user_id->name; for( ; pktlen; pktlen--, p++ ) *p = iobuf_get_noeof(inp); @@ -1580,7 +1600,7 @@ parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) if( list_mode ) { int n = packet->pkt.user_id->len; printf(":user ID packet: \""); - /* fixme: Hey why don't we replace this wioth print_string?? */ + /* fixme: Hey why don't we replace this with print_string?? */ for(p=packet->pkt.user_id->name; n; p++, n-- ) { if( *p >= ' ' && *p <= 'z' ) putchar(*p); @@ -1663,6 +1683,7 @@ static int parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt, int new_ctb ) { + int rc = 0; int mode, namelen; PKT_plaintext *pt; byte *p; @@ -1670,6 +1691,7 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen, if( pktlen && pktlen < 6 ) { log_error("packet(%d) too short (%lu)\n", pkttype, (ulong)pktlen); + rc = G10ERR_INVALID_PACKET; goto leave; } mode = iobuf_get_noeof(inp); if( pktlen ) pktlen--; @@ -1709,7 +1731,7 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen, } leave: - return 0; + return rc; } @@ -1738,6 +1760,7 @@ static int parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt, int new_ctb ) { + int rc = 0; PKT_encrypted *ed; unsigned long orig_pktlen = pktlen; @@ -1757,12 +1780,14 @@ parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen, log_error("encrypted_mdc packet with unknown version %d\n", version); /*skip_rest(inp, pktlen); should we really do this? */ + rc = G10ERR_INVALID_PACKET; goto leave; } ed->mdc_method = DIGEST_ALGO_SHA1; } if( orig_pktlen && pktlen < 10 ) { /* actually this is blocksize+2 */ log_error("packet(%d) too short\n", pkttype); + rc = G10ERR_INVALID_PACKET; skip_rest(inp, pktlen); goto leave; } @@ -1779,7 +1804,7 @@ parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen, pktlen = 0; leave: - return 0; + return rc; } @@ -1787,6 +1812,7 @@ static int parse_mdc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt, int new_ctb ) { + int rc = 0; PKT_mdc *mdc; byte *p; @@ -1795,6 +1821,7 @@ parse_mdc( IOBUF inp, int pkttype, unsigned long pktlen, printf(":mdc packet: length=%lu\n", pktlen); if( !new_ctb || pktlen != 20 ) { log_error("mdc_packet with invalid encoding\n"); + rc = G10ERR_INVALID_PACKET; goto leave; } p = mdc->hash; @@ -1802,7 +1829,7 @@ parse_mdc( IOBUF inp, int pkttype, unsigned long pktlen, *p = iobuf_get_noeof(inp); leave: - return 0; + return rc; } diff --git a/g10/sign.c b/g10/sign.c index b99fff6ee..6b603ebf7 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -430,7 +430,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr, if( !(filesize = iobuf_get_filelength(inp)) ) log_info(_("WARNING: `%s' is an empty file\n"), fname ); /* we can't yet encode the length of very large files, - * so we switch to partial lengthn encoding in this case */ + * so we switch to partial length encoding in this case */ if ( filesize >= IOBUF_FILELENGTH_LIMIT ) filesize = 0; diff --git a/g10/signal.c b/g10/signal.c index 9ad194815..512f56368 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -38,6 +38,36 @@ static volatile int caught_fatal_sig = 0; static volatile int caught_sigusr1 = 0; +static void +init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) +{ + #ifndef HAVE_DOSISH_SYSTEM + #if HAVE_SIGACTION + struct sigaction oact, nact; + + if (check_ign) { + /* we don't want to change an IGN handler */ + sigaction (sig, NULL, &oact ); + if (oact.sa_handler == SIG_IGN ) + return; + } + + nact.sa_handler = handler; + sigemptyset (&nact.sa_mask); + nact.sa_flags = 0; + sigaction ( sig, &nact, NULL); + #else + RETSIGTYPE (*ohandler)(int); + + ohandler = signal (sig, handler); + if (check_ign && ohandler == SIG_IGN) { + /* Change it back if it was already set to IGN */ + signal (sig, SIG_IGN); + } + #endif + #endif /*!HAVE_DOSISH_SYSTEM*/ +} + static const char * get_signal_name( int signum ) { @@ -66,18 +96,9 @@ got_fatal_signal( int sig ) s = get_signal_name(sig); write(2, s, strlen(s) ); write(2, " caught ... exiting\n", 21 ); - #ifndef HAVE_DOSISH_SYSTEM - { /* reset action to default action and raise signal again */ - struct sigaction nact; - nact.sa_handler = SIG_DFL; - sigemptyset( &nact.sa_mask ); - nact.sa_flags = 0; - sigaction( sig, &nact, NULL); - } - #endif - + /* reset action to default action and raise signal again */ + init_one_signal (sig, SIG_DFL, 0); remove_lockfiles (); - raise( sig ); } @@ -88,37 +109,18 @@ got_usr_signal( int sig ) caught_sigusr1 = 1; } -#ifndef HAVE_DOSISH_SYSTEM -static void -do_sigaction( int sig, struct sigaction *nact ) -{ - struct sigaction oact; - - sigaction( sig, NULL, &oact ); - if( oact.sa_handler != SIG_IGN ) - sigaction( sig, nact, NULL); -} -#endif void init_signals() { #ifndef HAVE_DOSISH_SYSTEM - struct sigaction nact; - - nact.sa_handler = got_fatal_signal; - sigemptyset( &nact.sa_mask ); - nact.sa_flags = 0; - - do_sigaction( SIGINT, &nact ); - do_sigaction( SIGHUP, &nact ); - do_sigaction( SIGTERM, &nact ); - do_sigaction( SIGQUIT, &nact ); - do_sigaction( SIGSEGV, &nact ); - nact.sa_handler = got_usr_signal; - sigaction( SIGUSR1, &nact, NULL ); - nact.sa_handler = SIG_IGN; - sigaction( SIGPIPE, &nact, NULL ); + init_one_signal (SIGINT, got_fatal_signal, 1 ); + init_one_signal (SIGHUP, got_fatal_signal, 1 ); + init_one_signal (SIGTERM, got_fatal_signal, 1 ); + init_one_signal (SIGQUIT, got_fatal_signal, 1 ); + init_one_signal (SIGSEGV, got_fatal_signal, 1 ); + init_one_signal (SIGUSR1, got_usr_signal, 0 ); + init_one_signal (SIGPIPE, SIG_IGN, 0 ); #endif } @@ -127,6 +129,7 @@ void pause_on_sigusr( int which ) { #ifndef HAVE_DOSISH_SYSTEM + #ifdef HAVE_SIGPROCMASK sigset_t mask, oldmask; assert( which == 1 ); @@ -138,6 +141,14 @@ pause_on_sigusr( int which ) sigsuspend( &oldmask ); caught_sigusr1 = 0; sigprocmask( SIG_UNBLOCK, &mask, NULL ); + #else + assert (which == 1); + sighold (SIGUSR1); + while (!caught_sigusr1) + sigpause(SIGUSR1); + caught_sigusr1 = 0; + sigrelse(SIGUSR1); ???? + #endif /*!HAVE_SIGPROCMASK*/ #endif } @@ -145,12 +156,13 @@ pause_on_sigusr( int which ) static void do_block( int block ) { - #ifndef HAVE_DOSISH_SYSTEM + #ifndef HAVE_DOSISH_SYSTEM static int is_blocked; + #ifdef HAVE_SIGPROCMASK static sigset_t oldmask; if( block ) { - sigset_t newmask; + sigset_t newmask; if( is_blocked ) log_bug("signals are already blocked\n"); @@ -164,7 +176,28 @@ do_block( int block ) sigprocmask( SIG_SETMASK, &oldmask, NULL ); is_blocked = 0; } - #endif /*HAVE_DOSISH_SYSTEM*/ + #else /*!HAVE_SIGPROCMASK*/ + static void (*disposition[MAXSIG])(); + int sig; + + if( block ) { + if( is_blocked ) + log_bug("signals are already blocked\n"); + for (sig=1; sig < MAXSIG; sig++) { + disposition[sig] = sigset (sig, SIG_HOLD); + } + is_blocked = 1; + } + else { + if( !is_blocked ) + log_bug("signals are not blocked\n"); + for (sig=1; sig < MAXSIG; sig++) { + sigset (sig, disposition[sig]); + } + is_blocked = 0; + } + #endif /*!HAVE_SIGPROCMASK*/ + #endif /*HAVE_DOSISH_SYSTEM*/ } @@ -179,4 +212,3 @@ unblock_all_signals() { do_block(0); } - diff --git a/include/util.h b/include/util.h index 9d2d1a75c..60b0c1736 100644 --- a/include/util.h +++ b/include/util.h @@ -172,8 +172,12 @@ STRLIST strlist_last( STRLIST node ); const char *memistr( const char *buf, size_t buflen, const char *sub ); char *mem2str( char *, const void *, size_t); char *trim_spaces( char *string ); -unsigned trim_trailing_chars( byte *line, unsigned len, const char *trimchars); -unsigned trim_trailing_ws( byte *line, unsigned len ); +unsigned int trim_trailing_chars( byte *line, unsigned int len, + const char *trimchars); +unsigned int trim_trailing_ws( byte *line, unsigned len ); +unsigned int check_trailing_chars( const byte *line, unsigned int len, + const char *trimchars ); +unsigned int check_trailing_ws( const byte *line, unsigned int len ); int string_count_chr( const char *string, int c ); int set_native_charset( const char *newset ); const char* get_native_charset(void); diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 524ccc180..474ecdd86 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2001-03-12 Werner Koch + + * config.guess, config.sub: Replaced with the current GNU CVS ones. + 2001-01-18 Werner Koch * autogen.sh: New options --build-w32 diff --git a/scripts/config.guess b/scripts/config.guess index 81688c4cf..d22f8b96a 100755 --- a/scripts/config.guess +++ b/scripts/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-07-27' +timestamp='2001-03-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,30 +32,41 @@ version='2000-07-27' # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of this system. +Output the configuration name of the system \`$me' is run on. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -64,9 +75,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; @@ -78,19 +87,30 @@ if test $# != 0; then exit 1 fi -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) @@ -100,12 +120,9 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -129,16 +146,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac - # The Operating System including object format. - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: @@ -247,7 +272,7 @@ EOF arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -383,7 +408,7 @@ EOF EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 + && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; @@ -437,6 +462,14 @@ EOF i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c @@ -450,7 +483,7 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then @@ -459,9 +492,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -469,7 +502,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -495,10 +528,28 @@ EOF echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -533,11 +584,16 @@ EOF } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include @@ -564,7 +620,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; @@ -628,23 +684,24 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3E:*:*:*) + CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -669,6 +726,9 @@ EOF i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -690,57 +750,38 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; - *:Linux:*:*) - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - *ia64) - echo "${UNAME_MACHINE}-unknown-linux" - exit 0 - ;; - i?86linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - elf_i?86) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - i?86coff) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - sparclinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - armlinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32arm*) - echo "${UNAME_MACHINE}-unknown-linux-gnuoldld" - exit 0 - ;; - armelf_linux*) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; - m68klinux) - echo "${UNAME_MACHINE}-unknown-linux-gnuaout" - exit 0 - ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >$dummy.c <$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < #if defined(__GLIBC__) extern char __libc_version[]; @@ -753,127 +794,127 @@ main(argc, argv) #if defined(__GLIBC__) printf("%s %s\n", __libc_version, __libc_release); #else - printf("unkown\n"); + printf("unknown\n"); #endif return 0; } EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi + LIBC="libc1" fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i?86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; - shelf_linux) - echo "${UNAME_MACHINE}-unknown-linux-gnu" + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - cat <$dummy.s - .data - \$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main - main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c < /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - elif test "${UNAME_MACHINE}" = "s390"; then - echo s390-ibm-linux && exit 0 - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ @@ -897,10 +938,10 @@ EOF return 0; } EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - fi ;; + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) @@ -977,7 +1018,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1000,9 +1041,12 @@ EOF TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -1036,7 +1080,7 @@ EOF mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) @@ -1079,9 +1123,12 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-W:NONSTOP_KERNEL:*:*) + NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; @@ -1099,6 +1146,29 @@ EOF fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1190,11 +1260,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -1205,7 +1288,7 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -1241,8 +1324,9 @@ fi cat >&2 < in order to provide the needed information to handle your system. -config.guess version = $version +config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` @@ -1278,7 +1362,7 @@ exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/scripts/config.sub b/scripts/config.sub index 1f731e493..ddbbfe5fb 100755 --- a/scripts/config.sub +++ b/scripts/config.sub @@ -1,9 +1,9 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-07-27' +timestamp='2001-02-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -60,16 +60,30 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS Canonicalize a configuration name. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -78,9 +92,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" exit 1 ;; *local*) @@ -105,7 +117,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -203,22 +215,24 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ | we32k | ns16k | clipper | i370 | sh | sh[34] \ | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr) + | thumb | d10v | d30v | fr30 | avr | openrisc) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -232,7 +246,7 @@ case $basic_machine in # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[234567]86) + i[234567]86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -243,26 +257,28 @@ case $basic_machine in # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-*) + | bs2000-* | tic54x-* | c54x-* | x86_64-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -353,8 +369,8 @@ case $basic_machine in basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) @@ -410,6 +426,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -509,14 +529,6 @@ case $basic_machine in basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -542,6 +554,10 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; @@ -572,7 +588,7 @@ case $basic_machine in os=-coff ;; msdos) - basic_machine=i386-unknown + basic_machine=i386-pc os=-msdos ;; mvs) @@ -636,6 +652,10 @@ case $basic_machine in basic_machine=i960-intel os=-mon960 ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; @@ -671,28 +691,28 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexen) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -707,6 +727,10 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -897,6 +921,10 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; @@ -904,7 +932,7 @@ case $basic_machine in basic_machine=we32k-att ;; sh3 | sh4) - base_machine=sh-unknown + basic_machine=sh-unknown ;; sparc | sparcv9) basic_machine=sparc-sun @@ -987,7 +1015,8 @@ case $os in | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit*) + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1048,7 +1077,7 @@ case $os in -ns2 ) os=-nextstep2 ;; - -nsk) + -nsk*) os=-nsk ;; # Preserve the version number of sinix5. @@ -1085,7 +1114,7 @@ case $os in -xenix) os=-xenix ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) @@ -1119,6 +1148,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -1227,7 +1259,7 @@ case $basic_machine in *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) @@ -1305,7 +1337,7 @@ case $basic_machine in -mpw* | -macos*) vendor=apple ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac @@ -1318,7 +1350,7 @@ exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: diff --git a/util/ChangeLog b/util/ChangeLog index 25034cfda..422159306 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +2001-03-12 Werner Koch + + * strgutil.c (check_trailing_chars,check_trailing_ws): New. + 2001-03-08 Werner Koch * argparse.c (default_strusage): Changed year of printed copyright diff --git a/util/strgutil.c b/util/strgutil.c index 1308bb0af..ba92481d5 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -247,7 +247,7 @@ trim_spaces( char *str ) -unsigned +unsigned int trim_trailing_chars( byte *line, unsigned len, const char *trimchars ) { byte *p, *mark; @@ -278,6 +278,37 @@ trim_trailing_ws( byte *line, unsigned len ) return trim_trailing_chars( line, len, " \t\r\n" ); } +unsigned int +check_trailing_chars( const byte *line, unsigned int len, + const char *trimchars ) +{ + const byte *p, *mark; + unsigned int n; + + for(mark=NULL, p=line, n=0; n < len; n++, p++ ) { + if( strchr(trimchars, *p ) ) { + if( !mark ) + mark = p; + } + else + mark = NULL; + } + + if( mark ) { + return mark - line; + } + return len; +} + +/**************** + * remove trailing white spaces and return the length of the buffer + */ +unsigned int +check_trailing_ws( const byte *line, unsigned int len ) +{ + return check_trailing_chars( line, len, " \t\r\n" ); +} + int