view lib-src/=wakeup.c @ 9389:fec6bd86e836

(compilation-mode-font-lock-keywords, rmail-summary-font-lock-keywords, dired-font-lock-keywords, shell-font-lock-keywords, texi-font-lock-keywords, perl-font-lock-keywords): Deleted. (font-lock-mode): Doc fix; use add/remove-hook, not setq; removed make-local-variable of font-lock-no-comments. (font-lock-set-defaults): Do it there, and use: (font-lock-defaults-alist): Use it to set font-lock-keywords, font-lock-keywords-case-fold-search and font-lock-no-comments. (turn-on-font-lock): New function. (font-lock-fontify-buffer): Made interruptible; deleted messages. (font-lock-fontify-region): Made syntax state reliable by widening within new restriction; let cstart and cend for speed; outputs message. (font-lock-after-change-function): Remove spurious goto-char and use forward-line, not 1+ end-of-line, for end of fontification region. (font-lock-any-properties-p): Removed, use text-property-not-all. (font-lock-*-face): facename values are themselves. (font-lock-variable-name-face, font-lock-reference-face): New vars. (font-lock-doc-string-face): Removed. (font-lock-keywords): Extended value syntax. (font-lock-hack-keywords): Cope with it; outputs initial message. Merged in face-lock.el: (font-lock-display-type, font-lock-background-mode) (font-lock-face-attributes): New variables, use it. (font-lock-make-face): New function, use them.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Oct 1994 10:23:26 +0000
parents 1fc792473491
children dd3b83e4ceb0
line wrap: on
line source

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

#include <config.h>

#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 ();

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);
    }
}