diff 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
line wrap: on
line diff
--- a/lib-src/wakeup.c	Mon Aug 13 10:35:07 2007 +0200
+++ b/lib-src/wakeup.c	Mon Aug 13 10:35:54 2007 +0200
@@ -10,6 +10,15 @@
 #include <stdio.h>
 #include <sys/types.h>
 
+#ifdef WINDOWSNT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef sleep
+#define sleep(t) Sleep ((t) * 1000)
+#define getppid() (0)
+#undef HAVE_SYS_TIME_H
+#endif /* WINDOWSNT */
+
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
 #include <time.h>
@@ -35,7 +44,9 @@
       if (getppid () == 1)
 	return 0;
       printf ("Wake up!\n");
-      fflush (stdout);
+      /* If fflush fails, then our stdout pipe is broken. */
+      if (fflush (stdout) != 0)
+	return 0;
       /* If using a period of 60, produce the output when the minute
 	 changes. */
       if (period == 60)