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 7 #ifndef lint 8 static char sccsid[] = "@(#)msgs.c 5.1 (Berkeley) 6/6/85"; 9 #endif not lint 10 11 /* 12 * A package to display what is happening every MSG_INTERVAL seconds 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 24 char *current_state; 25 int current_line = 0; 26 27 static struct itimerval itimer; 28 static struct timeval wait = { MSG_INTERVAL , 0}; 29 static struct timeval undo = { LONG_TIME, 0}; 30 31 void 32 disp_msg() 33 { 34 35 message(current_state); 36 } 37 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 end_msgs() 48 { 49 50 signal(SIGALRM, SIG_IGN); 51 timerclear(&itimer.it_value); 52 timerclear(&itimer.it_interval); 53 setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); 54 } 55