diff options
Diffstat (limited to 'usr/src/cmd/cmd-inet/usr.bin/talk/msgs.c')
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.bin/talk/msgs.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/talk/msgs.c b/usr/src/cmd/cmd-inet/usr.bin/talk/msgs.c new file mode 100644 index 0000000000..4560f67a49 --- /dev/null +++ b/usr/src/cmd/cmd-inet/usr.bin/talk/msgs.c @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1994 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * a package to display what is happening every MSG_INTERVAL seconds + * if we are slow connecting. + */ + +#include <signal.h> +#include <stdio.h> +#include <sys/time.h> +#include "talk.h" + +#ifdef SYSV +#define signal(s, f) sigset(s, f) +#endif /* SYSV */ + +#define MSG_INTERVAL 4 +#define LONG_TIME 100000 + +char *current_state; +int current_line = 0; + +static struct itimerval itimer; +static struct timeval wait = { MSG_INTERVAL, 0}; + + +static void +disp_msg() +{ + message(current_state); +} + +void +start_msgs() +{ + message(current_state); + signal(SIGALRM, (void (*)())disp_msg); + itimer.it_value = itimer.it_interval = wait; + setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); +} + +void +end_msgs() +{ + signal(SIGALRM, SIG_IGN); + timerclear(&itimer.it_value); + timerclear(&itimer.it_interval); + setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); +} |