/* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)msgs.c 5.5 (Berkeley) 06/01/90"; #endif /* not lint */ /* * A package to display what is happening every MSG_INTERVAL seconds * if we are slow connecting. */ #include #include #include #include "talk.h" #define MSG_INTERVAL 4 char *current_state; int current_line = 0; disp_msg() { message(current_state); } start_msgs() { struct itimerval itimer; message(current_state); signal(SIGALRM, disp_msg); itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL; itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); } end_msgs() { struct itimerval itimer; timerclear(&itimer.it_value); timerclear(&itimer.it_interval); setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); signal(SIGALRM, SIG_DFL); }