=================================================================== RCS file: /cvsroot/lcdproc/lcdproc/server/main.c,v retrieving revision 1.38.2.18 retrieving revision 1.38.2.18.2.4 diff -u -r1.38.2.18 -r1.38.2.18.2.4 --- lcdproc/lcdproc/server/main.c 2002/05/14 11:30:24 1.38.2.18 +++ lcdproc/lcdproc/server/main.c 2002/11/14 03:11:12 1.38.2.18.2.4 @@ -10,6 +10,7 @@ * 2001, Rene Wagner * 2002, Mike Patnode * 2002, Guillaume Filion + * 2002, Bernhard Tittelbach * * * Contains main(), plus signal callback functions and a help screen. @@ -273,6 +274,8 @@ strncpy( user, UNSET_STR, sizeof(user) ); daemon_mode = UNSET_INT; enable_server_screen = UNSET_INT; + heartbeat = UNSET_INT; + heartbeat_state = UNSET_INT; backlight = UNSET_INT; backlight_state = UNSET_INT; @@ -304,7 +307,7 @@ int process_command_line (int argc, char **argv) { - char c; + int c; /*report( RPT_INFO, "process_command_line()" );*/ @@ -461,6 +464,45 @@ } } + if( heartbeat == UNSET_INT ) { + s = config_get_string( "server", "heartbeat", 0, UNSET_STR ); + if( strcmp( s, "on" ) == 0 ) { + heartbeat = HEARTBEAT_ON; + heartbeat_state = heartbeat; + } + else if( strcmp( s, "off" ) == 0 ) { + heartbeat = HEARTBEAT_OFF; + heartbeat_state = heartbeat; + } + else if( strcmp( s, "slash" ) == 0 ) { + heartbeat = HEARTBEAT_SLASH; + heartbeat_state = heartbeat; + } + else if( strcmp( s, "open" ) == 0 ) { + heartbeat = HEARTBEAT_OPEN; + } + else if( strcmp( s, UNSET_STR ) != 0 ) { + report( RPT_ERR, "Backlight should be on, off, slash or open" ); + } + } + + if( heartbeat == HEARTBEAT_OPEN && heartbeat_state == UNSET_INT ) { + s = config_get_string( "server", "initialheartbeat", 0, UNSET_STR ); + if( strcmp( s, "on" ) == 0 ) { + heartbeat_state = HEARTBEAT_ON; + } + else if( strcmp( s, "off" ) == 0 ) { + heartbeat_state = HEARTBEAT_OFF; + } + else if( strcmp( s, "slash" ) == 0 ) { + heartbeat = HEARTBEAT_SLASH; + heartbeat_state = heartbeat; + } + else if( strcmp( s, UNSET_STR ) != 0 ) { + report( RPT_ERR, "Initial heartbeat should be on, off, or slash" ); + } + } + if( backlight == UNSET_INT ) { s = config_get_string( "server", "backlight", 0, UNSET_STR ); if( strcmp( s, "on" ) == 0 ) { @@ -622,6 +664,11 @@ if (default_duration == UNSET_INT) default_duration = DEFAULT_SCREEN_DURATION; + if (heartbeat == UNSET_INT) + heartbeat = HEARTBEAT_OPEN; + if (backlight_state == UNSET_INT) + heartbeat_state = HEARTBEAT_ON; + if (backlight == UNSET_INT) backlight = BACKLIGHT_OPEN; if (backlight_state == UNSET_INT) @@ -913,6 +960,7 @@ free(message); } else { report(RPT_DEBUG, "Error: Received NULL pointer"); + free(message); /*fixes memory leak*/ } if (s && s->timeout != -1) {