summaryrefslogtreecommitdiff
blob: 5fc8cd72e2674bcb0a79d92520a0b6b81f69dc55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
===================================================================
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) {