(Vhistory_length, Qhistory_length): New variables.
[emacs.git] / lib-src / wakeup.c
blob389519ba1f7f3fa79ffba2298b3497ca0f9cc532
1 /* Program to produce output at regular intervals. */
3 #ifdef HAVE_CONFIG_H
4 #include <config.h>
5 #endif
7 #include <stdio.h>
8 #include <sys/types.h>
10 #ifdef TIME_WITH_SYS_TIME
11 #include <sys/time.h>
12 #include <time.h>
13 #else
14 #ifdef HAVE_SYS_TIME_H
15 #include <sys/time.h>
16 #else
17 #include <time.h>
18 #endif
19 #endif
21 struct tm *localtime ();
23 void
24 main (argc, argv)
25 int argc;
26 char **argv;
28 int period = 60;
29 time_t when;
30 struct tm *tp;
32 if (argc > 1)
33 period = atoi (argv[1]);
35 while (1)
37 /* Make sure wakeup stops when Emacs goes away. */
38 if (getppid () == 1)
39 exit (0);
40 printf ("Wake up!\n");
41 fflush (stdout);
42 /* If using a period of 60, produce the output when the minute
43 changes. */
44 if (period == 60)
46 time (&when);
47 tp = localtime (&when);
48 sleep (60 - tp->tm_sec);
50 else
51 sleep (period);