view lib-src/=wakeup.c @ 20240:963e9cda8f04

Support for Japanese display on DOS/V systems. (screen_old_address, screen_virtual_segment, screen_virtual_offset): New variables. (dosv_refresh_virtual_screen): New function. (dos_direct_output, dos_set_window_size, IT_write_glyphs, IT_clear_end_of_line, IT_clear_screen, IT_display_cursor, IT_reset_terminal_modes, XMenuActivate, abort): Call dosv_refresh_virtual_screen if under DOS/V. (IT_set_terminal_modes): If under DOS/V, update the address of primary screen buffer. (internal_terminal_init): Zero out screen_old_address, in case Emacs was dumped under DOS/V. (dos_get_saved_screen): Return failure indication if no screen was saved.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 10 Nov 1997 14:49:40 +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);
    }
}