diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 4 | ||||
-rw-r--r-- | util/errors.c | 89 | ||||
-rw-r--r-- | util/logger.c | 5 | ||||
-rw-r--r-- | util/secmem.c | 4 | ||||
-rw-r--r-- | util/strgutil.c | 26 |
5 files changed, 70 insertions, 58 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 4eb7b9697..05c624430 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +Tue Oct 6 09:53:56 1998 Werner Koch ([email protected]) + + * strgutil.c (memicmp): Add HAVE_MEMICMP. + Mon Sep 21 19:45:01 1998 Werner Koch (wk@(none)) * secmem.c: New flags to allow suspend/resume of warnings. diff --git a/util/errors.c b/util/errors.c index dc3f7e811..b4db10b17 100644 --- a/util/errors.c +++ b/util/errors.c @@ -24,6 +24,7 @@ #include <stdarg.h> #include "errors.h" +#include "i18n.h" #ifndef HAVE_STRERROR char * @@ -50,52 +51,52 @@ g10_errstr( int err ) switch( err ) { case -1: p = "eof"; break; case 0: p = "okay"; break; - X(GENERAL, "General error") - X(UNKNOWN_PACKET, "Unknown packet type") - X(UNKNOWN_VERSION,"Unknown version") - X(PUBKEY_ALGO ,"Unknown pubkey algorithm") - X(DIGEST_ALGO ,"Unknown digest algorithm") - X(BAD_PUBKEY ,"Bad public key") - X(BAD_SECKEY ,"Bad secret key") - X(BAD_SIGN ,"Bad signature") - X(CHECKSUM , "Checksum error") - X(BAD_PASS , "Bad passphrase") - X(NO_PUBKEY ,"Public key not found") - X(CIPHER_ALGO ,"Unknown cipher algorithm") - X(KEYRING_OPEN ,"Can't open the keyring") - X(INVALID_PACKET ,"Invalid packet") - X(INVALID_ARMOR ,"Invalid armor") - X(NO_USER_ID ,"No such user id") - X(NO_SECKEY ,"Secret key not available") - X(WRONG_SECKEY ,"Wrong secret key used") - X(UNSUPPORTED ,"Not supported") - X(BAD_KEY ,"Bad key") - X(READ_FILE ,"File read error") - X(WRITE_FILE ,"File write error") - X(COMPR_ALGO ,"Unknown compress algorithm") - X(OPEN_FILE ,"File open error") - X(CREATE_FILE ,"File create error") - X(PASSPHRASE ,"Invalid passphrase") - X(NI_PUBKEY ,"Unimplemented pubkey algorithm") - X(NI_CIPHER ,"Unimplemented cipher algorithm") - X(SIG_CLASS ,"Unknown signature class") - X(TRUSTDB ,"Trust database error") - X(BAD_MPI ,"Bad MPI") - X(RESOURCE_LIMIT ,"Resource limit") - X(INV_KEYRING ,"Invalid keyring") - X(BAD_CERT ,"Bad certificate") - X(INV_USER_ID ,"Malformed user id") - X(CLOSE_FILE ,"File close error") - X(RENAME_FILE ,"File rename error") - X(DELETE_FILE ,"File delete error") - X(UNEXPECTED ,"Unexpected data") - X(TIME_CONFLICT ,"Timestamp conflict") - X(WR_PUBKEY_ALGO ,"Unusable pubkey algorithm") - X(FILE_EXISTS ,"File exists") - X(WEAK_KEY ,"Weak key") + X(GENERAL, N_("General error")) + X(UNKNOWN_PACKET, N_("Unknown packet type")) + X(UNKNOWN_VERSION,N_("Unknown version")) + X(PUBKEY_ALGO ,N_("Unknown pubkey algorithm")) + X(DIGEST_ALGO ,N_("Unknown digest algorithm")) + X(BAD_PUBKEY ,N_("Bad public key")) + X(BAD_SECKEY ,N_("Bad secret key")) + X(BAD_SIGN ,N_("Bad signature")) + X(CHECKSUM , N_("Checksum error")) + X(BAD_PASS , N_("Bad passphrase")) + X(NO_PUBKEY ,N_("Public key not found")) + X(CIPHER_ALGO ,N_("Unknown cipher algorithm")) + X(KEYRING_OPEN ,N_("Can't open the keyring")) + X(INVALID_PACKET ,N_("Invalid packet")) + X(INVALID_ARMOR ,N_("Invalid armor")) + X(NO_USER_ID ,N_("No such user id")) + X(NO_SECKEY ,N_("Secret key not available")) + X(WRONG_SECKEY ,N_("Wrong secret key used")) + X(UNSUPPORTED ,N_("Not supported")) + X(BAD_KEY ,N_("Bad key")) + X(READ_FILE ,N_("File read error")) + X(WRITE_FILE ,N_("File write error")) + X(COMPR_ALGO ,N_("Unknown compress algorithm")) + X(OPEN_FILE ,N_("File open error")) + X(CREATE_FILE ,N_("File create error")) + X(PASSPHRASE ,N_("Invalid passphrase")) + X(NI_PUBKEY ,N_("Unimplemented pubkey algorithm")) + X(NI_CIPHER ,N_("Unimplemented cipher algorithm")) + X(SIG_CLASS ,N_("Unknown signature class")) + X(TRUSTDB ,N_("Trust database error")) + X(BAD_MPI ,N_("Bad MPI")) + X(RESOURCE_LIMIT ,N_("Resource limit")) + X(INV_KEYRING ,N_("Invalid keyring")) + X(BAD_CERT ,N_("Bad certificate")) + X(INV_USER_ID ,N_("Malformed user id")) + X(CLOSE_FILE ,N_("File close error")) + X(RENAME_FILE ,N_("File rename error")) + X(DELETE_FILE ,N_("File delete error")) + X(UNEXPECTED ,N_("Unexpected data")) + X(TIME_CONFLICT ,N_("Timestamp conflict")) + X(WR_PUBKEY_ALGO ,N_("Unusable pubkey algorithm")) + X(FILE_EXISTS ,N_("File exists")) + X(WEAK_KEY ,N_("Weak key")) default: p = buf; sprintf(buf, "g10err=%d", err); break; } #undef X - return p; + return _(p); } diff --git a/util/logger.c b/util/logger.c index aabeaec7d..60f59da8a 100644 --- a/util/logger.c +++ b/util/logger.c @@ -24,6 +24,7 @@ #include <stdarg.h> #include "util.h" +#include "i18n.h" static char pidstring[15]; static char *pgm_name; @@ -173,13 +174,13 @@ g10_log_bug( const char *fmt, ... ) void g10_log_bug0( const char *file, int line, const char *func ) { - log_bug("you found a bug ... (%s:%d:%s)\n", file, line, func ); + log_bug(_("Ohhhh jeeee ... this is a bug (%s:%d:%s)\n"), file, line, func ); } #else void g10_log_bug0( const char *file, int line ) { - log_bug("you found a bug ... (%s:%d)\n", file, line); + log_bug(_("you found a bug ... (%s:%d)\n"), file, line); } #endif diff --git a/util/secmem.c b/util/secmem.c index 1f1616a18..ffcb45674 100644 --- a/util/secmem.c +++ b/util/secmem.c @@ -160,7 +160,7 @@ init_pool( size_t n) } #endif if( pool == (void*)-1 ) - log_error("can't mmap pool of %u bytes: %s - using malloc\n", + log_info("can't mmap pool of %u bytes: %s - using malloc\n", (unsigned)poolsize, strerror(errno)); else { pool_is_mmapped = 1; @@ -217,6 +217,7 @@ void secmem_init( size_t n ) { if( !n ) { + #ifndef __MINGW32__ uid_t uid; disable_secmem=1; @@ -225,6 +226,7 @@ secmem_init( size_t n ) if( setuid( uid ) ) log_fatal("failed to drop setuid\n" ); } + #endif } else { if( n < DEFAULT_POOLSIZE ) diff --git a/util/strgutil.c b/util/strgutil.c index d19ba6e54..809b0c3f2 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -92,17 +92,6 @@ strlist_last( STRLIST node ) - -int -memicmp( const char *a, const char *b, size_t n ) -{ - for( ; n; n--, a++, b++ ) - if( *a != *b && toupper(*(const byte*)a) != toupper(*(const byte*)b) ) - return *(const byte *)a - *(const byte*)b; - return 0; -} - - /**************** * look for the substring SUB in buffer and return a pointer to that * substring in BUF or NULL if not found. @@ -217,3 +206,18 @@ strlwr(char *s) } #endif +/**************** + * mingw32/cpd has a memicmp() + */ +#ifndef HAVE_MEMICMP +int +memicmp( const char *a, const char *b, size_t n ) +{ + for( ; n; n--, a++, b++ ) + if( *a != *b && toupper(*(const byte*)a) != toupper(*(const byte*)b) ) + return *(const byte *)a - *(const byte*)b; + return 0; +} +#endif + + |