fixes by M. Dolze: typos in lcdproc.conf, init reporting, harmonize daemonizing

This commit is contained in:
marschap
2006-04-24 11:18:25 +00:00
parent ff0cb79b17
commit b9632af264
2 changed files with 32 additions and 23 deletions
+19 -19
View File
@@ -14,8 +14,8 @@ ReportLevel=2
# report to to syslog ? # report to to syslog ?
ReportToSyslog=false ReportToSyslog=false
# stay in foreground ? # Run in background (Default: true)
Foreground=false #Daemonize=true
# slow down initial announcement of modes (in 1/100s) # slow down initial announcement of modes (in 1/100s)
#delay=2 #delay=2
@@ -25,61 +25,61 @@ Foreground=false
[CPU] [CPU]
# Show screen # Show screen
Active = True Active=True
OnTime = 1 OnTime=1
OffTime = 2 OffTime=2
ShowInvisible = false ShowInvisible=false
[Memory] [Memory]
# Show screen # Show screen
Active = True Active=True
[Load] [Load]
# Show screen # Show screen
Active = True Active=True
[TimeDate] [TimeDate]
# Show screen # Show screen
Active = True Active=True
[About] [About]
# Show screen # Show screen
Active = false Active=false
[SMP-CPU] [SMP-CPU]
# Show screen # Show screen
Active = false Active=false
[OldTime] [OldTime]
# Show screen # Show screen
Active = false Active=false
[BigClock] [BigClock]
# Show screen # Show screen
Active = false Active=false
[Uptime] [Uptime]
# Show screen # Show screen
Active = false Active=false
[Battery] [Battery]
# Show screen # Show screen
Active = false Active=false
[CPUGraph] [CPUGraph]
# Show screen # Show screen
Active = false Active=false
[ProcSize] [ProcSize]
# Show screen # Show screen
Active = false Active=false
[Disk] [Disk]
# Show screen # Show screen
Active = false Active=false
[MiniClock] [MiniClock]
# Show screen # Show screen
Active = True Active=True
# EOF # EOF
+13 -4
View File
@@ -73,7 +73,8 @@ static int process_configfile(char *cfgfile);
#define UNSET_STR "\01" #define UNSET_STR "\01"
#define DEFAULT_SERVER "127.0.0.1" #define DEFAULT_SERVER "127.0.0.1"
#define DEFAULT_CONFIGFILE SYSCONFDIR "/lcdproc.conf" #define DEFAULT_CONFIGFILE SYSCONFDIR "/lcdproc.conf"
#define DEFAULT_REPORTDEST RPT_DEST_STDERR
#define DEFAULT_REPORTLEVEL RPT_WARNING
/* list of modes to run */ /* list of modes to run */
mode sequence[] = mode sequence[] =
@@ -104,7 +105,7 @@ static int islow = -1;
char * progname = "lcdproc"; char * progname = "lcdproc";
char * server = NULL; char * server = NULL;
int port = LCDPORT; int port = LCDPORT;
int daemonize = FALSE; int daemonize = UNSET_INT;
static int report_level = UNSET_INT; static int report_level = UNSET_INT;
static int report_dest = UNSET_INT; static int report_dest = UNSET_INT;
char configfile[256]; /* a lot of space in the executable. */ char configfile[256]; /* a lot of space in the executable. */
@@ -159,7 +160,6 @@ void clear_modes()
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int daemonize = FALSE;
int error = 0; int error = 0;
/* get uname information */ /* get uname information */
@@ -184,6 +184,15 @@ main(int argc, char **argv)
if (strcmp(configfile, UNSET_STR) != 0) if (strcmp(configfile, UNSET_STR) != 0)
CHAIN( error, process_configfile(configfile) ); CHAIN( error, process_configfile(configfile) );
/* Set default options */
if (report_dest == UNSET_INT )
report_dest = DEFAULT_REPORTDEST;
if( report_level == UNSET_INT )
report_level = DEFAULT_REPORTLEVEL;
/* Set reporting settings */
set_reporting("lcdproc", report_level, report_dest);
CHAIN_END( error, "Error in config file or command line\n" ); CHAIN_END( error, "Error in config file or command line\n" );
if (server == NULL) if (server == NULL)
@@ -333,7 +342,7 @@ process_configfile(char *configfile)
} }
} }
if (daemonize == UNSET_INT) { if (daemonize == UNSET_INT) {
daemonize = config_get_bool(progname, "Foreground", 0, 1); daemonize = config_get_bool(progname, "Daemonize", 0, 1);
} }
if (islow < 0) { if (islow < 0) {
islow = config_get_int(progname, "delay", 0, -1); islow = config_get_int(progname, "delay", 0, -1);