1 /* 2 * Copyright (c) 1983, 1993 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 8.1 (Berkeley) 06/06/93"; 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 <sys/time.h> 18 #include <signal.h> 19 #include <stdio.h> 20 #include "talk.h" 21 22 #define MSG_INTERVAL 4 23 24 char *current_state; 25 int current_line = 0; 26 27 void 28 disp_msg() 29 { 30 message(current_state); 31 } 32 33 start_msgs() 34 { 35 struct itimerval itimer; 36 37 message(current_state); 38 signal(SIGALRM, disp_msg); 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; 41 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); 42 } 43 44 end_msgs() 45 { 46 struct itimerval itimer; 47 48 timerclear(&itimer.it_value); 49 timerclear(&itimer.it_interval); 50 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); 51 signal(SIGALRM, SIG_DFL); 52 } 53