Commit | Line | Data |
---|---|---|
d0aeaf5a DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
963ce42e | 7 | #ifndef lint |
d0aeaf5a DF |
8 | static char sccsid[] = "@(#)msgs.c 5.1 (Berkeley) %G%"; |
9 | #endif not lint | |
031c96ae MK |
10 | |
11 | /* | |
963ce42e | 12 | * A package to display what is happening every MSG_INTERVAL seconds |
031c96ae MK |
13 | * if we are slow connecting. |
14 | */ | |
15 | ||
16 | #include <signal.h> | |
17 | #include <stdio.h> | |
18 | #include <sys/time.h> | |
19 | #include "talk.h" | |
20 | ||
21 | #define MSG_INTERVAL 4 | |
22 | #define LONG_TIME 100000 | |
23 | ||
963ce42e MK |
24 | char *current_state; |
25 | int current_line = 0; | |
031c96ae | 26 | |
963ce42e MK |
27 | static struct itimerval itimer; |
28 | static struct timeval wait = { MSG_INTERVAL , 0}; | |
29 | static struct timeval undo = { LONG_TIME, 0}; | |
30 | ||
031c96ae MK |
31 | disp_msg() |
32 | { | |
963ce42e MK |
33 | |
34 | message(current_state); | |
031c96ae MK |
35 | } |
36 | ||
37 | start_msgs() | |
38 | { | |
963ce42e MK |
39 | |
40 | message(current_state); | |
41 | signal(SIGALRM, disp_msg); | |
42 | itimer.it_value = itimer.it_interval = wait; | |
43 | setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); | |
031c96ae MK |
44 | } |
45 | ||
46 | end_msgs() | |
47 | { | |
963ce42e MK |
48 | |
49 | signal(SIGALRM, SIG_IGN); | |
50 | timerclear(&itimer.it_value); | |
51 | timerclear(&itimer.it_interval); | |
52 | setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); | |
031c96ae | 53 | } |