summaryrefslogtreecommitdiff
path: root/core/opiealarm
Unidiff
Diffstat (limited to 'core/opiealarm') (more/less context) (show whitespace changes)
-rw-r--r--core/opiealarm/Makefile4
-rw-r--r--core/opiealarm/config.in2
-rw-r--r--core/opiealarm/opiealarm.c5
3 files changed, 4 insertions, 7 deletions
diff --git a/core/opiealarm/Makefile b/core/opiealarm/Makefile
index 0c8467e..255083d 100644
--- a/core/opiealarm/Makefile
+++ b/core/opiealarm/Makefile
@@ -17,10 +17,6 @@ $(DESTDIR)/opiealarm: opiealarm.c
17 chmod u+s $(DESTDIR)/opiealarm 17 chmod u+s $(DESTDIR)/opiealarm
18 chown root $(DESTDIR)/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n" 18 chown root $(DESTDIR)/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n"
19 19
20clean: 20clean:
21 -rm -f *~ core 21 -rm -f *~ core
22 22
23install:
24 cp $(DESTDIR)/opiealarm $(INSTALL_ROOT)/opt/QtPalmtop/bin
25 chown root $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm
26 chmod u+s $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n"
diff --git a/core/opiealarm/config.in b/core/opiealarm/config.in
index 2be9bd4..f86d01c 100644
--- a/core/opiealarm/config.in
+++ b/core/opiealarm/config.in
@@ -1,4 +1,4 @@
1config OPIEALARM 1config OPIEALARM
2 boolean "opie-opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)" 2 boolean "Opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)"
3 depends ! TARGET_X86 3 depends ! TARGET_X86
4 default "y" 4 default "y"
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 998cabd..90a743f 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -90,12 +90,13 @@ int fork_with_pidfile ( void )
90 exit ( 0 ); 90 exit ( 0 );
91 } 91 }
92 else if ( pid < 0 ) { 92 else if ( pid < 0 ) {
93 perror ( "forking failed" ); 93 perror ( "forking failed" );
94 return 0; 94 return 0;
95 } 95 }
96 //sleep( 60 );
96 97
97 // child process needs to react to SIGUSR2. This is sent when 98 // child process needs to react to SIGUSR2. This is sent when
98 // a new opiealarm process is started. 99 // a new opiealarm process is started.
99 100
100 signal ( SIGUSR2, sig_handler_child ); 101 signal ( SIGUSR2, sig_handler_child );
101 102
@@ -203,13 +204,13 @@ int main ( int argc, char **argv )
203 return opt; 204 return opt;
204 } 205 }
205 206
206 207
207int suspend ( int fix_rtc ) 208int suspend ( int fix_rtc )
208{ 209{
209 FILE *fp; 210 FILE *fp = NULL;
210 char buf [64]; 211 char buf [64];
211 time_t alrt, syst, rtct; 212 time_t alrt, syst, rtct;
212 struct tm alr, sys, rtc; 213 struct tm alr, sys, rtc;
213 int fd; 214 int fd;
214 int rtc_sys_diff; 215 int rtc_sys_diff;
215 216
@@ -255,13 +256,13 @@ int suspend ( int fix_rtc )
255 break; // ( 1, TIMEFILE ); 256 break; // ( 1, TIMEFILE );
256 257
257 if ( !fgets ( buf, sizeof( buf ) - 1, fp )) 258 if ( !fgets ( buf, sizeof( buf ) - 1, fp ))
258 break; // ( 1, TIMEFILE ); 259 break; // ( 1, TIMEFILE );
259 260
260 fclose ( fp ); 261 fclose ( fp );
261 fp = 0; 262 fp = NULL;
262 263
263 alrt = atoi ( buf ); // get the alarm time 264 alrt = atoi ( buf ); // get the alarm time
264 265
265 if ( alrt == 0 ) 266 if ( alrt == 0 )
266 break; // ( 0, TIMEFILE " contains an invalid time description" ); 267 break; // ( 0, TIMEFILE " contains an invalid time description" );
267 alrt -= 5; // wake up 5 sec before the specified time 268 alrt -= 5; // wake up 5 sec before the specified time