# HG changeset patch # User bears # Date 1058946822 -3600 # Node ID b540ecb6f218a2d1245790594d78907824da04b3 # Parent a1434190eace5d755b8f75d9e5126977c63afed3 [svn] * src/itemlist.c: Add define so test code builds again. * src/noffle.c: Fix SF bug 756585 in command handling and beef up returning an appropriate exit value. diff -r a1434190eace -r b540ecb6f218 ChangeLog --- a/ChangeLog Wed Jul 16 13:16:49 2003 +0100 +++ b/ChangeLog Wed Jul 23 08:53:42 2003 +0100 @@ -1,3 +1,9 @@ +Wed Jun 23 2003 Jim Hague + +* src/itemlist.c: Add define so test code builds again. +* src/noffle.c: Fix SF bug 756585 in command handling and beef up + returning an appropriate exit value. + Wed Jun 25 2003 Jim Hague * src/protocol.c: Reading of long lines broken in Prt_getLn(). Fix and diff -r a1434190eace -r b540ecb6f218 src/itemlist.c --- a/src/itemlist.c Wed Jul 16 13:16:49 2003 +0100 +++ b/src/itemlist.c Wed Jul 23 08:53:42 2003 +0100 @@ -1,7 +1,7 @@ /* itemlist.c - $Id: itemlist.c 413 2002-12-27 21:48:25Z bears $ + $Id: itemlist.c 606 2003-07-23 07:53:42Z bears $ */ #if HAVE_CONFIG_H @@ -17,7 +17,8 @@ #include "portable.h" #if defined(ITEMLIST_TEST) -#define Log_err printf +#define Log_err printf +#define Log_fatal printf #endif #define SEP_CHAR '\1' /* Replace all separators with this */ diff -r a1434190eace -r b540ecb6f218 src/noffle.c --- a/src/noffle.c Wed Jul 16 13:16:49 2003 +0100 +++ b/src/noffle.c Wed Jul 23 08:53:42 2003 +0100 @@ -10,7 +10,7 @@ received for some seconds (to allow multiple clients connect at the same time). - $Id: noffle.c 533 2003-05-23 09:33:10Z bears $ + $Id: noffle.c 606 2003-07-23 07:53:42Z bears $ */ #if HAVE_CONFIG_H @@ -62,10 +62,11 @@ char *serverPattern; } noffle = { FALSE, FALSE, FALSE, TRUE, NULL }; -static void +static Bool doArt( const char *msgId ) { const char *id; + Bool res = FALSE; if ( strcmp( msgId, "all" ) == 0 ) { @@ -80,6 +81,7 @@ Db_from( id ), Db_date( id ), Db_header( id ), Db_body( id ) ); + res = TRUE; } while ( Db_next( &id ) ); } @@ -88,8 +90,13 @@ if ( ! Db_contains( msgId ) ) fprintf( stderr, "Not in database.\n" ); else + { printf( "%s\n%s", Db_header( msgId ), Db_body( msgId ) ); + res = TRUE; + } } + + return res; } static void @@ -274,17 +281,24 @@ Exp_expire(); } -static void +static Bool doRebuild( void ) { + Bool res = TRUE; + if ( ! Db_rebuild() ) + { + res = FALSE; fprintf( stderr, "Rebuild failed.\n" ); + } + return res; } -static void +static Bool doCreateLocalGroup( const char * name ) { Str grp; + Bool res = FALSE; Utl_cpyStr( grp, name ); Utl_toLower( grp ); @@ -293,7 +307,7 @@ if ( Grp_exists( name ) ) { fprintf( stderr, "'%s' already exists.\n", name ); - return; + return FALSE; } if ( ! Grp_isValidName( name ) ) fprintf( stderr, "'%s' invalid group name.\n", name ); @@ -305,13 +319,16 @@ Grp_create( name ); Grp_setLocal( name ); printf( "New local group '%s' created.\n", name ); + res = TRUE; snprintf( grp, MAXCHAR, "%s/groupinfo.lastupdate", Cfg_spoolDir() ); Utl_stamp( grp ); } + + return res; } -static void +static Bool doDeleteLocalGroup( const char * name ) { Str grp; @@ -323,7 +340,7 @@ if ( ! Grp_exists( name ) ) { fprintf( stderr, "'%s' does not exist.\n", name ); - return; + return FALSE; } if ( ! Grp_isValidName( name ) ) { @@ -397,6 +414,8 @@ printf( "Group '%s' deleted.\n", name ); } } + + return TRUE; } static void @@ -938,10 +957,12 @@ result = EXIT_FAILURE; } else - doArt( *argv ); + if ( ! doArt( *argv ) ) + result = EXIT_FAILURE; break; case 'B': - doRebuild(); + if ( ! doRebuild() ) + result = EXIT_FAILURE; break; case 'c': if ( *argv == NULL ) @@ -959,7 +980,8 @@ result = EXIT_FAILURE; } else - doCreateLocalGroup( *argv ); + if ( ! doCreateLocalGroup( *argv ) ) + result = EXIT_FAILURE; break; case 'd': doDb(); @@ -971,7 +993,8 @@ result = EXIT_FAILURE; } else - doDeleteLocalGroup( *argv ); + if ( ! doDeleteLocalGroup( *argv ) ) + result = EXIT_FAILURE; break; case 'e': doExpire(); @@ -1031,6 +1054,7 @@ { fprintf( stderr, "Unknown argument -q %s\n", *argv ); result = EXIT_FAILURE; + break; } argv++; argc--; @@ -1067,7 +1091,8 @@ result = EXIT_FAILURE; } else - result = doSubscribe( *argv, OVER ); + if ( ! doSubscribe( *argv, OVER ) ) + result = EXIT_FAILURE; break; case 'S': if ( *argv == NULL ) @@ -1076,7 +1101,8 @@ result = EXIT_FAILURE; } else - doSubscribe( *argv, FULL ); + if ( ! doSubscribe( *argv, FULL ) ) + result = EXIT_FAILURE; break; case 't': if ( *argv == NULL ) @@ -1085,7 +1111,8 @@ result = EXIT_FAILURE; } else - result = doSubscribe( *argv, THREAD ); + if ( ! doSubscribe( *argv, THREAD ) ) + result = EXIT_FAILURE; break; case 'u': if ( *argv == NULL )