view lib-src/=wakeup.c @ 4157:d2316090d029

(prompt-for-change-log-name): Autoload this (for vc-comment-to-change-log). (add-change-log-entry): Take optional fourth arg NEW-ENTRY. If non-nil, never append to an existing entry. (change-log-fill-paragraph): New function. It might be nice to have a general feature to replace this. The idea I have is a variable giving a regexp matching text which should not be moved from bol by filling. change-log-mode would set this to "^\\s *\\s(". But I don't feel up to implementing that today. (change-log-mode-map): New defvar for keymap. Bind M-q to change-log-fill-paragraph in it. (change-log-mode): Use that as local map.
author Roland McGrath <roland@gnu.org>
date Mon, 19 Jul 1993 00:39:21 +0000
parents d253c8a4b7e5
children 1fc792473491
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);
    }
}