1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-15 00:29:49 +02:00

NT version compiles

This commit is contained in:
Werner Koch 1998-01-05 19:13:15 +00:00
parent b7bdef0834
commit e1117ae4a1
14 changed files with 380 additions and 138 deletions

3
README
View File

@ -6,8 +6,6 @@
THIS IS VERSION IS ONLY A TEST VERSION ! YOU SHOULD NOT THIS IS VERSION IS ONLY A TEST VERSION ! YOU SHOULD NOT
USE IT FOR OTHER PURPOSES THAN EVALUATING THE CURRENT CODE. USE IT FOR OTHER PURPOSES THAN EVALUATING THE CURRENT CODE.
* Only some parts work.
* The data format may change in the next version! * The data format may change in the next version!
* Some features are not yet implemented * Some features are not yet implemented
@ -43,6 +41,7 @@
1024 bit keys and this may be not enough in a couple of years. 1024 bit keys and this may be not enough in a couple of years.
Resources Resources
--------- ---------
G10 needs a directory "~/.g10" to store the default keyrings G10 needs a directory "~/.g10" to store the default keyrings

View File

@ -37,6 +37,9 @@
#undef HAVE_U32_TYPEDEF #undef HAVE_U32_TYPEDEF
/* defined if we have a /dev/random and /dev/urandom */
#undef HAVE_DEV_RANDOM
/* RSA is only compiled in if you have these files. You can use /* RSA is only compiled in if you have these files. You can use
* RSA without any restrictions, if your not in the U.S. or * RSA without any restrictions, if your not in the U.S. or
* wait until sep 20, 2000 * wait until sep 20, 2000

View File

@ -40,7 +40,6 @@ static struct cache cache[3];
#define MASK_LEVEL(a) do {if( a > 2 ) a = 2; else if( a < 0 ) a = 0; } while(0) #define MASK_LEVEL(a) do {if( a > 2 ) a = 2; else if( a < 0 ) a = 0; } while(0)
static int open_device( const char *name, int minor );
static void fill_buffer( byte *buffer, size_t length, int level ); static void fill_buffer( byte *buffer, size_t length, int level );
/**************** /****************
@ -70,6 +69,7 @@ get_random_byte( int level )
#ifdef HAVE_DEV_RANDOM
static int static int
open_device( const char *name, int minor ) open_device( const char *name, int minor )
@ -149,3 +149,26 @@ the OS a chance to collect more entropy! (Need %d more bytes)\n", length );
} while( length ); } while( length );
} }
#else /* not HAVE_DEV_RANDOM */
static void
fill_buffer( byte *buffer, size_t length, int level )
{
static int initialized=0;
if( !initialized ) {
log_info("warning: using insecure random number generator!!\n");
tty_printf("The random number generator is only a kludge to let\n"
"it compile - it is in no way a strong RNG!\n\n"
"DON'T USE ANY DATA GENERATED BY THIS PROGRAM!!\n\n");
initialized=1;
srand(make_timestamp()*getpid());
}
while( length-- )
*buffer++ = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1);
}
#endif

View File

@ -54,6 +54,9 @@
#undef HAVE_U16_TYPEDEF #undef HAVE_U16_TYPEDEF
#undef HAVE_U32_TYPEDEF #undef HAVE_U32_TYPEDEF
/* defined if we have a /dev/random and /dev/urandom */
#undef HAVE_DEV_RANDOM
/* RSA is only compiled in if you have these files. You can use /* RSA is only compiled in if you have these files. You can use
* RSA without any restrictions, if your not in the U.S. or * RSA without any restrictions, if your not in the U.S. or
* wait until sep 20, 2000 * wait until sep 20, 2000
@ -69,6 +72,9 @@
/* The number of bytes in a unsigned short. */ /* The number of bytes in a unsigned short. */
#undef SIZEOF_UNSIGNED_SHORT #undef SIZEOF_UNSIGNED_SHORT
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strerror function. */ /* Define if you have the strerror function. */
#undef HAVE_STRERROR #undef HAVE_STRERROR
@ -78,6 +84,9 @@
/* Define if you have the strtoul function. */ /* Define if you have the strtoul function. */
#undef HAVE_STRTOUL #undef HAVE_STRTOUL
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H

View File

