comparison src/configfile.c @ 150:1c7303c71f66 noffle

[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line starting with '\0' - according to the leafnode mailing list, this has been seen in the wild. * docs/inews.1,docs/noffle.1,docs/noffle.conf.5, packages/redhat/noffle.spec,src/configfile.h,src/configfile.c, src/noffle.c,src/post.h,src/post.c: Removed use of getopt_long, and added inews mode - the Noffle executable behaves as inews is invoked as inews. This includes adding From: and Organization: headers if necessary - add configs to override defaults for the From: domain and specify the organization. For all my fellow trn-heads out there, and users of any other ageing newsreader that expects inews. Updated RPM spec to create inews link to noffle on install.
author bears
date Thu, 26 Oct 2000 22:21:13 +0100
parents 7dfbb1c20a81
children fed1334d766b
comparison
equal deleted inserted replaced
149:bfeea2bc09b6 150:1c7303c71f66
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 199 2000-08-15 23:08:13Z bears $ 9 $Id: configfile.c 227 2000-10-26 21:21:13Z 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
90 ExpireEntry *expire; 90 ExpireEntry *expire;
91 int numAutoSubscribeMode; 91 int numAutoSubscribeMode;
92 int maxAutoSubscribeMode; 92 int maxAutoSubscribeMode;
93 AutoSubscribeModeEntry *autoSubscribeMode; 93 AutoSubscribeModeEntry *autoSubscribeMode;
94 Str pathHeader; 94 Str pathHeader;
95 Str fromDomain;
96 Str organization;
95 } config = 97 } config =
96 { 98 {
97 SPOOLDIR, /* spoolDir */ 99 SPOOLDIR, /* spoolDir */
98 VERSION, /* version */ 100 VERSION, /* version */
99 300, /* maxFetch */ 101 300, /* maxFetch */
116 0, /* maxExpire */ 118 0, /* maxExpire */
117 NULL, /* expire */ 119 NULL, /* expire */
118 0, /* numAutoSubscribeMode */ 120 0, /* numAutoSubscribeMode */
119 0, /* maxAutoSubscribeMode */ 121 0, /* maxAutoSubscribeMode */
120 NULL, /* autoSubscribeMode */ 122 NULL, /* autoSubscribeMode */
121 "" /* pathHeader */ 123 "", /* pathHeader */
124 "", /* fromDomain */
125 "" /* organization */
122 }; 126 };
123 127
124 const char * Cfg_spoolDir( void ) { return config.spoolDir; } 128 const char * Cfg_spoolDir( void ) { return config.spoolDir; }
125 const char * Cfg_version( void ) { return config.version; } 129 const char * Cfg_version( void ) { return config.version; }
126 130
136 const char * Cfg_defaultAutoSubscribeMode( void ) { 140 const char * Cfg_defaultAutoSubscribeMode( void ) {
137 return config.defaultAutoSubscribeMode; } 141 return config.defaultAutoSubscribeMode; }
138 const char * Cfg_mailTo( void ) { return config.mailTo; } 142 const char * Cfg_mailTo( void ) { return config.mailTo; }
139 int Cfg_defaultExpire( void ) { return config.defaultExpire; } 143 int Cfg_defaultExpire( void ) { return config.defaultExpire; }
140 const char * Cfg_pathHeader( void ) { return config.pathHeader; } 144 const char * Cfg_pathHeader( void ) { return config.pathHeader; }
145 const char * Cfg_fromDomain( void ) { return config.fromDomain; }
146 const char * Cfg_organization( void ) { return config.organization; }
141 147
142 void 148 void
143 Cfg_beginServEnum( void ) 149 Cfg_beginServEnum( void )
144 { 150 {
145 config.servIdx = 0; 151 config.servIdx = 0;
358 if ( sscanf( line, "%s %s", dummy, variable ) != 2 ) 364 if ( sscanf( line, "%s %s", dummy, variable ) != 2 )
359 { 365 {
360 logSyntaxErr( line ); 366 logSyntaxErr( line );
361 return; 367 return;
362 } 368 }
369 }
370
371 static void
372 getText( Str variable, const char *line )
373 {
374 const char *l;
375
376 /* Skip command */
377 l = Utl_restOfLn( line, 1 );
378 Utl_cpyStr( variable, l );
363 } 379 }
364 380
365 static void 381 static void
366 getServ( const char *line ) 382 getServ( const char *line )
367 { 383 {
806 getAutoSubscribeMode( p ); 822 getAutoSubscribeMode( p );
807 else if ( strcmp( "getgroups", name ) == 0 ) 823 else if ( strcmp( "getgroups", name ) == 0 )
808 getGroups( p, TRUE ); 824 getGroups( p, TRUE );
809 else if ( strcmp( "omitgroups", name ) == 0 ) 825 else if ( strcmp( "omitgroups", name ) == 0 )
810 getGroups( p, FALSE ); 826 getGroups( p, FALSE );
827 else if ( strcmp( "path-header", name ) == 0 )
828 getStr( config.pathHeader, p );
829 else if ( strcmp( "from-domain", name ) == 0 )
830 getStr( config.fromDomain, p );
811 /* The following need line because they may have uppercase data */ 831 /* The following need line because they may have uppercase data */
832 else if ( strcmp( "organization", name ) == 0 )
833 getText( config.organization, line );
812 else if ( strcmp( "server", name ) == 0 ) 834 else if ( strcmp( "server", name ) == 0 )
813 getServ( line ); 835 getServ( line );
814 else if ( strcmp( "path-header", name ) == 0 )
815 getStr( config.pathHeader, p );
816 else if ( strcmp( "filter", name ) == 0 ) 836 else if ( strcmp( "filter", name ) == 0 )
817 getFilter( line ); 837 getFilter( line );
818 else 838 else
819 Log_err( "Unknown config option: %s", name ); 839 Log_err( "Unknown config option: %s", name );
820 } 840 }