comparison src/noffle.c @ 127:3c71e28c8eef noffle

[svn] Release-1-0 mergedocs/NOTES
author bears
date Tue, 25 Jul 2000 13:14:54 +0100
parents d00adc26d77a
children a740dac296bc
comparison
equal deleted inserted replaced
126:7c7a7c96d35b 127:3c71e28c8eef
8 not as server. If noffle runs as server, locking is performed while 8 not as server. If noffle runs as server, locking is performed while
9 executing NNTP commands, but temporarily released if no new command is 9 executing NNTP commands, but temporarily released if no new command is
10 received for some seconds (to allow multiple clients connect at the same 10 received for some seconds (to allow multiple clients connect at the same
11 time). 11 time).
12 12
13 $Id: noffle.c 176 2000-07-19 19:47:41Z enz $ 13 $Id: noffle.c 183 2000-07-25 12:14:54Z bears $
14 */ 14 */
15 15
16 #if HAVE_CONFIG_H 16 #if HAVE_CONFIG_H
17 #include <config.h> 17 #include <config.h>
18 #endif 18 #endif
154 static void 154 static void
155 doFetch( void ) 155 doFetch( void )
156 { 156 {
157 Str serv; 157 Str serv;
158 158
159 if ( ! Lock_getFetchLock( LOCK_NOWAIT ) )
160 {
161 Log_err( "Another 'noffle --fetch' is in progress" );
162 return;
163 }
164
159 Cfg_beginServEnum(); 165 Cfg_beginServEnum();
160 while ( Cfg_nextServ( serv ) ) 166 while ( Cfg_nextServ( serv ) )
161 if ( Fetch_init( serv ) ) 167 if ( Fetch_init( serv ) )
162 { 168 {
163 Fetch_postArts(); 169 Fetch_postArts();
172 /* get requested articles */ 178 /* get requested articles */
173 Fetch_getReq_(); 179 Fetch_getReq_();
174 180
175 Fetch_close(); 181 Fetch_close();
176 } 182 }
183
184 Lock_releaseFetchLock();
177 } 185 }
178 186
179 static Bool 187 static Bool
180 doPost( void ) 188 doPost( void )
181 { 189 {
213 { 221 {
214 if ( noffle.queryGrps ) 222 if ( noffle.queryGrps )
215 Client_getGrps(); 223 Client_getGrps();
216 if ( noffle.queryDsc ) 224 if ( noffle.queryDsc )
217 Client_getDsc(); 225 Client_getDsc();
218 if ( noffle.queryTimes )
219 Client_getCreationTimes();
220 Fetch_close(); 226 Fetch_close();
221 } 227 }
222 } 228 }
223 229
224 /* Expire all overviews not in database */ 230 /* Expire all overviews not in database */
304 { 310 {
305 Log_inf( "Creating new local group '%s'", name ); 311 Log_inf( "Creating new local group '%s'", name );
306 Grp_create( name ); 312 Grp_create( name );
307 Grp_setLocal( name ); 313 Grp_setLocal( name );
308 printf( "New local group '%s' created.\n", name ); 314 printf( "New local group '%s' created.\n", name );
315
316 snprintf( grp, MAXCHAR, "%s/groupinfo.lastupdate", Cfg_spoolDir() );
317 Utl_stamp( grp );
309 } 318 }
310 } 319 }
311 320
312 static void 321 static void
313 doDeleteLocalGroup( const char * name ) 322 doDeleteLocalGroup( const char * name )
530 " -n | --online Switch to online mode\n" 539 " -n | --online Switch to online mode\n"
531 " -o | --offline Switch to offline mode\n" 540 " -o | --offline Switch to offline mode\n"
532 " -p | --post Post article on stdin\n" 541 " -p | --post Post article on stdin\n"
533 " -q | --query groups Get group list from server\n" 542 " -q | --query groups Get group list from server\n"
534 " -q | --query desc Get group descriptions from server\n" 543 " -q | --query desc Get group descriptions from server\n"
535 " -q | --query times Get group creation times from server\n"
536 " -r | --server Run as server on stdin/stdout\n" 544 " -r | --server Run as server on stdin/stdout\n"
537 " -R | --requested List articles marked for download\n" 545 " -R | --requested List articles marked for download\n"
538 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n" 546 " -s | --subscribe-over <grp> Add group to fetch list (overview)\n"
539 " -S | --subscribe-full <grp> Add group to fetch list (full)\n" 547 " -S | --subscribe-full <grp> Add group to fetch list (full)\n"
540 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n" 548 " -t | --subscribe-thread <grp> Add group to fetch list (thread)\n"
770 { 778 {
771 if ( strcmp( optarg, "groups" ) == 0 ) 779 if ( strcmp( optarg, "groups" ) == 0 )
772 noffle.queryGrps = TRUE; 780 noffle.queryGrps = TRUE;
773 else if ( strcmp( optarg, "desc" ) == 0 ) 781 else if ( strcmp( optarg, "desc" ) == 0 )
774 noffle.queryDsc = TRUE; 782 noffle.queryDsc = TRUE;
775 else if ( strcmp( optarg, "times" ) == 0 )
776 noffle.queryTimes = TRUE;
777 else 783 else
778 { 784 {
779 fprintf( stderr, "Unknown argument -q %s\n", optarg ); 785 fprintf( stderr, "Unknown argument -q %s\n", optarg );
780 result = EXIT_FAILURE; 786 result = EXIT_FAILURE;
781 } 787 }