@ -59,10 +59,24 @@ fi
dnl Checks for programs. dnl Checks for programs.
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
case "${target}" in
i386--mingw32)
# special stuff for Windoze NT
cross_compiling=yes
CC="i386--mingw32-gcc"
CPP="i386--mingw32-gcc -E"
RANLIB="i386--mingw32-ranlib"
ac_cv_have_dev_random=no
;;
*)
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
;;
esac
AC_ARG_PROGRAM AC_ARG_PROGRAM
@ -136,18 +150,36 @@ AC_CHECK_SIZEOF(unsigned long, 32)
dnl Checks for library functions. dnl Checks for library functions.
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror strtol strtoul) AC_CHECK_FUNCS(strerror strtol strtoul stpcpy tcgetattr)
dnl check wether we have a random device
AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
[if test -c /dev/random && test -c /dev/urandom ; then
ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
if test "$ac_cv_have_dev_random" = yes; then
AC_DEFINE(HAVE_DEV_RANDOM)
fi
dnl setup assembler stuff dnl setup assembler stuff
AC_MSG_CHECKING(configure mpi)
mpi_config_done="no"
AC_CACHE_VAL(ac_cv_mpi_config_done,
[ ac_cv_mpi_config_done="$mpi_config_done" ])
if test "$ac_cv_mpi_config_done" = yes; then
AC_MSG_RESULT(done)
else
ac_cv_mpi_config_done=""
if test -f ./mpi/config.links ; then if test -f ./mpi/config.links ; then
. ./mpi/config.links . ./mpi/config.links
AC_LINK_FILES( ${mpi_ln_src}, ${mpi_ln_dst} ) AC_LINK_FILES( ${mpi_ln_src}, ${mpi_ln_dst} )
ac_cv_mpi_config_done="yes"
AC_MSG_RESULT(done)
else else
AC_MSG_RESULT(failed)
AC_MSG_ERROR([mpi/config.links missing!]) AC_MSG_ERROR([mpi/config.links missing!])
fi fi
fi
dnl checking whether we have the RSA source dnl checking whether we have the RSA source

View File

@ -11,56 +11,42 @@
# #
# Here is a list of all possible options. Not of all them make # Here is a list of all possible options. Not of all them make
# sense in an option file; consider this as a complete option # sense in an option file; consider this as a complete option
# reference # reference. Before the options you find a list of commands.
#-----------------------------------------------
#------------------- Commands ------------------
#-----------------------------------------------
# With some expections, those cannot be combined
add-key add-key
# add key to the public keyring # add key to the public keyring
armor
# create ascii armored output
batch
# batch mode: never ask
cache-all
# hold everything in memory
change-passphrase change-passphrase
# change the passphrase of your secret keyring # change the passphrase of your secret keyring
check check
# check a signature # check a signature
check-key
# check signatures on a key in the keyring
debug value|hexvalue
# set debugging flags,
debug-all
# enable full debugging
decrypt decrypt
# decrypt data (default) # decrypt data (default)
delete-key delete-key
# remove key from public keyring, # remove key from public keyring,
detach-sign edit-sig
# make a detached signature, # edit a key signature. Currently you have only the option to delete
# some signatures.
dry-run
# don't make any changes
encrypt encrypt
# (Can be combined with a "sign")
# encrypt data # encrypt data
fingerprint fingerprint
# show the fingerprints, # show the fingerprints,
gen-key gen-key
# generate a new key pair, # generate a new key pair, this is an interactive command.
gen-prime gen-prime
# Generate a prime. # Generate a prime.
@ -68,40 +54,17 @@ gen-prime
# this size # this size
# With two arguments: Generate a prime, usable for DL algorithms. # With two arguments: Generate a prime, usable for DL algorithms.
# With three arguments: same as above, but a third argument indicates # With three arguments: same as above, but a third argument indicates
# taht a generator should also be calculated. # that a generator should also be calculated.
keyring filename list-packets
# add this filename to the list of keyrings # List only the sequence of packets"},
local-user user-string
# use this user-string to sign or decrypt
no
# assume no on most questions
no-armor
# Assume the input data is not in ascii armored format.
no-default-keyring
# Do not add the default keyrings to the list of keyrings
options filename
# Ignored in option files.
output filename
# use filename for output
print-mds print-mds
# print all message digests of all give filenames # print all message digests of all give filenames
remote-user
# use this user-id for encryption"
secret-keyring filename
# add filename to the list of secret keyrings
sign sign
# (Can be combined with a "encrypt")
# make a signature # make a signature
sign-key sign-key
@ -122,9 +85,104 @@ symmetric
# encrypt the input only with the symmetric (conventional) cipher. # encrypt the input only with the symmetric (conventional) cipher.
# This asks for a passphrase. # This asks for a passphrase.
test test
# Used for testing some parts of the program # Used for testing some parts of the program
#----------------------------------------------
#------ Options without a long form ----------
#----------------------------------------------
-k
# List keyrings.
# Without arguments, all default public keyrings are listed
# With one argument, this keyring is listed.
#
# -kv is the same as -k
# -kvv list the signatures with every key
# -kvvv additional checks all signatures
# -kvc list fingerprints
# -kvvc list fingerprints and signatures
# Note that this is a kludge, to emulate the strange pgp syntax;
# combining it with other options may give other outputs.
-z n
# Set compress level to n.
# n = 0 disables compresson. Default compress level depends on
# the local zlib (6).
#-----------------------------------------------
#------------------- Options -------------------
#-----------------------------------------------
armor
# create ascii armored output
batch
# batch mode: never ask
cache-all
# hold everything in memory
check-key
# check signatures on a key in the keyring
debug value|hexvalue
# set debugging flags,
debug-all
# enable full debugging
detach-sign
# make a detached signature,
dry-run
# don't make any changes
keyring filename
# add this filename to the list of keyrings
local-user user-string
# use this user-string to sign or decrypt
no
# assume no on most questions
no-armor
# Assume the input data is not in ascii armored format.
no-default-keyring
# Do not add the default keyrings to the list of keyrings
no-greeting
# suppress the initial copyright etc. messages but do not enter batch mode.
options filename
# Ignored in option files.
output filename
# use filename for output
passphrase-fd n
# Read the passphrase from file with the descriptor n. If you use
# 0 for n, the passphrase will be read from stdin. This can only be used
# if only one passphrase is supplied.
remote-user
# use this user-id for encryption"
secret-keyring filename
# add filename to the list of secret keyrings
verbose verbose
# Give more informations suring processing. If used 2 times, the input data # Give more informations suring processing. If used 2 times, the input data
# is listed in detail. # is listed in detail.
@ -132,4 +190,3 @@ verbose
yes yes
# assume yes on most questions # assume yes on most questions

109
g10/g10.c
View File

@ -35,6 +35,15 @@
#include "cipher.h" #include "cipher.h"
#include "filter.h" #include "filter.h"
enum cmd_values { aNull = 0,
aSym, aStore, aEncr, aPrimegen, aKeygen, aSign, aSignEncr,
aPrintMDs, aSignKey, aClearsig, aListPackets, aEditSig,
aKMode, aKModeC,
aTest };
static void set_cmd( enum cmd_values *ret_cmd,
enum cmd_values new_cmd );
static void print_hex( byte *p, size_t n ); static void print_hex( byte *p, size_t n );
static void print_mds( const char *fname ); static void print_mds( const char *fname );
static void do_test(int); static void do_test(int);
@ -94,6 +103,27 @@ set_debug(void)
} }
static void
set_cmd( enum cmd_values *ret_cmd, enum cmd_values new_cmd )
{
enum cmd_values cmd = *ret_cmd;
if( !cmd || cmd == new_cmd )
cmd = new_cmd;
else if( cmd == aSign && new_cmd == aEncr )
cmd = aSignEncr;
else if( cmd == aEncr && new_cmd == aSign )
cmd = aSignEncr;
else if( cmd == aKMode && new_cmd == aSym )
cmd = aKModeC;
else {
log_error("conflicting commands\n");
exit(2);
}
*ret_cmd = cmd;
}
int int
main( int argc, char **argv ) main( int argc, char **argv )
@ -120,9 +150,9 @@ main( int argc, char **argv )
{ 'b', "detach-sign", 0, "make a detached signature"}, { 'b', "detach-sign", 0, "make a detached signature"},
{ 'e', "encrypt", 0, "encrypt data" }, { 'e', "encrypt", 0, "encrypt data" },
{ 'd', "decrypt", 0, "decrypt data (default)" }, { 'd', "decrypt", 0, "decrypt data (default)" },
/*{ 'c', "check", 0, "check a signature (default)" }, */
{ 'u', "local-user",2, "use this user-id to sign or decrypt" }, { 'u', "local-user",2, "use this user-id to sign or decrypt" },
{ 'r', "remote-user", 2, "use this user-id for encryption" }, { 'r', "remote-user", 2, "use this user-id for encryption" },
{ 'k', NULL , 0, "list keys" },
{ 510, "debug" ,4|16, "set debugging flags" }, { 510, "debug" ,4|16, "set debugging flags" },
{ 511, "debug-all" ,0, "enable full debugging"}, { 511, "debug-all" ,0, "enable full debugging"},
{ 512, "cache-all" ,0, "hold everything in memory"}, { 512, "cache-all" ,0, "hold everything in memory"},
@ -144,9 +174,6 @@ main( int argc, char **argv )
ARGPARSE_ARGS pargs; ARGPARSE_ARGS pargs;
IOBUF a; IOBUF a;
int rc; int rc;
enum { aNull, aSym, aStore, aEncr, aPrimegen, aKeygen, aSign, aSignEncr,
aTest, aPrintMDs, aSignKey, aClearsig, aListPackets, aEditSig,
} action = aNull;
int orig_argc; int orig_argc;
char **orig_argv; char **orig_argv;
const char *fname, *fname_print; const char *fname, *fname_print;
@ -163,6 +190,7 @@ main( int argc, char **argv )
int errors=0; int errors=0;
int default_keyring = 1; int default_keyring = 1;
int greeting = 1; int greeting = 1;
enum cmd_values cmd = 0;
opt.compress = -1; /* defaults to standard compress level */ opt.compress = -1; /* defaults to standard compress level */
@ -219,13 +247,13 @@ main( int argc, char **argv )
break; break;
case 'z': opt.compress = pargs.r.ret_int; break; case 'z': opt.compress = pargs.r.ret_int; break;
case 'a': opt.armor = 1; opt.no_armor=0; break; case 'a': opt.armor = 1; opt.no_armor=0; break;
case 'c': action = aSym; break; case 'c': set_cmd( &cmd , aSym); break;
case 'o': opt.outfile = pargs.r.ret_str; break; case 'o': opt.outfile = pargs.r.ret_str; break;
case 'e': action = action == aSign? aSignEncr : aEncr; break; case 'e': set_cmd( &cmd, aEncr); break;
case 'b': detached_sig = 1; case 'b': detached_sig = 1;
/* fall trough */ /* fall trough */
case 's': action = action == aEncr? aSignEncr : aSign; break; case 's': set_cmd( &cmd, aSign ); break;
case 't': action = aClearsig; break; case 't': set_cmd( &cmd , aClearsig); break;
case 'u': /* store the local users */ case 'u': /* store the local users */
sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str)); sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str));
strcpy(sl->d, pargs.r.ret_str); strcpy(sl->d, pargs.r.ret_str);
@ -238,21 +266,22 @@ main( int argc, char **argv )
sl->next = remusr; sl->next = remusr;
remusr = sl; remusr = sl;
break; break;
case 'k': set_cmd( &cmd, aKMode ); break;
case 500: opt.batch = 1; greeting = 0; break; case 500: opt.batch = 1; greeting = 0; break;
case 501: opt.answer_yes = 1; break; case 501: opt.answer_yes = 1; break;
case 502: opt.answer_no = 1; break; case 502: opt.answer_no = 1; break;
case 503: action = aKeygen; break; case 503: set_cmd( &cmd, aKeygen); break;
case 506: action = aSignKey; break; case 506: set_cmd( &cmd, aSignKey); break;
case 507: action = aStore; break; case 507: set_cmd( &cmd, aStore); break;
case 508: opt.check_sigs = 1; opt.list_sigs = 1; break; case 508: opt.check_sigs = 1; opt.list_sigs = 1; break;
case 509: add_keyring(pargs.r.ret_str); nrings++; break; case 509: add_keyring(pargs.r.ret_str); nrings++; break;
case 510: opt.debug |= pargs.r.ret_ulong; break; case 510: opt.debug |= pargs.r.ret_ulong; break;
case 511: opt.debug = ~0; break; case 511: opt.debug = ~0; break;
case 512: opt.cache_all = 1; break; case 512: opt.cache_all = 1; break;
case 513: action = aPrimegen; break; case 513: set_cmd( &cmd, aPrimegen); break;
case 514: action = aTest; break; case 514: set_cmd( &cmd, aTest); break;
case 515: opt.fingerprint = 1; break; case 515: opt.fingerprint = 1; break;
case 516: action = aPrintMDs; break; case 516: set_cmd( &cmd, aPrintMDs); break;
case 517: add_secret_keyring(pargs.r.ret_str); sec_nrings++; break; case 517: add_secret_keyring(pargs.r.ret_str); sec_nrings++; break;
case 518: case 518:
/* config files may not be nested (silently ignore them) */ /* config files may not be nested (silently ignore them) */
@ -264,10 +293,10 @@ main( int argc, char **argv )
break; break;
case 519: opt.no_armor=1; opt.armor=0; break; case 519: opt.no_armor=1; opt.armor=0; break;
case 520: default_keyring = 0; break; case 520: default_keyring = 0; break;
case 521: action = aListPackets; break; case 521: set_cmd( &cmd, aListPackets); break;
case 522: greeting = 0; break; case 522: greeting = 0; break;
case 523: set_passphrase_fd( pargs.r.ret_int ); break; case 523: set_passphrase_fd( pargs.r.ret_int ); break;
case 524: action = aEditSig; break; case 524: set_cmd( &cmd, aEditSig); break;
default : errors++; pargs.err = configfp? 1:2; break; default : errors++; pargs.err = configfp? 1:2; break;
} }
} }
@ -282,6 +311,19 @@ main( int argc, char **argv )
exit(2); exit(2);
set_debug(); set_debug();
if( cmd == aKMode || cmd == aKModeC ) { /* kludge to be compatible to pgp */
if( cmd == aKModeC ) {
opt.fingerprint = 1;
cmd = aKMode;
}
opt.list_sigs = 0;
if( opt.verbose > 2 )
opt.check_sigs++;
if( opt.verbose > 1 )
opt.list_sigs++;
opt.verbose = opt.verbose > 1;
}
if( opt.verbose > 1 ) if( opt.verbose > 1 )
set_packet_list_mode(1); set_packet_list_mode(1);
if( greeting ) { if( greeting ) {
@ -310,7 +352,7 @@ main( int argc, char **argv )
fname = NULL; fname = NULL;
} }
switch( action ) { switch( cmd ) {
case aStore: /* only store the file */ case aStore: /* only store the file */
if( argc > 1 ) if( argc > 1 )
usage(1); usage(1);
@ -364,6 +406,37 @@ main( int argc, char **argv )
log_error("edit_keysig('%s'): %s\n", fname_print, g10_errstr(rc) ); log_error("edit_keysig('%s'): %s\n", fname_print, g10_errstr(rc) );
break; break;
case aKMode: /* list keyring */
if( !argc ) { /* list the default public keyrings */
int i, seq=0;
const char *s;
while( s=get_keyring(seq++) ) {
if( !(a = iobuf_open(s)) ) {
log_error("can't open '%s'\n", s);
continue;
}
if( seq > 1 )
putchar('\n');
printf("%s\n", s );
for(i=strlen(s); i; i-- )
putchar('-');
putchar('\n');
proc_packets( a );
iobuf_close(a);
}
}
else if( argc == 1) { /* list the given keyring */
if( !(a = iobuf_open(fname)) )
log_fatal("can't open '%s'\n", fname_print);
proc_packets( a );
iobuf_close(a);
}
else
usage(1);
break;
case aPrimegen: case aPrimegen:
if( argc == 1 ) { if( argc == 1 ) {
@ -417,7 +490,7 @@ main( int argc, char **argv )
memset( &afx, 0, sizeof afx); memset( &afx, 0, sizeof afx);
iobuf_push_filter( a, armor_filter, &afx ); iobuf_push_filter( a, armor_filter, &afx );
} }
if( action == aListPackets ) { if( cmd == aListPackets ) {
set_packet_list_mode(1); set_packet_list_mode(1);
opt.list_packets=1; opt.list_packets=1;
} }

View File

@ -88,6 +88,21 @@ add_keyring( const char *name )
log_error("keyblock resource '%s': %s\n", name, g10_errstr(rc) ); log_error("keyblock resource '%s': %s\n", name, g10_errstr(rc) );
} }
/****************
* Get the name of the keyrings, start with a sequence number of 0.
*/
const char *
get_keyring( int sequence )
{
STRLIST sl;
for(sl = keyrings; sl && sequence; sl = sl->next, sequence-- )
;
return sl? sl->d : NULL;
}
void void
add_secret_keyring( const char *name ) add_secret_keyring( const char *name )
{ {

View File

@ -89,6 +89,7 @@ int make_dek_from_passphrase( DEK *dek, int mode );
/*-- getkey.c --*/ /*-- getkey.c --*/
void add_keyring( const char *name ); void add_keyring( const char *name );
const char *get_keyring( int sequence );
void add_secret_keyring( const char *name ); void add_secret_keyring( const char *name );
void cache_public_cert( PKT_public_cert *pkc ); void cache_public_cert( PKT_public_cert *pkc );
void cache_user_id( PKT_user_id *uid, u32 *keyid ); void cache_user_id( PKT_user_id *uid, u32 *keyid );

View File

@ -44,9 +44,9 @@
#ifndef HAVE_U16_TYPEDEF #ifndef HAVE_U16_TYPEDEF
#undef u16 /* maybe there is a macro with this name */ #undef u16 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 2 #if SIZEOF_UNSIGNED_INT == 16
typedef unsigned int u16; typedef unsigned int u16;
#elif SIZEOF_UNSIGNED_SHORT == 2 #elif SIZEOF_UNSIGNED_SHORT == 16
typedef unsigned short u16; typedef unsigned short u16;
#else #else
#error no typedef for u16 #error no typedef for u16
@ -56,9 +56,9 @@
#ifndef HAVE_U32_TYPEDEF #ifndef HAVE_U32_TYPEDEF
#undef u32 /* maybe there is a macro with this name */ #undef u32 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 4 #if SIZEOF_UNSIGNED_INT == 32
typedef unsigned long u32; typedef unsigned long u32;
#elif SIZEOF_UNSIGNED_LONG == 4 #elif SIZEOF_UNSIGNED_LONG == 32
typedef unsigned int u32; typedef unsigned int u32;
#else #else
#error no typedef for u32 #error no typedef for u32

View File

@ -93,6 +93,9 @@ void free_strlist( STRLIST sl );
#define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0) #define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0)
char *memistr( char *buf, size_t buflen, const char *sub ); char *memistr( char *buf, size_t buflen, const char *sub );
#define stricmp(a,b) strcasecmp((a),(b)) #define stricmp(a,b) strcasecmp((a),(b))
#ifndef HAVE_STPCPY
char *stpcpy(char *a,const char *b);
#endif
/******** some macros ************/ /******** some macros ************/

111
scripts/config.sub vendored
View File

@ -12,7 +12,7 @@
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
@ -34,7 +34,7 @@
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software. # that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations # Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish # it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless # a failure to support a valid configuration from a meaningless
# configuration. # configuration.
@ -102,15 +102,15 @@ case $os in
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-scout) # CYGNUS LOCAL -scout) # CYGNUS LOCAL
;; ;;
-wrs) # CYGNUS LOCAL -wrs) # CYGNUS LOCAL
os=vxworks os=vxworks
basic_machine=$1 basic_machine=$1
;; ;;
-hiuxmpp) -hiuxmpp)
os=-hiuxmpp os=-hiuxmpp
;; ;;
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
@ -228,7 +228,7 @@ case $basic_machine in
;; ;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
386bsd) # CYGNUS LOCAL 386bsd) # CYGNUS LOCAL
basic_machine=i386-unknown basic_machine=i386-unknown
os=-bsd os=-bsd
;; ;;
@ -369,10 +369,10 @@ case $basic_machine in
basic_machine=tron-gmicro basic_machine=tron-gmicro
os=-sysv os=-sysv
;; ;;
hiuxmpp) hiuxmpp)
basic_machine=hppa1.1-hitachi basic_machine=hppa1.1-hitachi
os=-hiuxmpp os=-hiuxmpp
;; ;;
h3050r* | hiux*) h3050r* | hiux*)
basic_machine=hppa1.1-hitachi basic_machine=hppa1.1-hitachi
os=-hiuxwe2 os=-hiuxwe2
@ -404,22 +404,22 @@ case $basic_machine in
basic_machine=m68k-hp basic_machine=m68k-hp
os=-hpux os=-hpux
;; ;;
w89k-*) # CYGNUS LOCAL w89k-*) # CYGNUS LOCAL
basic_machine=hppa1.1-winbond basic_machine=hppa1.1-winbond
os=-proelf os=-proelf
;; ;;
op50n-*) # CYGNUS LOCAL op50n-*) # CYGNUS LOCAL
basic_machine=hppa1.1-oki basic_machine=hppa1.1-oki
os=-proelf os=-proelf
;; ;;
op60c-*) # CYGNUS LOCAL op60c-*) # CYGNUS LOCAL
basic_machine=hppa1.1-oki basic_machine=hppa1.1-oki
os=-proelf os=-proelf
;; ;;
hppro) # CYGNUS LOCAL hppro) # CYGNUS LOCAL
basic_machine=hppa1.1-hp basic_machine=hppa1.1-hp
os=-proelf os=-proelf
;; ;;
hp9k2[0-9][0-9] | hp9k31[0-9]) hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp basic_machine=m68000-hp
;; ;;
@ -542,7 +542,7 @@ case $basic_machine in
basic_machine=mips-sony basic_machine=mips-sony
os=-newsos os=-newsos
;; ;;
necv70) # CYGNUS LOCAL necv70) # CYGNUS LOCAL
basic_machine=v70-nec basic_machine=v70-nec
os=-sysv os=-sysv
;; ;;
@ -571,7 +571,7 @@ case $basic_machine in
basic_machine=i960-intel basic_machine=i960-intel
os=-nindy os=-nindy
;; ;;
mon960) # CYGNUS LOCAL mon960) # CYGNUS LOCAL
basic_machine=i960-intel basic_machine=i960-intel
os=-mon960 os=-mon960
;; ;;
@ -600,7 +600,7 @@ case $basic_machine in
pbb) pbb)
basic_machine=m68k-tti basic_machine=m68k-tti
;; ;;
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pentium | p5) pentium | p5)
@ -629,19 +629,19 @@ case $basic_machine in
power) basic_machine=rs6000-ibm power) basic_machine=rs6000-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
;; ;;
ppcle-* | powerpclittle-*) ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ps2) ps2)
basic_machine=i386-ibm basic_machine=i386-ibm
;; ;;
rom68k) # CYGNUS LOCAL rom68k) # CYGNUS LOCAL
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
;; ;;
@ -673,7 +673,7 @@ case $basic_machine in
spur) spur)
basic_machine=spur-unknown basic_machine=spur-unknown
;; ;;
st2000) # CYGNUS LOCAL st2000) # CYGNUS LOCAL
basic_machine=m68k-tandem basic_machine=m68k-tandem
;; ;;
stratus) # CYGNUS LOCAL stratus) # CYGNUS LOCAL
@ -735,7 +735,7 @@ case $basic_machine in
basic_machine=a29k-nyu basic_machine=a29k-nyu
os=-sym1 os=-sym1
;; ;;
v810 | necv810) # CYGNUS LOCAL v810 | necv810) # CYGNUS LOCAL
basic_machine=v810-nec basic_machine=v810-nec
os=-none os=-none
;; ;;
@ -748,8 +748,8 @@ case $basic_machine in
os=-vms os=-vms
;; ;;
vpp*|vx|vx-*) vpp*|vx|vx-*)
basic_machine=f301-fujitsu basic_machine=f301-fujitsu
;; ;;
vxworks960) vxworks960)
basic_machine=i960-wrs basic_machine=i960-wrs
os=-vxworks os=-vxworks
@ -763,14 +763,14 @@ case $basic_machine in
os=-vxworks os=-vxworks
;; ;;
w65*) # CYGNUS LOCAL w65*) # CYGNUS LOCAL
basic_machine=w65-wdc basic_machine=w65-wdc
os=-none os=-none
;; ;;
xmp) xmp)
basic_machine=xmp-cray basic_machine=xmp-cray
os=-unicos os=-unicos
;; ;;
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
z8k-*-coff) # CYGNUS LOCAL z8k-*-coff) # CYGNUS LOCAL
@ -818,7 +818,7 @@ case $basic_machine in
sparc) sparc)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
basic_machine=cydra-cydrome basic_machine=cydra-cydrome
;; ;;
orion) orion)
@ -856,8 +856,8 @@ esac
if [ x"$os" != x"" ] if [ x"$os" != x"" ]
then then
case $os in case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
@ -886,7 +886,7 @@ case $os in
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv* | -mingw32* ) | -linux-gnu* | -uxpv* | -mingw32* )
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
# CYGNUS LOCAL # CYGNUS LOCAL
@ -929,7 +929,7 @@ case $os in
os=-sysv os=-sysv
;; ;;
-ns2 ) -ns2 )
os=-nextstep2 os=-nextstep2
;; ;;
# Preserve the version number of sinix5. # Preserve the version number of sinix5.
-sinix5.*) -sinix5.*)
@ -969,6 +969,7 @@ case $os in
;; ;;
*) *)
# Get rid of the `-' at the beginning of $os. # Get rid of the `-' at the beginning of $os.
echo "os=($os)"
os=`echo $os | sed 's/[^-]*-//'` os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1 exit 1
@ -993,7 +994,7 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
pdp11-*) pdp11-*)
os=-none os=-none
;; ;;
*-dec | vax-*) *-dec | vax-*)
@ -1017,9 +1018,9 @@ case $basic_machine in
mips*-cisco) # CYGNUS LOCAL mips*-cisco) # CYGNUS LOCAL
os=-elf os=-elf
;; ;;
mips*-*) # CYGNUS LOCAL mips*-*) # CYGNUS LOCAL
os=-elf os=-elf
;; ;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3 os=-sysv3
;; ;;
@ -1083,19 +1084,19 @@ case $basic_machine in
*-next) *-next)
os=-nextstep3 os=-nextstep3
;; ;;
*-gould) *-gould)
os=-sysv os=-sysv
;; ;;
*-highlevel) *-highlevel)
os=-bsd os=-bsd
;; ;;
*-encore) *-encore)
os=-bsd os=-bsd
;; ;;
*-sgi) *-sgi)
os=-irix os=-irix
;; ;;
*-siemens) *-siemens)
os=-sysv4 os=-sysv4
;; ;;
*-masscomp) *-masscomp)
@ -1107,7 +1108,7 @@ case $basic_machine in
*-rom68k) # CYGNUS LOCAL *-rom68k) # CYGNUS LOCAL
os=-coff os=-coff
;; ;;
*-*bug) # CYGNUS LOCAL *-*bug) # CYGNUS LOCAL
os=-coff os=-coff
;; ;;
*-apple) # CYGNUS LOCAL *-apple) # CYGNUS LOCAL
@ -1134,7 +1135,7 @@ case $basic_machine in
-aix*) -aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) # CYGNUS LOCAL -beos*) # CYGNUS LOCAL
vendor=be vendor=be
;; ;;
-hpux*) -hpux*)

