Annotation of 43BSDReno/usr.bin/talk/msgs.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)msgs.c     5.5 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: /* 
        !            25:  * A package to display what is happening every MSG_INTERVAL seconds
        !            26:  * if we are slow connecting.
        !            27:  */
        !            28: 
        !            29: #include <signal.h>
        !            30: #include <stdio.h>
        !            31: #include <sys/time.h>
        !            32: #include "talk.h"
        !            33: 
        !            34: #define MSG_INTERVAL 4
        !            35: 
        !            36: char   *current_state;
        !            37: int    current_line = 0;
        !            38: 
        !            39: disp_msg()
        !            40: {
        !            41: 
        !            42:        message(current_state);
        !            43: }
        !            44: 
        !            45: start_msgs()
        !            46: {
        !            47:        struct itimerval itimer;
        !            48: 
        !            49:        message(current_state);
        !            50:        signal(SIGALRM, disp_msg);
        !            51:        itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
        !            52:        itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
        !            53:        setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
        !            54: }
        !            55: 
        !            56: end_msgs()
        !            57: {
        !            58:        struct itimerval itimer;
        !            59: 
        !            60:        timerclear(&itimer.it_value);
        !            61:        timerclear(&itimer.it_interval);
        !            62:        setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
        !            63:        signal(SIGALRM, SIG_DFL);
        !            64: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.