comparison src/configfile.c @ 185:fed1334d766b noffle

[svn] * src/client.c: Change variable only used on constant to 'const'. * src/filter.c: Add a couple of 'return's after ASSERT() to remove compiler warnings about functions needing returns. * NEWS,TODO,configure,configure.in,noffle.conf.example,docs/NOTES, docs/noffle.conf.5,src/client.c,src/configfile.c,src/content.c, src/control.c,src/database.c,src/fetch.c,src/fetchlist.c,src/filter.c, src/group.c,src/lock.c,src/log.c,src/log.h,src/noffle.c,src/outgoing.c, src/post.c,src/protocol.c,src/request.c,src/server.c,src/util.c: Debug logging is always compiled and selected via noffle.conf. All debug logs are classified as all, none, config, control, expire, fetch, filter, newsbase, noffle, post, protocol, requests and server.
author bears
date Sun, 05 Aug 2001 09:24:22 +0100
parents 1c7303c71f66
children 47569cf4ad4a
comparison
equal deleted inserted replaced
184:9854ea5f295f 185:fed1334d766b
4 The following macros must be set, when compiling this file: 4 The following macros must be set, when compiling this file:
5 CONFIGFILE 5 CONFIGFILE
6 SPOOLDIR 6 SPOOLDIR
7 VERSION 7 VERSION
8 8
9 $Id: configfile.c 227 2000-10-26 21:21:13Z bears $ 9 $Id: configfile.c 300 2001-08-05 08:24:22Z bears $
10 */ 10 */
11 11
12 #if HAVE_CONFIG_H 12 #if HAVE_CONFIG_H
13 #include <config.h> 13 #include <config.h>
14 #endif 14 #endif
223 223
224 for ( i = 0; i < config.numExpire; i++ ) 224 for ( i = 0; i < config.numExpire; i++ )
225 if ( Wld_match( grp, config.expire[ i ].pattern ) ) 225 if ( Wld_match( grp, config.expire[ i ].pattern ) )
226 { 226 {
227 res = config.expire[ i ].days; 227 res = config.expire[ i ].days;
228 Log_dbg( "Custom expire period %d for group %s", res, grp ); 228 Log_dbg( LOG_DBG_CONFIG,
229 "Custom expire period %d for group %s",
230 res, grp );
229 return res; 231 return res;
230 } 232 }
231 233
232 return Cfg_defaultExpire(); 234 return Cfg_defaultExpire();
233 } 235 }
240 242
241 for ( i = 0; i < config.numAutoSubscribeMode; i++ ) 243 for ( i = 0; i < config.numAutoSubscribeMode; i++ )
242 if ( Wld_match( grp, config.autoSubscribeMode[ i ].pattern ) ) 244 if ( Wld_match( grp, config.autoSubscribeMode[ i ].pattern ) )
243 { 245 {
244 res = config.autoSubscribeMode[ i ].mode; 246 res = config.autoSubscribeMode[ i ].mode;
245 Log_dbg( "Custom auto subscribe mode %s for group %s", res, grp ); 247 Log_dbg( LOG_DBG_CONFIG,
248 "Custom auto subscribe mode %s for group %s",
249 res, grp );
246 return res; 250 return res;
247 } 251 }
248 252
249 return Cfg_defaultAutoSubscribeMode(); 253 return Cfg_defaultAutoSubscribeMode();
250 } 254 }
506 g->maxGroup += 5; 510 g->maxGroup += 5;
507 } 511 }
508 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); 512 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern );
509 } 513 }
510 del_Itl( patterns) ; 514 del_Itl( patterns) ;
515 }
516
517 static void
518 getDebugMask( char *line )
519 {
520 const char *name;
521 ItemList *maskNames;
522 const char *maskName;
523 unsigned mask;
524
525 name = line;
526 /* Skip over name and terminate it */
527 while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) )
528 line++;
529 if ( line[ 0 ] == '\0' )
530 {
531 logSyntaxErr( name );
532 return;
533 }
534 line[ 0 ] = '\0';
535 line++;
536
537 mask = LOG_DBG_NONE;
538 maskNames = new_Itl( line, " ," );
539 for( maskName = Itl_first( maskNames );
540 maskName != NULL;
541 maskName = Itl_next( maskNames ) )
542 {
543 if ( strcmp( maskName, "all" ) == 0 )
544 mask = LOG_DBG_ALL;
545 else if ( strcmp( maskName, "none" ) == 0 )
546 mask = LOG_DBG_NONE;
547 else if ( strcmp( maskName, "config" ) == 0 )
548 mask |= LOG_DBG_CONFIG;
549 else if ( strcmp( maskName, "control" ) == 0 )
550 mask |= LOG_DBG_CONTROL;
551 else if ( strcmp( maskName, "expire" ) == 0 )
552 mask |= LOG_DBG_EXPIRE;
553 else if ( strcmp( maskName, "fetch" ) == 0 )
554 mask |= LOG_DBG_FETCH;
555 else if ( strcmp( maskName, "filter" ) == 0 )
556 mask |= LOG_DBG_FILTER;
557 else if ( strcmp( maskName, "newsbase" ) == 0 )
558 mask |= LOG_DBG_NEWSBASE;
559 else if ( strcmp( maskName, "noffle" ) == 0 )
560 mask |= LOG_DBG_NOFFLE;
561 else if ( strcmp( maskName, "post" ) == 0 )
562 mask |= LOG_DBG_POST;
563 else if ( strcmp( maskName, "protocol" ) == 0 )
564 mask |= LOG_DBG_PROTOCOL;
565 else if ( strcmp( maskName, "requests" ) == 0 )
566 mask |= LOG_DBG_REQUESTS;
567 else if ( strcmp( maskName, "server" ) == 0 )
568 mask |= LOG_DBG_SERVER;
569 else
570 logSyntaxErr( line );
571 }
572 del_Itl( maskNames) ;
573 Log_setDbgMask( mask );
511 } 574 }
512 575
513 static Bool 576 static Bool
514 isValidAutoSubscribeMode( const char *mode ) 577 isValidAutoSubscribeMode( const char *mode )
515 { 578 {
743 goto synErr; 806 goto synErr;
744 } 807 }
745 808
746 if ( strcmp( ruleName, "action" ) != 0 ) 809 if ( strcmp( ruleName, "action" ) != 0 )
747 { 810 {
748 Log_dbg( "Adding rule type %d value %s", rule.type, value ); 811 Log_dbg( LOG_DBG_CONFIG,
812 "Adding rule type %d value %s",
813 rule.type, value );
749 Flt_addRule( f, rule ); 814 Flt_addRule( f, rule );
750 } 815 }
751 } 816 }
752 817
753 Log_dbg( "Adding filter, action %d", f->action ); 818 Log_dbg( LOG_DBG_CONFIG, "Adding filter, action %d", f->action );
754 Flt_addFilter( f ); 819 Flt_addFilter( f );
755 return; 820 return;
756 821
757 synErr: 822 synErr:
758 logSyntaxErr( line ); 823 logSyntaxErr( line );
818 getStr( config.mailTo, p ); 883 getStr( config.mailTo, p );
819 else if ( strcmp( "expire", name ) == 0 ) 884 else if ( strcmp( "expire", name ) == 0 )
820 getExpire( p ); 885 getExpire( p );
821 else if ( strcmp( "auto-subscribe-mode", name ) == 0 ) 886 else if ( strcmp( "auto-subscribe-mode", name ) == 0 )
822 getAutoSubscribeMode( p ); 887 getAutoSubscribeMode( p );
888 else if ( strcmp( "log-debug", name ) == 0 )
889 getDebugMask( p );
823 else if ( strcmp( "getgroups", name ) == 0 ) 890 else if ( strcmp( "getgroups", name ) == 0 )
824 getGroups( p, TRUE ); 891 getGroups( p, TRUE );
825 else if ( strcmp( "omitgroups", name ) == 0 ) 892 else if ( strcmp( "omitgroups", name ) == 0 )
826 getGroups( p, FALSE ); 893 getGroups( p, FALSE );
827 else if ( strcmp( "path-header", name ) == 0 ) 894 else if ( strcmp( "path-header", name ) == 0 )