always die, we can't survive some of the compile errors
[unix-history] / usr / src / usr.bin / talk / msgs.c
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* %sccs.include.redist.c%
*/
#ifndef lint
static char sccsid[] = "@(#)msgs.c 5.6 (Berkeley) %G%";
#endif /* not lint */
/*
* A package to display what is happening every MSG_INTERVAL seconds
* if we are slow connecting.
*/
#include <sys/time.h>
#include <signal.h>
#include <stdio.h>
#include "talk.h"
#define MSG_INTERVAL 4
char *current_state;
int current_line = 0;
void
disp_msg()
{
message(current_state);
}
start_msgs()
{
struct itimerval itimer;
message(current_state);
signal(SIGALRM, disp_msg);
itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
}
end_msgs()
{
struct itimerval itimer;
timerclear(&itimer.it_value);
timerclear(&itimer.it_interval);
setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
signal(SIGALRM, SIG_DFL);
}