comparison lib-src/wakeup.c @ 288:e11d67e05968 r21-0b42

Import from CVS: tag r21-0b42
author cvs
date Mon, 13 Aug 2007 10:35:54 +0200
parents 15872534500d
children 74fd4e045ea6
comparison
equal deleted inserted replaced
287:13a0bd77a29d 288:e11d67e05968
7 #include <unistd.h> 7 #include <unistd.h>
8 #endif 8 #endif
9 9
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <sys/types.h> 11 #include <sys/types.h>
12
13 #ifdef WINDOWSNT
14 #define WIN32_LEAN_AND_MEAN
15 #include <windows.h>
16 #undef sleep
17 #define sleep(t) Sleep ((t) * 1000)
18 #define getppid() (0)
19 #undef HAVE_SYS_TIME_H
20 #endif /* WINDOWSNT */
12 21
13 #ifdef TIME_WITH_SYS_TIME 22 #ifdef TIME_WITH_SYS_TIME
14 #include <sys/time.h> 23 #include <sys/time.h>
15 #include <time.h> 24 #include <time.h>
16 #else 25 #else
33 { 42 {
34 /* Make sure wakeup stops when Emacs goes away. */ 43 /* Make sure wakeup stops when Emacs goes away. */
35 if (getppid () == 1) 44 if (getppid () == 1)
36 return 0; 45 return 0;
37 printf ("Wake up!\n"); 46 printf ("Wake up!\n");
38 fflush (stdout); 47 /* If fflush fails, then our stdout pipe is broken. */
48 if (fflush (stdout) != 0)
49 return 0;
39 /* If using a period of 60, produce the output when the minute 50 /* If using a period of 60, produce the output when the minute
40 changes. */ 51 changes. */
41 if (period == 60) 52 if (period == 60)
42 { 53 {
43 time_t when; 54 time_t when;