From 3a23c4230bc61f905a316c2df9116d871fd9029f Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sat, 24 May 2003 21:50:33 +0000 Subject: [PATCH] * armor.c, g10.c, kbnode.c, misc.c, pkclist.c, sign.c, build-packet.c, getkey.c, keydb.c, openfile.c, plaintext.c, status.c, gpgv.c, keygen.c, options.h, sig-check.c, tdbio.h, encode.c, mainproc.c, parse-packet.c, signal.c, textfilter.c: Edit all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. --- g10/ChangeLog | 10 +++++ g10/armor.c | 20 +++++----- g10/build-packet.c | 12 +++--- g10/encode.c | 8 ++-- g10/g10.c | 36 ++++++++--------- g10/getkey.c | 18 ++++----- g10/gpgv.c | 28 ++++++------- g10/kbnode.c | 6 +-- g10/keydb.c | 3 -- g10/keygen.c | 4 +- g10/mainproc.c | 4 +- g10/misc.c | 20 +++++----- g10/openfile.c | 12 +++--- g10/options.h | 10 ++--- g10/parse-packet.c | 4 +- g10/pkclist.c | 12 +++--- g10/plaintext.c | 7 +--- g10/sig-check.c | 6 +-- g10/sign.c | 8 ++-- g10/signal.c | 40 +++++++++---------- g10/status.c | 99 +++++++++++++++++++++++----------------------- g10/tdbio.h | 2 +- g10/textfilter.c | 11 +++--- 23 files changed, 190 insertions(+), 190 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 92135de49..77f09b6b1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,13 @@ +2003-05-24 David Shaw + + * armor.c, g10.c, kbnode.c, misc.c, pkclist.c, sign.c, + build-packet.c, getkey.c, keydb.c, openfile.c, plaintext.c, + status.c, gpgv.c, keygen.c, options.h, sig-check.c, tdbio.h, + encode.c, mainproc.c, parse-packet.c, signal.c, textfilter.c: Edit + all preprocessor instructions to remove whitespace before the '#'. + This is not required by C89, but there are some compilers out + there that don't like it. + 2003-05-21 David Shaw * trustdb.h, trustdb.c (is_disabled), gpgv.c (is_disabled): Rename diff --git a/g10/armor.c b/g10/armor.c index 98559d0c9..f00742295 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -39,9 +39,9 @@ #include "i18n.h" #ifdef HAVE_DOSISH_SYSTEM - #define LF "\r\n" +#define LF "\r\n" #else - #define LF "\n" +#define LF "\n" #endif #define MAX_LINELEN 20000 @@ -773,7 +773,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, /* FIXME: Here we should emit another control packet, * so that we know in mainproc that we are processing * a clearsign message */ - #if 0 +#if 0 for(rc=0;!rc;) { rc = 0 /*check_trailer( &fhdr, c )*/; if( !rc ) { @@ -791,7 +791,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, log_error(_("error in trailer line\n")); rc = G10ERR_INVALID_ARMOR; } - #endif +#endif } } } @@ -817,14 +817,14 @@ armor_filter( void *opaque, int control, int idx, idx2; size_t n=0; u32 crc; - #if 0 +#if 0 static FILE *fp ; if( !fp ) { fp = fopen("armor.out", "w"); assert(fp); } - #endif +#endif if( DBG_FILTER ) log_debug("armor-filter: control: %d\n", control ); @@ -921,11 +921,11 @@ armor_filter( void *opaque, int control, } else rc = radix64_read( afx, a, &n, buf, size ); - #if 0 +#if 0 if( n ) if( fwrite(buf, n, 1, fp ) != 1 ) BUG(); - #endif +#endif *ret_len = n; } else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) { @@ -960,10 +960,10 @@ armor_filter( void *opaque, int control, if ( afx->hdrlines ) { for ( s = afx->hdrlines; *s; s++ ) { - #ifdef HAVE_DOSISH_SYSTEM +#ifdef HAVE_DOSISH_SYSTEM if ( *s == '\n' ) iobuf_put( a, '\r'); - #endif +#endif iobuf_put(a, *s ); } } diff --git a/g10/build-packet.c b/g10/build-packet.c index 8239e76b5..86aa07dc2 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -266,12 +266,12 @@ hash_public_key( MD_HANDLE md, PKT_public_key *pk ) ulong pktlen; int c; IOBUF a = iobuf_temp(); - #if 0 +#if 0 FILE *fp = fopen("dump.pk", "a"); int i=0; fprintf(fp, "\nHashing PK (v%d):\n", pk->version); - #endif +#endif /* build the packet */ init_packet(&pkt); @@ -316,19 +316,19 @@ hash_public_key( MD_HANDLE md, PKT_public_key *pk ) } /* hash the packet body */ while( (c=iobuf_get(a)) != -1 ) { - #if 0 +#if 0 fprintf( fp," %02x", c ); if( (++i == 24) ) { putc('\n', fp); i=0; } - #endif +#endif md_putc( md, c ); } - #if 0 +#if 0 putc('\n', fp); fclose(fp); - #endif +#endif iobuf_cancel(a); } diff --git a/g10/encode.c b/g10/encode.c index 6468ccfff..66ce57c35 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -240,14 +240,14 @@ encode_simple( const char *filename, int mode, int compat ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - #ifdef ENABLE_COMMENT_PACKETS +#ifdef ENABLE_COMMENT_PACKETS else { write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); if( opt.comment_string ) write_comment( out, opt.comment_string ); } - #endif +#endif if( s2k && !RFC1991 ) { PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc + seskeylen + 1 ); enc->version = 4; @@ -438,14 +438,14 @@ encode_crypt( const char *filename, STRLIST remusr ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - #ifdef ENABLE_COMMENT_PACKETS +#ifdef ENABLE_COMMENT_PACKETS else { write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); if( opt.comment_string ) write_comment( out, opt.comment_string ); } - #endif +#endif /* create a session key */ cfx.dek = m_alloc_secure_clear (sizeof *cfx.dek); if( !opt.def_cipher_algo ) { /* try to get it from the prefs */ diff --git a/g10/g10.c b/g10/g10.c index b7b36c27a..bdf0ce98f 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -27,7 +27,7 @@ #include #include #ifdef HAVE_DOSISH_SYSTEM - #include /* for setmode() */ +#include /* for setmode() */ #endif #ifdef HAVE_STAT #include /* for stat() */ @@ -758,15 +758,15 @@ build_list( const char *text, char letter, static void i18n_init(void) { - #ifdef USE_SIMPLE_GETTEXT +#ifdef USE_SIMPLE_GETTEXT set_gettext_file( PACKAGE ); - #else - #ifdef ENABLE_NLS +#else +#ifdef ENABLE_NLS setlocale( LC_ALL, "" ); bindtextdomain( PACKAGE, G10_LOCALEDIR ); textdomain( PACKAGE ); - #endif - #endif +#endif +#endif } static void @@ -1122,14 +1122,14 @@ main( int argc, char **argv ) int pwfd = -1; int with_fpr = 0; /* make an option out of --fingerprint */ int any_explicit_recipient = 0; - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING ulong requested_shm_size=0; - #endif +#endif - #ifdef __riscos__ +#ifdef __riscos__ riscos_global_defaults(); opt.lock_once = 1; - #endif /* __riscos__ */ +#endif /* __riscos__ */ trap_unaligned(); secmem_set_flags( secmem_get_flags() | 2 ); /* suspend warnings */ @@ -1215,7 +1215,7 @@ main( int argc, char **argv ) opt.strict=0; log_set_strict(0); } - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING else if( pargs.r_opt == oRunAsShmCP ) { /* does not make sense in a options file, we do it here, * so that we are the able to drop setuid as soon as possible */ @@ -1227,7 +1227,7 @@ main( int argc, char **argv ) * initialized when init_shm_coprocessing() is called */ set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) ); } - #endif +#endif } #ifdef HAVE_DOSISH_SYSTEM @@ -1838,13 +1838,13 @@ main( int argc, char **argv ) strusage(11), strusage(13), strusage(14) ); fprintf(stderr, "%s\n", strusage(15) ); } - #ifdef IS_DEVELOPMENT_VERSION +#ifdef IS_DEVELOPMENT_VERSION if( !opt.batch ) { log_info("NOTE: THIS IS A DEVELOPMENT VERSION!\n"); log_info("It is only intended for test purposes and should NOT be\n"); log_info("used in a production environment or with production keys!\n"); } - #endif +#endif if (opt.verbose > 2) log_info ("using character set `%s'\n", get_native_charset ()); @@ -2589,9 +2589,9 @@ main( int argc, char **argv ) size_t n = !endless && count < 99? count : 99; p = get_random_bits( n*8, level, 0); - #ifdef HAVE_DOSISH_SYSTEM +#ifdef HAVE_DOSISH_SYSTEM setmode ( fileno(stdout), O_BINARY ); - #endif +#endif if (opt.armor) { char *tmp = make_radix64_string (p, n); fputs (tmp, stdout); @@ -2878,9 +2878,9 @@ print_mds( const char *fname, int algo ) if( !fname ) { fp = stdin; - #ifdef HAVE_DOSISH_SYSTEM +#ifdef HAVE_DOSISH_SYSTEM setmode ( fileno(fp) , O_BINARY ); - #endif +#endif } else { fp = fopen( fname, "rb" ); diff --git a/g10/getkey.c b/g10/getkey.c index 44e571ce4..789e2982f 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -39,7 +39,7 @@ #define MAX_UID_CACHE_ENTRIES 200 #if MAX_PK_CACHE_ENTRIES < 2 - #error We need the cache for key creation +#error We need the cache for key creation #endif @@ -84,7 +84,7 @@ typedef struct keyid_list { #endif #if MAX_UID_CACHE_ENTRIES < 5 - #error we really need the userid cache +#error we really need the userid cache #endif typedef struct user_id_db { struct user_id_db *next; @@ -119,7 +119,7 @@ print_stats() void cache_public_key( PKT_public_key *pk ) { - #if MAX_PK_CACHE_ENTRIES +#if MAX_PK_CACHE_ENTRIES pk_cache_entry_t ce; u32 keyid[2]; @@ -158,7 +158,7 @@ cache_public_key( PKT_public_key *pk ) ce->pk = copy_public_key( NULL, pk ); ce->keyid[0] = keyid[0]; ce->keyid[1] = keyid[1]; - #endif +#endif } @@ -266,7 +266,7 @@ cache_user_id( KBNODE keyblock ) void getkey_disable_caches() { - #if MAX_PK_CACHE_ENTRIES +#if MAX_PK_CACHE_ENTRIES { pk_cache_entry_t ce, ce2; @@ -279,7 +279,7 @@ getkey_disable_caches() pk_cache_entries = 0; pk_cache = NULL; } - #endif +#endif /* fixme: disable user id cache ? */ } @@ -319,7 +319,7 @@ get_pubkey( PKT_public_key *pk, u32 *keyid ) int internal = 0; int rc = 0; - #if MAX_PK_CACHE_ENTRIES +#if MAX_PK_CACHE_ENTRIES { /* Try to get it from the cache */ pk_cache_entry_t ce; for( ce = pk_cache; ce; ce = ce->next ) { @@ -330,7 +330,7 @@ get_pubkey( PKT_public_key *pk, u32 *keyid ) } } } - #endif +#endif /* more init stuff */ if( !pk ) { pk = m_alloc_clear( sizeof *pk ); @@ -2133,7 +2133,7 @@ finish_lookup (GETKEY_CTX ctx) KBNODE k; KBNODE foundk = NULL; PKT_user_id *foundu = NULL; - #define USAGE_MASK (PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC) +#define USAGE_MASK (PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC) unsigned int req_usage = ( ctx->req_usage & USAGE_MASK ); /* Request the primary if we're certifying another key, and also if signing data while --pgp6 or --pgp7 is on since pgp 6 and 7 diff --git a/g10/gpgv.c b/g10/gpgv.c index b4aa31b96..5f6f06710 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -26,7 +26,7 @@ #include #include #ifdef HAVE_DOSISH_SYSTEM - #include /* for setmode() */ +#include /* for setmode() */ #endif #define INCLUDED_BY_MAIN_MODULE 1 @@ -114,20 +114,20 @@ strusage( int level ) static void i18n_init(void) { - #ifdef USE_SIMPLE_GETTEXT +#ifdef USE_SIMPLE_GETTEXT set_gettext_file( PACKAGE ); - #else - #ifdef ENABLE_NLS - #ifdef HAVE_LC_MESSAGES +#else +#ifdef ENABLE_NLS +#ifdef HAVE_LC_MESSAGES setlocale( LC_TIME, "" ); setlocale( LC_MESSAGES, "" ); - #else +#else setlocale( LC_ALL, "" ); - #endif +#endif bindtextdomain( PACKAGE, G10_LOCALEDIR ); textdomain( PACKAGE ); - #endif - #endif +#endif +#endif } @@ -140,9 +140,9 @@ main( int argc, char **argv ) STRLIST nrings=NULL; unsigned configlineno; - #ifdef __riscos__ +#ifdef __riscos__ riscos_global_defaults(); - #endif /* __riscos__ */ +#endif /* __riscos__ */ log_set_name("gpgv"); init_signals(); @@ -153,11 +153,11 @@ main( int argc, char **argv ) opt.trust_model = TM_ALWAYS; opt.batch = 1; - #if defined (__MINGW32__) +#if defined (__MINGW32__) opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" ); - #else +#else opt.homedir = getenv("GNUPGHOME"); - #endif +#endif if( !opt.homedir || !*opt.homedir ) { opt.homedir = GNUPG_HOMEDIR; } diff --git a/g10/kbnode.c b/g10/kbnode.c index 06d28f844..5df6d8d74 100644 --- a/g10/kbnode.c +++ b/g10/kbnode.c @@ -54,12 +54,12 @@ static void free_node( KBNODE n ) { if( n ) { - #if USE_UNUSED_NODES +#if USE_UNUSED_NODES n->next = unused_nodes; unused_nodes = n; - #else +#else m_free( n ); - #endif +#endif } } diff --git a/g10/keydb.c b/g10/keydb.c index 520770542..c67c36110 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -722,6 +722,3 @@ keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr) memcpy (desc.u.fpr, fpr, MAX_FINGERPRINT_LEN); return keydb_search (hd, &desc, 1); } - - - diff --git a/g10/keygen.c b/g10/keygen.c index ef4b422dd..ff6fec852 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1524,7 +1524,7 @@ do_create( int algo, unsigned int nbits, KBNODE pub_root, KBNODE sec_root, else BUG(); - #ifdef ENABLE_COMMENT_PACKETS +#ifdef ENABLE_COMMENT_PACKETS if( !rc ) { add_kbnode( pub_root, make_comment_node("#created by GNUPG v" VERSION " (" @@ -1533,7 +1533,7 @@ do_create( int algo, unsigned int nbits, KBNODE pub_root, KBNODE sec_root, make_comment_node("#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")")); } - #endif +#endif return rc; } diff --git a/g10/mainproc.c b/g10/mainproc.c index fbc2394eb..a801f5ea9 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1647,7 +1647,7 @@ proc_tree( CTX c, KBNODE node ) * signature has been created in textmode */ c->mfx.md2 = md_open( sig->digest_algo, 0 ); } - #if 0 /* workaround disabled */ +#if 0 /* workaround disabled */ /* Here we have another hack to work around a pgp 2 bug * It works by not using the textmode for detached signatures; * this will let the first signature check (on md) fail @@ -1656,7 +1656,7 @@ proc_tree( CTX c, KBNODE node ) * hack but it may help in some cases (and break others) */ /* c->mfx.md2? 0 :(sig->sig_class == 0x01) */ - #endif +#endif if ( DBG_HASHING ) { md_start_debug( c->mfx.md, "verify" ); if ( c->mfx.md2 ) diff --git a/g10/misc.c b/g10/misc.c index 58d6bce5b..44deb5737 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -25,13 +25,13 @@ #include #include #if defined(__linux__) && defined(__alpha__) && __GLIBC__ < 2 - #include - #include +#include +#include #endif #ifdef HAVE_SETRLIMIT - #include - #include - #include +#include +#include +#include #endif #include "util.h" #include "main.h" @@ -84,10 +84,10 @@ trap_unaligned(void) int disable_core_dumps() { - #ifdef HAVE_DOSISH_SYSTEM +#ifdef HAVE_DOSISH_SYSTEM return 0; - #else - #ifdef HAVE_SETRLIMIT +#else +#ifdef HAVE_SETRLIMIT struct rlimit limit; limit.rlim_cur = 0; @@ -96,9 +96,9 @@ disable_core_dumps() return 0; if( errno != EINVAL && errno != ENOSYS ) log_fatal(_("can't disable core dumps: %s\n"), strerror(errno) ); - #endif +#endif return 1; - #endif +#endif } diff --git a/g10/openfile.c b/g10/openfile.c index 81e5d2d43..854589641 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -37,20 +37,20 @@ #include "i18n.h" #ifdef USE_ONLY_8DOT3 - #define SKELEXT ".skl" +#define SKELEXT ".skl" #else - #define SKELEXT EXTSEP_S "skel" +#define SKELEXT EXTSEP_S "skel" #endif #if defined (HAVE_DRIVE_LETTERS) || defined (__riscos__) - #define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) ) +#define CMP_FILENAME(a,b) ascii_strcasecmp( (a), (b) ) #else - #define CMP_FILENAME(a,b) strcmp( (a), (b) ) +#define CMP_FILENAME(a,b) strcmp( (a), (b) ) #endif #ifdef MKDIR_TAKES_ONE_ARG -# undef mkdir -# define mkdir(a,b) mkdir(a) +#undef mkdir +#define mkdir(a,b) mkdir(a) #endif /* FIXME: Implement opt.interactive. */ diff --git a/g10/options.h b/g10/options.h index 8b6c5a369..2bdbde34f 100644 --- a/g10/options.h +++ b/g10/options.h @@ -29,11 +29,11 @@ #ifndef EXTERN_UNLESS_MAIN_MODULE /* Norcraft can't cope with common symbols */ - #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) - #define EXTERN_UNLESS_MAIN_MODULE extern - #else - #define EXTERN_UNLESS_MAIN_MODULE - #endif +#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) +#define EXTERN_UNLESS_MAIN_MODULE extern +#else +#define EXTERN_UNLESS_MAIN_MODULE +#endif #endif EXTERN_UNLESS_MAIN_MODULE diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 2ce4748a6..a881840b2 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -42,9 +42,9 @@ static int list_mode = 0; static int parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos, int *skip, IOBUF out, int do_skip - #ifdef DEBUG_PARSE_PACKET +#ifdef DEBUG_PARSE_PACKET ,const char *dbg_w, const char *dbg_f, int dbg_l - #endif +#endif ); static int copy_packet( IOBUF inp, IOBUF out, int pkttype, unsigned long pktlen ); diff --git a/g10/pkclist.c b/g10/pkclist.c index c12b3deb4..803c6f60d 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -1254,18 +1254,18 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint) compr_hack = 1; } - #if 0 +#if 0 log_debug("pref mask=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n", (ulong)mask[7], (ulong)mask[6], (ulong)mask[5], (ulong)mask[4], (ulong)mask[3], (ulong)mask[2], (ulong)mask[1], (ulong)mask[0]); - #endif +#endif for(i=0; i < 8; i++ ) bits[i] &= mask[i]; - #if 0 +#if 0 log_debug("pref bits=%08lX%08lX%08lX%08lX%08lX%08lX%08lX%08lX\n", (ulong)bits[7], (ulong)bits[6], (ulong)bits[5], (ulong)bits[4], (ulong)bits[3], (ulong)bits[2], (ulong)bits[1], (ulong)bits[0]); - #endif +#endif } /* usable algorithms are now in bits * We now use the last key from pk_list to select @@ -1312,9 +1312,9 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype, int request, void *hint) } } - #if 0 +#if 0 log_debug("prefs of type %d: selected %d\n", preftype, i ); - #endif +#endif if( compr_hack && !i ) { /* selected no compression, but we should check whether * algorithm 1 is also available (the ordering is not relevant diff --git a/g10/plaintext.c b/g10/plaintext.c index 62cdd081f..3183785b4 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -25,7 +25,7 @@ #include #include #ifdef HAVE_DOSISH_SYSTEM -# include /* for setmode() */ +#include /* for setmode() */ #endif #include "util.h" @@ -450,8 +450,3 @@ hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files, return 0; } - - - - - diff --git a/g10/sig-check.c b/g10/sig-check.c index e878c4252..47ee6a293 100644 --- a/g10/sig-check.c +++ b/g10/sig-check.c @@ -135,7 +135,7 @@ signature_check2( PKT_signature *sig, MD_HANDLE digest, static int cmp_help( void *opaque, MPI result ) { - #if 0 /* we do not use this anymore */ +#if 0 /* we do not use this anymore */ int rc=0, i, j, c, old_enc; byte *dp; const byte *asn; @@ -198,9 +198,9 @@ cmp_help( void *opaque, MPI result ) return G10ERR_BAD_SIGN; } return 0; - #else +#else return -1; - #endif +#endif } static int diff --git a/g10/sign.c b/g10/sign.c index 6e6566048..edefa2125 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -43,11 +43,11 @@ #ifdef HAVE_DOSISH_SYSTEM - #define LF "\r\n" - void __stdcall Sleep(ulong); - #define sleep(a) Sleep((a)*1000) +#define LF "\r\n" +void __stdcall Sleep(ulong); +#define sleep(a) Sleep((a)*1000) #else - #define LF "\n" +#define LF "\n" #endif static int recipient_digest_algo=0; diff --git a/g10/signal.c b/g10/signal.c index 140259a19..1028ab705 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -41,8 +41,8 @@ static volatile int caught_sigusr1 = 0; static void init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) { - #ifndef HAVE_DOSISH_SYSTEM - #ifdef HAVE_SIGACTION +#ifndef HAVE_DOSISH_SYSTEM +#ifdef HAVE_SIGACTION struct sigaction oact, nact; if (check_ign) { @@ -56,7 +56,7 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) sigemptyset (&nact.sa_mask); nact.sa_flags = 0; sigaction ( sig, &nact, NULL); - #else +#else RETSIGTYPE (*ohandler)(int); ohandler = signal (sig, handler); @@ -64,18 +64,18 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign ) /* Change it back if it was already set to IGN */ signal (sig, SIG_IGN); } - #endif - #endif /*!HAVE_DOSISH_SYSTEM*/ +#endif +#endif /*!HAVE_DOSISH_SYSTEM*/ } static const char * get_signal_name( int signum ) { - #if defined(SYS_SIGLIST_DECLARED) && defined(NSIG) +#if defined(SYS_SIGLIST_DECLARED) && defined(NSIG) return (signum >= 0 && signum < NSIG) ? sys_siglist[signum] : "?"; - #else +#else return "some signal"; - #endif +#endif } @@ -116,7 +116,7 @@ got_usr_signal( int sig ) void init_signals() { - #ifndef HAVE_DOSISH_SYSTEM +#ifndef HAVE_DOSISH_SYSTEM init_one_signal (SIGINT, got_fatal_signal, 1 ); init_one_signal (SIGHUP, got_fatal_signal, 1 ); init_one_signal (SIGTERM, got_fatal_signal, 1 ); @@ -124,15 +124,15 @@ init_signals() init_one_signal (SIGSEGV, got_fatal_signal, 1 ); init_one_signal (SIGUSR1, got_usr_signal, 0 ); init_one_signal (SIGPIPE, SIG_IGN, 0 ); - #endif +#endif } void pause_on_sigusr( int which ) { - #ifndef HAVE_DOSISH_SYSTEM - #ifdef HAVE_SIGPROCMASK +#ifndef HAVE_DOSISH_SYSTEM +#ifdef HAVE_SIGPROCMASK sigset_t mask, oldmask; assert( which == 1 ); @@ -144,24 +144,24 @@ pause_on_sigusr( int which ) sigsuspend( &oldmask ); caught_sigusr1 = 0; sigprocmask( SIG_UNBLOCK, &mask, NULL ); - #else +#else assert (which == 1); sighold (SIGUSR1); while (!caught_sigusr1) sigpause(SIGUSR1); caught_sigusr1 = 0; sigrelse(SIGUSR1); ???? - #endif /*!HAVE_SIGPROCMASK*/ - #endif +#endif /*!HAVE_SIGPROCMASK*/ +#endif } static void do_block( int block ) { - #ifndef HAVE_DOSISH_SYSTEM +#ifndef HAVE_DOSISH_SYSTEM static int is_blocked; - #ifdef HAVE_SIGPROCMASK +#ifdef HAVE_SIGPROCMASK static sigset_t oldmask; if( block ) { @@ -179,7 +179,7 @@ do_block( int block ) sigprocmask( SIG_SETMASK, &oldmask, NULL ); is_blocked = 0; } - #else /*!HAVE_SIGPROCMASK*/ +#else /*!HAVE_SIGPROCMASK*/ static void (*disposition[MAXSIG])(); int sig; @@ -199,8 +199,8 @@ do_block( int block ) } is_blocked = 0; } - #endif /*!HAVE_SIGPROCMASK*/ - #endif /*HAVE_DOSISH_SYSTEM*/ +#endif /*!HAVE_SIGPROCMASK*/ +#endif /*HAVE_DOSISH_SYSTEM*/ } diff --git a/g10/status.c b/g10/status.c index 99f9cfdd2..cc30db79b 100644 --- a/g10/status.c +++ b/g10/status.c @@ -26,19 +26,19 @@ #include #include #ifdef USE_SHM_COPROCESSING - #ifdef USE_CAPABILITIES - #include - #endif - #ifdef HAVE_SYS_IPC_H - #include - #include - #endif - #ifdef HAVE_SYS_SHM_H - #include - #endif - #if defined(HAVE_MLOCK) - #include - #endif +#ifdef USE_CAPABILITIES +#include +#endif +#ifdef HAVE_SYS_IPC_H +#include +#include +#endif +#ifdef HAVE_SYS_SHM_H +#include +#endif +#if defined(HAVE_MLOCK) +#include +#endif #endif #include "util.h" #include "status.h" @@ -310,9 +310,9 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem ) char buf[100]; struct shmid_ds shmds; - #ifndef IPC_RMID_DEFERRED_RELEASE +#ifndef IPC_RMID_DEFERRED_RELEASE atexit( remove_shmid ); - #endif +#endif requested_shm_size = (requested_shm_size + 4095) & ~4095; if ( requested_shm_size > 2 * 4096 ) log_fatal("too much shared memory requested; only 8k are allowed\n"); @@ -323,7 +323,7 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem ) log_fatal("can't get %uk of shared memory: %s\n", (unsigned)shm_size/1024, strerror(errno)); - #if !defined(IPC_HAVE_SHM_LOCK) \ +#if !defined(IPC_HAVE_SHM_LOCK) \ && defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK) /* part of the old code which uses mlock */ shm_area = shmat( shm_id, 0, 0 ); @@ -333,25 +333,25 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem ) log_debug("mapped %uk shared memory at %p, id=%d\n", (unsigned)shm_size/1024, shm_area, shm_id ); if( lock_mem ) { - #ifdef USE_CAPABILITIES +#ifdef USE_CAPABILITIES cap_set_proc( cap_from_text("cap_ipc_lock+ep") ); - #endif +#endif /* (need the cast for Solaris with Sun's workshop compilers) */ if ( mlock ( (char*)shm_area, shm_size) ) log_info("locking shared memory %d failed: %s\n", shm_id, strerror(errno)); else shm_is_locked = 1; - #ifdef USE_CAPABILITIES +#ifdef USE_CAPABILITIES cap_set_proc( cap_from_text("cap_ipc_lock+p") ); - #endif +#endif } - #ifdef IPC_RMID_DEFERRED_RELEASE +#ifdef IPC_RMID_DEFERRED_RELEASE if( shmctl( shm_id, IPC_RMID, 0) ) log_fatal("shmctl IPC_RMDID of %d failed: %s\n", shm_id, strerror(errno)); - #endif +#endif if( shmctl( shm_id, IPC_STAT, &shmds ) ) log_fatal("shmctl IPC_STAT of %d failed: %s\n", @@ -363,27 +363,27 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem ) shm_id, strerror(errno)); } - #else /* this is the new code which handles the changes in the SHM semantics - * introduced with Linux 2.4. The changes is that we now change the - * permissions and then attach to the memory. - */ +#else /* this is the new code which handles the changes in the SHM + * semantics introduced with Linux 2.4. The changes is that we + * now change the permissions and then attach to the memory. + */ if( lock_mem ) { - #ifdef USE_CAPABILITIES +#ifdef USE_CAPABILITIES cap_set_proc( cap_from_text("cap_ipc_lock+ep") ); - #endif - #ifdef IPC_HAVE_SHM_LOCK +#endif +#ifdef IPC_HAVE_SHM_LOCK if ( shmctl (shm_id, SHM_LOCK, 0) ) log_info("locking shared memory %d failed: %s\n", shm_id, strerror(errno)); else shm_is_locked = 1; - #else +#else log_info("Locking shared memory %d failed: No way to do it\n", shm_id ); - #endif - #ifdef USE_CAPABILITIES +#endif +#ifdef USE_CAPABILITIES cap_set_proc( cap_from_text("cap_ipc_lock+p") ); - #endif +#endif } if( shmctl( shm_id, IPC_STAT, &shmds ) ) @@ -403,13 +403,13 @@ init_shm_coprocessing ( ulong requested_shm_size, int lock_mem ) log_debug("mapped %uk shared memory at %p, id=%d\n", (unsigned)shm_size/1024, shm_area, shm_id ); - #ifdef IPC_RMID_DEFERRED_RELEASE +#ifdef IPC_RMID_DEFERRED_RELEASE if( shmctl( shm_id, IPC_RMID, 0) ) log_fatal("shmctl IPC_RMDID of %d failed: %s\n", shm_id, strerror(errno)); - #endif +#endif - #endif +#endif /* write info; Protocol version, id, size, locked size */ sprintf( buf, "pv=1 pid=%d shmid=%d sz=%u lz=%u", (int)getpid(), shm_id, (unsigned)shm_size, shm_is_locked? (unsigned)shm_size:0 ); @@ -479,11 +479,11 @@ myread(int fd, void *buf, size_t count) eof_emmited++; } else { /* Ctrl-D not caught - do something reasonable */ - #ifdef HAVE_DOSISH_SYSTEM +#ifdef HAVE_DOSISH_SYSTEM raise (SIGINT); /* nothing to hangup under DOS */ - #else +#else raise (SIGHUP); /* no more input data */ - #endif +#endif } } return rc; @@ -541,10 +541,10 @@ cpr_enabled() { if( opt.command_fd != -1 ) return 1; - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING if( opt.shm_coprocess ) return 1; - #endif +#endif return 0; } @@ -555,10 +555,10 @@ cpr_get_no_help( const char *keyword, const char *prompt ) if( opt.command_fd != -1 ) return do_get_from_fd ( keyword, 0, 0 ); - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING if( opt.shm_coprocess ) return do_shm_get( keyword, 0, 0 ); - #endif +#endif for(;;) { p = tty_get( prompt ); return p; @@ -572,10 +572,10 @@ cpr_get( const char *keyword, const char *prompt ) if( opt.command_fd != -1 ) return do_get_from_fd ( keyword, 0, 0 ); - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING if( opt.shm_coprocess ) return do_shm_get( keyword, 0, 0 ); - #endif +#endif for(;;) { p = tty_get( prompt ); if( *p=='?' && !p[1] && !(keyword && !*keyword)) { @@ -608,10 +608,10 @@ cpr_get_hidden( const char *keyword, const char *prompt ) if( opt.command_fd != -1 ) return do_get_from_fd ( keyword, 1, 0 ); - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING if( opt.shm_coprocess ) return do_shm_get( keyword, 1, 0 ); - #endif +#endif for(;;) { p = tty_get_hidden( prompt ); if( *p == '?' && !p[1] ) { @@ -628,10 +628,10 @@ cpr_kill_prompt(void) { if( opt.command_fd != -1 ) return; - #ifdef USE_SHM_COPROCESSING +#ifdef USE_SHM_COPROCESSING if( opt.shm_coprocess ) return; - #endif +#endif tty_kill_prompt(); return; } @@ -691,4 +691,3 @@ cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt ) } } } - diff --git a/g10/tdbio.h b/g10/tdbio.h index aa2e950ee..708e06d2b 100644 --- a/g10/tdbio.h +++ b/g10/tdbio.h @@ -29,7 +29,7 @@ #define ITEMS_PER_HLST_RECORD ((TRUST_RECORD_LEN-6)/5) #define ITEMS_PER_PREF_RECORD (TRUST_RECORD_LEN-10) #if ITEMS_PER_PREF_RECORD % 2 - #error ITEMS_PER_PREF_RECORD must be even +#error ITEMS_PER_PREF_RECORD must be even #endif #define MAX_LIST_SIGS_DEPTH 20 diff --git a/g10/textfilter.c b/g10/textfilter.c index ded030d79..6f3fe1bbf 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -34,9 +34,9 @@ #include "options.h" #ifdef HAVE_DOSISH_SYSTEM - #define LF "\r\n" +#define LF "\r\n" #else - #define LF "\n" +#define LF "\n" #endif #define MAX_LINELEN 19995 /* a little bit smaller than in armor.c */ @@ -193,7 +193,7 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, iobuf_put( out, ' ' ); } - #if 0 /*defined(HAVE_DOSISH_SYSTEM)*/ +#if 0 /*defined(HAVE_DOSISH_SYSTEM)*/ /* We don't use this anymore because my interpretation of rfc2440 7.1 * is that there is no conversion needed. If one decides to * clearsign a unix file on a DOS box he will get a mixed line endings. @@ -215,9 +215,9 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, else iobuf_write( out, buffer, n ); - #else +#else iobuf_write( out, buffer, n ); - #endif +#endif } /* at eof */ @@ -232,4 +232,3 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, return 0; /* okay */ } -