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