view lib-src/=wakeup.c @ 2811:6cc1bf599a56

The GNU coding standards specify that CFLAGS should be left for users to set. * Makefile.in (CFLAGS): Put this in the "things configure might edit" section, and have it default to -g. (ALL_CFLAGS): New variable, set to all the flags which should be passed to compilations. Replace all other uses of CFLAGS with ALL_CFLAGS. (.c.o): New rule, to pass ALL_CFLAGS to compilations. * Makefile.in (DEFS): Remove this; it's always just going to be "-DHAVE_CONFIG_H -Demacs". * Makefile.in (ALLOCA): New variable, whose value we should inherit from the top-level makefile. (etags, ctags): Include ALLOCA in the list of object files that these executables depend on and link.
author Jim Blandy <jimb@redhat.com>
date Sat, 15 May 1993 22:25:51 +0000
parents f756ede77561
children 44df7395bed8
line wrap: on
line source

/* Program to produce output at regular intervals.  */

#include <stdio.h>
#include <time.h>

struct tm *localtime ();

main (argc, argv)
     int argc;
     char **argv;
{
  int period = 60;
  long when;
  struct tm *tp;

  if (argc > 1)
    period = atoi (argv[1]);

  while (1)
    {
      /* Make sure wakeup stops when Emacs goes away.  */
      if (getppid () == 1)
	exit (0);
      printf ("Wake up!\n");
      fflush (stdout);
      /* If using a period of 60, produce the output when the minute
	 changes. */
      if (period == 60)
	{
	  time (&when);
	  tp = localtime (&when);
	  sleep (60 - tp->tm_sec);
	}
      else
	sleep (period);
    }
}