View File

@ -61,3 +61,20 @@ memistr( char *buf, size_t buflen, const char *sub )
return NULL ; return NULL ;
} }
/*********************************************
********** missing string functions *********
*********************************************/
#ifndef HAVE_STPCPY
char *
stpcpy(char *a,const char *b)
{
while( *b )
*a++ = *b++;
*a = 0;
return (char*)a;
}
#endif

View File

@ -23,7 +23,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <termios.h> #ifdef HAVE_TCGETATTR
#include <termios.h>
#endif
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include "util.h" #include "util.h"
@ -94,7 +96,9 @@ do_get( const char *prompt, int hidden )
byte cbuf[1]; byte cbuf[1];
int c, n, i; int c, n, i;
FILE *fp; FILE *fp;
#ifdef HAVE_TCGETATTR
struct termios termsave; struct termios termsave;
#endif
if( !ttyfp ) if( !ttyfp )
init_ttyfp(); init_ttyfp();
@ -105,6 +109,7 @@ do_get( const char *prompt, int hidden )
i = 0; i = 0;
if( hidden ) { if( hidden ) {
#ifdef HAVE_TCGETATTR
struct termios term; struct termios term;
if( tcgetattr(fileno(ttyfp), &termsave) ) if( tcgetattr(fileno(ttyfp), &termsave) )
@ -113,6 +118,7 @@ do_get( const char *prompt, int hidden )
term.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); term.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
if( tcsetattr( fileno(ttyfp), TCSAFLUSH, &term ) ) if( tcsetattr( fileno(ttyfp), TCSAFLUSH, &term ) )
log_fatal("tcsetattr() failed: %s\n", strerror(errno) ); log_fatal("tcsetattr() failed: %s\n", strerror(errno) );
#endif
} }
/* fixme: How can we avoid that the \n is echoed w/o disabling /* fixme: How can we avoid that the \n is echoed w/o disabling
@ -132,9 +138,12 @@ do_get( const char *prompt, int hidden )
buf[i++] = c; buf[i++] = c;
} }
if( hidden ) { if( hidden ) {
#ifdef HAVE_TCGETATTR
if( tcsetattr(fileno(ttyfp), TCSAFLUSH, &termsave) ) if( tcsetattr(fileno(ttyfp), TCSAFLUSH, &termsave) )
log_error("tcsetattr() failed: %s\n", strerror(errno) ); log_error("tcsetattr() failed: %s\n", strerror(errno) );
#endif
} }
buf[i] = 0; buf[i] = 0;
return buf; return buf;