annotate lib-src/=wakeup.c @ 3516:f1ca34ddfd84

(redisplay, echo_area_display): Use redraw_garbaged_frames.
author Richard M. Stallman <rms@gnu.org>
date Sun, 06 Jun 1993 06:46:06 +0000
parents 274570106c6a
children 0810187da5d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
1 /* Program to produce output at regular intervals. */
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
2
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
3 #include <stdio.h>
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
4 #include <time.h>
3437
274570106c6a Include sys/time.h.
Richard M. Stallman <rms@gnu.org>
parents: 3336
diff changeset
5 #include <sys/time.h>
77
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
6
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
7 struct tm *localtime ();
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
8
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
9 main (argc, argv)
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
10 int argc;
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
11 char **argv;
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
12 {
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
13 int period = 60;
3336
44df7395bed8 (main): Make when a time_t.
Richard M. Stallman <rms@gnu.org>
parents: 366
diff changeset
14 time_t when;
77
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
15 struct tm *tp;
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
16
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
17 if (argc > 1)
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
18 period = atoi (argv[1]);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
19
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
20 while (1)
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
21 {
366
f756ede77561 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 77
diff changeset
22 /* Make sure wakeup stops when Emacs goes away. */
f756ede77561 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 77
diff changeset
23 if (getppid () == 1)
f756ede77561 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 77
diff changeset
24 exit (0);
77
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
25 printf ("Wake up!\n");
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
26 fflush (stdout);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
27 /* If using a period of 60, produce the output when the minute
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
28 changes. */
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
29 if (period == 60)
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
30 {
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
31 time (&when);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
32 tp = localtime (&when);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
33 sleep (60 - tp->tm_sec);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
34 }
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
35 else
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
36 sleep (period);
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
37 }
f2a4b896fcf4 Initial revision
David J. MacKenzie <djm@gnu.org>
parents:
diff changeset
38 }