optimization for normal masks requires keeping ptr to associated leaf,
[unix-history] / usr / src / usr.bin / talk / msgs.c
CommitLineData
d0aeaf5a 1/*
574beccd
KB
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
f9ac90b4 4 *
cb956e54 5 * %sccs.include.redist.c%
d0aeaf5a
DF
6 */
7
963ce42e 8#ifndef lint
574beccd 9static char sccsid[] = "@(#)msgs.c 8.1 (Berkeley) %G%";
f9ac90b4 10#endif /* not lint */
031c96ae
MK
11
12/*
963ce42e 13 * A package to display what is happening every MSG_INTERVAL seconds
031c96ae
MK
14 * if we are slow connecting.
15 */
16
a4e94754 17#include <sys/time.h>
031c96ae
MK
18#include <signal.h>
19#include <stdio.h>
031c96ae
MK
20#include "talk.h"
21
22#define MSG_INTERVAL 4
031c96ae 23
963ce42e
MK
24char *current_state;
25int current_line = 0;
031c96ae 26
a4e94754 27void
031c96ae
MK
28disp_msg()
29{
963ce42e 30 message(current_state);
031c96ae
MK
31}
32
33start_msgs()
34{
82439d4b 35 struct itimerval itimer;
963ce42e
MK
36
37 message(current_state);
38 signal(SIGALRM, disp_msg);
82439d4b
EW
39 itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
40 itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
a4e94754 41 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
031c96ae
MK
42}
43
44end_msgs()
45{
82439d4b 46 struct itimerval itimer;
963ce42e 47
963ce42e
MK
48 timerclear(&itimer.it_value);
49 timerclear(&itimer.it_interval);
a4e94754 50 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
82439d4b 51 signal(SIGALRM, SIG_DFL);
031c96ae 52}