comparison src/noffle.c @ 122:d00adc26d77a noffle

[svn] Do not acquire global lock for prniting help
author enz
date Wed, 19 Jul 2000 20:47:41 +0100
parents d45b0abe7c79
children 3c71e28c8eef
comparison
equal deleted inserted replaced
121:a0a96e1021c3 122:d00adc26d77a
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 165 2000-06-25 18:42:10Z bears $ 13 $Id: noffle.c 176 2000-07-19 19:47:41Z enz $
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
53 struct Noffle 53 struct Noffle
54 { 54 {
55 Bool queryGrps; 55 Bool queryGrps;
56 Bool queryDsc; 56 Bool queryDsc;
57 Bool queryTimes; 57 Bool queryTimes;
58 Bool interactive; 58 Bool lockAtStartup;
59 } noffle = { FALSE, FALSE, FALSE, TRUE }; 59 } noffle = { FALSE, FALSE, FALSE, TRUE };
60 60
61 static void 61 static void
62 doArt( const char *msgId ) 62 doArt( const char *msgId )
63 { 63 {
571 } 571 }
572 Log_dbg( "Changed to directory '%s'", Cfg_spoolDir() ); 572 Log_dbg( "Changed to directory '%s'", Cfg_spoolDir() );
573 } 573 }
574 574
575 static Bool 575 static Bool
576 initNoffle( Bool interactive ) 576 initNoffle( void )
577 { 577 {
578 Log_init( "noffle", interactive, LOG_NEWS ); 578 Log_init( "noffle", noffle.lockAtStartup, LOG_NEWS );
579 Cfg_read(); 579 Cfg_read();
580 Log_dbg( "NOFFLE version %s", Cfg_version() ); 580 Log_dbg( "NOFFLE version %s", Cfg_version() );
581 noffle.interactive = interactive; 581 if ( noffle.lockAtStartup )
582 if ( interactive )
583 if ( ! Lock_openDatabases() ) 582 if ( ! Lock_openDatabases() )
584 return FALSE; 583 return FALSE;
585 enableCorefiles(); 584 enableCorefiles();
586 return TRUE; 585 return TRUE;
587 } 586 }
588 587
589 static void 588 static void
590 closeNoffle( void ) 589 closeNoffle( void )
591 { 590 {
592 if ( noffle.interactive ) 591 if ( noffle.lockAtStartup )
593 Lock_closeDatabases(); 592 Lock_closeDatabases();
594 } 593 }
595 594
596 static RETSIGTYPE 595 static RETSIGTYPE
597 bugReport( int sig ) 596 bugReport( int sig )
669 signal( SIGINT, logSignal ); 668 signal( SIGINT, logSignal );
670 signal( SIGTERM, logSignal ); 669 signal( SIGTERM, logSignal );
671 signal( SIGPIPE, logSignal ); 670 signal( SIGPIPE, logSignal );
672 c = getopt_long( argc, argv, "a:c:C:dD:efghlm:onpq:rRs:S:t:u:v", 671 c = getopt_long( argc, argv, "a:c:C:dD:efghlm:onpq:rRs:S:t:u:v",
673 longOptions, NULL ); 672 longOptions, NULL );
674 if ( ! initNoffle( c != 'r' ) ) 673 noffle.lockAtStartup = ! ( c == 'r' || c == 'h' );
674 if ( ! initNoffle() )
675 return EXIT_FAILURE; 675 return EXIT_FAILURE;
676 result = EXIT_SUCCESS; 676 result = EXIT_SUCCESS;
677 switch ( c ) 677 switch ( c )
678 { 678 {
679 case 0: 679 case 0: