view lib-src/=wakeup.c @ 26965:048db40ddca6

Version 1.2 is released. (antlr): This package has a web page. Menu/keymap additions for commenting/uncommenting regions. Suggested by Dale Davis <Dale_Davis@securify.com>. (antlr-mode-map): New binding [C-c C-c]. (antlr-mode-menu): New entries. Respect Emacs conventions. ((require 'cl)): Only use during compilation. (antlr-language-for-option): New function to avoid using `find'. (antlr-mode): Use it. (antlr-with-syntax-table): Define new instead using XEmacs' one. (antlr-imenu-create-index-function): Change accordingly. (antlr-inside-rule-p): Ditto. (antlr-end-of-rule): Ditto. (antlr-end-of-body): Ditto. (antlr-beginning-of-rule): Ditto. (antlr-indent-line): Ditto. Really use `antlr-tab-offset-alist'. (antlr-set-tabs): Don't use hard-coded values. Minor navigation changes. Not perfect, but this won't be possible without a huge time penalty. (antlr-skip-exception-part): Be more specific. (antlr-skip-file-prelude): Don't skip action prelude of next rule. Renamed from `antlr-skip-grammar-header'. (antlr-next-rule): Change accordingly. (antlr-end-of-body): Ditto. Better error message. (antlr-beginning-of-body): Better error message. (antlr-imenu-create-index-function): Skip rule action prelude. Minor syntax highlighting changes. (antlr-font-lock-default-face): Deletia. (antlr-font-lock-tokendef-face): Changed color. (antlr-font-lock-tokenref-face): Changed color. (antlr-font-lock-literal-face): Changed color. (antlr-font-lock-additional-keywords): Minor changes.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 21 Dec 1999 13:59:50 +0000
parents f41d9619ffc4
children
line wrap: on
line source

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

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <sys/types.h>

#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif

struct tm *localtime ();

void
main (argc, argv)
     int argc;
     char **argv;
{
  int period = 60;
  time_t 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);
    }
}