|
|
1.1 ! root 1: /* $Header: /a/guest/moore/talk/RCS/msgs.c,v 1.4 83/07/06 00:17:22 moore Exp $ */ ! 2: ! 3: /* ! 4: * a package to display what is happening every MSG_INTERVAL seconds ! 5: * if we are slow connecting. ! 6: */ ! 7: ! 8: #include <signal.h> ! 9: #include <stdio.h> ! 10: #include <sys/time.h> ! 11: #include "talk.h" ! 12: ! 13: #define MSG_INTERVAL 4 ! 14: #define LONG_TIME 100000 ! 15: ! 16: char *current_state; ! 17: int current_line = 0; ! 18: ! 19: static struct itimerval itimer; ! 20: static struct timeval wait = { MSG_INTERVAL , 0}; ! 21: static struct timeval undo = { LONG_TIME, 0}; ! 22: ! 23: ! 24: disp_msg() ! 25: { ! 26: message(current_state); ! 27: } ! 28: ! 29: start_msgs() ! 30: { ! 31: message(current_state); ! 32: signal(SIGALRM, disp_msg); ! 33: itimer.it_value = itimer.it_interval = wait; ! 34: setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); ! 35: } ! 36: ! 37: end_msgs() ! 38: { ! 39: signal(SIGALRM, SIG_IGN); ! 40: timerclear(&itimer.it_value); ! 41: timerclear(&itimer.it_interval); ! 42: setitimer(ITIMER_REAL, &itimer, (struct timerval *)0); ! 43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.