tcsh 5.20.02 available [and ywho source]
Christos S. Zoulas
christos at theory.tn.cornell.edu
Sun Dec 16 05:08:04 AEST 1990
Hello,
Tcsh-5.20.02 is now available from tesla.ee.cornell.edu (128.84.253.11),
in /pub/tcsh-5.20.
Tcsh is a set of patches to the 4.3BSD csh that add amongst other
things command line editing and completion.
In order to compile tcsh, you will need a copy of the 4.3BSD csh, or
a copy of the 4.3BSD-tahoe, or a copy of the 4.3BSD-reno csh.
I would like to thank everybody for their bug reports.
I would also like to thank the following people for fixing bugs, testing,
and re-writing parts of the code.
Mark Davies mark at comp.vuw.ac.nz
Matt Day mday at iconsys.icon.com
Per Hedeland per at erix.ericsson.se
Borje Josefsson bj at dc.luth.se
Dan Karron karron at karron.med.nyu.edu
Dan Oscarsson dan at dna.lth.se
Eric Schnoebelen schonebe at convex.com
Jaap Vermeulen jaap at sequent.com
Johan Widen jw at sics.se
The following binaries are available for 5.20.02:
-rwxr-xr-x 1 christos 144832 Dec 14 18:34 tcsh.Dynix_3.Z
-rwxr-xr-x 1 christos 181250 Dec 14 18:30 tcsh.Dynix_ptx.Z
-rwxr-xr-x 1 christos 153730 Dec 14 17:01 tcsh.hp9000s300-hpux7.0.Z
-rwxr-xr-x 1 christos 198911 Dec 14 17:01 tcsh.ibm370-aixG9.9.Z
-rwxr-xr-x 1 christos 180207 Dec 14 17:01 tcsh.iris4d-irix3.3.1.Z
-rwxr-xr-x 1 christos 155830 Dec 14 17:01 tcsh.rs6000-aix3.1.Z
-rwxr-xr-x 1 christos 131933 Dec 14 17:01 tcsh.sun3-sunos4.1.Z
-rwxr-xr-x 1 christos 155562 Dec 14 17:01 tcsh.sun4-sunos4.1.Z
Also I would like to mention that this is the last tcsh announcement
in alt.sources. From now on, tcsh announcements will be posted in
comp.unix.shell.
Also I am adding the source for ywho/yusers/yuptime to redeem myself!
Have a Merry Christmas!
christos
PS: I will be out of the country for the next two weeks, so don't expect
immediate answers to your mail messages...
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: ywho ywho/Makefile ywho/ywho.1v ywho/ywho.c ywho/yhosts
# Wrapped by christos at guillemin on Sat Dec 15 12:51:35 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'ywho' ; then
echo shar: Creating directory \"'ywho'\"
mkdir 'ywho'
fi
if test -f 'ywho/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ywho/Makefile'\"
else
echo shar: Extracting \"'ywho/Makefile'\" \(650 characters\)
sed "s/^X//" >'ywho/Makefile' <<'END_OF_FILE'
X#
X# Makefile for ywho
X#
XSHELL = /bin/sh
XCFLAGS = -O
X#CFLAGS = -g -DDEBUG
XDEST = /usr/local/bin
XOBJS = ywho.o
XPROGRAM = ywho
XSRCS = ywho.c
XCC = cc
X
Xall: $(PROGRAM)
X
X$(PROGRAM): $(OBJS)
X cc $(CFLAGS) $(OBJS) -o $(PROGRAM) -lrpcsvc
X
Xclean:; rm -f $(OBJS) ywho yusers yuptime
X
Xinstall: $(PROGRAM)
X rm -f ${DEST}/ywho ${DEST}/yusers ${DEST}/yuptime
X install -s $(PROGRAM) $(DEST)
X ln $(DEST)/$(PROGRAM) $(DEST)/yusers
X ln $(DEST)/$(PROGRAM) $(DEST)/yuptime
X
Xtags: $(HDRS) $(SRCS)
X ctags $(HDRS) $(SRCS)
X
Xdepend:
X gendep -m Makefile $(CFLAGS) $(SRCS)
X
X# DO NOT DELETE THIS LINE
END_OF_FILE
if test 650 -ne `wc -c <'ywho/Makefile'`; then
echo shar: \"'ywho/Makefile'\" unpacked with wrong size!
fi
# end of 'ywho/Makefile'
fi
if test -f 'ywho/ywho.1v' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ywho/ywho.1v'\"
else
echo shar: Extracting \"'ywho/ywho.1v'\" \(2440 characters\)
sed "s/^X//" >'ywho/ywho.1v' <<'END_OF_FILE'
X.TH YWHO 1V "28 February 1988"
X.SH NAME
Xywho/yusers/yuptime \- who, users, uptime on clients in a sun-RPC network.
X.SH SYNOPSIS
X.B ywho/yusers/yuptime
X[<host>]|[-g <netgroup>]
X.SH DESCRIPTION
X.I ywho
Xis another version of rwho, but it is faster than rwho and requires
Xno /usr/spool/rwho/rwhod.*. Note that rwho wastes system resources, but
Xywho doesn't. It utilizes SUN RPC and XDR protocol.
X.br
X.sp
X.nf
XHost User tty login at idle from host
Xphaeton Nobody logged on.
Xwhite danb console Feb 27 16:06 3
Xkafka dave console Feb 24 09:39 49
Xcamus ananth console Feb 24 20:22
Xhyperion luk ttyp0 Feb 27 12:01 1:19 jacobi
X.fi
X.br
X.sp
XWhen invoked with a hostname or netgroup argument,
X.I ywho
Xwill only perform a who on
Xthat host or all the hosts in that netgroup,
Xotherwise it will look for a list of hosts in $HOME/.yhosts.
XIf that file is not found, ywho will try to find the system default
Xyhosts file.
X.br
X.sp
XThe system ywho file is a list of hosts separated by white-space or
Xcommas. A `#' character signifies the beginning of a comment.
XA line of the form
X.I timeout=<number>
Xspecifies the number of seconds to timeout when waiting for a host
Xto respond.
X.br
X.sp
XIf
X.I ywho
Xis invoked as
X.I yusers,
Xthen a more compact form of the information is presented in the form
Xof
X.I rusers(1).
X.br
X.sp
X.nf
Xkafka : dave
Xcamus : ananth
Xsibelius : tlfine
Xjacobi : luk
Xlove : phw phw phw
Xtcgould : schinder metzger swb xputer cohen dsingh fielding
X fielding metzger mary chiang berggren leary danae
X beers scann beers
X.fi
X.br
X.sp
XIf
X.I ywho
Xis invoked as
X.I yuptime,
Xthe uptime information for the hosts is presented, like
X.I ruptime(1).
X.br
X.sp
X.nf
Xphaeton up 41+00:08, 1 user, load 0.19, 0.27, 0.04
Xhyperion up 11+02:31, 12 users, load 0.43, 0.41, 0.30
Xeos up 40+23:56, 1 user, load 0.00, 0.00, 0.00
Xtesla up 8:29, 6 users, load 0.07, 0.25, 0.33
Xsvax up 1+06:20, 26 users, load 0.52, 1.38, 1.65
X.fi
X.br
X.sp
X.br
X.sp
X.SH AUTHORS
XJames P. Lewis, York University, 1988
X.br
XChristos S. Zoulas, Cornell University, 1989
X.SH SEE ALSO
Xnetgroup(5), yp(5)
X.SH NOTE
XWhen a host is down, it retries until timeout. It only works if your
Xserver and clients are configured with SUN RPC.
END_OF_FILE
if test 2440 -ne `wc -c <'ywho/ywho.1v'`; then
echo shar: \"'ywho/ywho.1v'\" unpacked with wrong size!
fi
# end of 'ywho/ywho.1v'
fi
if test -f 'ywho/ywho.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ywho/ywho.c'\"
else
echo shar: Extracting \"'ywho/ywho.c'\" \(14519 characters\)
sed "s/^X//" >'ywho/ywho.c' <<'END_OF_FILE'
X/* $Header: /usr/share/src/local/common/bin/ywho/RCS/ywho.c,v 1.10 90/10/04 19:28:14 christos Exp $ */
X/*
X * ywho.c: Use rpc to obtain information about remote users
X * if it is invoked as yusers, present info in short format
X *
X *
X * Original Author:
X * James P. Lewis | FREE TO DISTRIBUTE WITH THIS HEADER
X * York University | REMAINS INTACT.
X * 4700 Keele Street |
X * Downsview, Ontario |
X * Canada |
X * M3J-1P3 |
X *
X * ...yunexus!james
X *
X * yuptime, yusers, and .yhosts added by Christos Zoulas
X * christos at ee.cornell.edu
X *
X *
X * $Log: ywho.c,v $
X * Revision 1.10 90/10/04 19:28:14 christos
X * Eliminated duplicate hosts from the list.
X * Fixed printing for remote host.
X * Added error message when no hosts are found.
X *
X * Revision 1.9 90/08/27 14:29:32 root
X * Fixed some non terminated host names.
X *
X * Revision 1.8 90/08/27 14:20:41 root
X * Fixed bug with day-hours, and increased
X * hosts field widths.
X *
X * Revision 1.7 90/03/03 15:41:36 christos
X * Fixed > to >= for the check to divide
X * for times. What a stupid mistake!
X * Also fixed 'user ,' to ' user,' in
X * yuptime.
X *
X * Revision 1.6 90/02/12 18:55:50 christos
X * Fixed missing longjmp in yuptime
X * and dont cut X11 DISPLAYS.
X *
X * Revision 1.5 89/11/27 02:18:34 christos
X * Fixed interrupted/exiting
X *
X * Revision 1.4 89/11/27 02:11:02 christos
X * Added netgroups
X *
X * Revision 1.3 89/11/15 18:41:32 christos
X * *** empty log message ***
X *
X * Revision 1.2 89/09/16 07:22:18 christos
X * Fixed to exit on 2 consecutive
X * interrupts.
X *
X * Revision 1.1 89/09/16 07:03:00 christos
X * Initial revision
X *
X *
X */
X#ifndef lint
Xstatic char rcsid[] = "$Id: ywho.c,v 1.10 90/10/04 19:28:14 christos Exp $";
X#endif /* lint */
X
X#include <sys/types.h>
X#include <sys/param.h>
X#include <stdio.h>
X#include <signal.h>
X#include <string.h>
X#include <utmp.h>
X#include <ctype.h>
X#include <setjmp.h>
X#include <rpc/rpc.h>
X#include <rpcsvc/rstat.h>
X#include <rpcsvc/rusers.h>
X#include <sys/socket.h>
X#include <sys/time.h>
X#include <netdb.h>
X
X#ifdef MAXHOSTNAMELEN
X# define HST_LEN MAXHOSTNAMELEN
X#else
X# define HST_LEN 64
X#endif
X
X#define NIL(a) ((a *) 0)
X#define NEW(a) ((a *) Malloc(sizeof(a)))
X#define NEWN(a, n) ((a *) Malloc(sizeof(a) * (n)))
X#define strdup(a) ((char *) strcpy(Malloc(strlen(a) + 1), a))
X#define SEP "\t \n,="
X#ifndef FSCALE
X#define FSCALE (1 << 8)
X#endif
X
X#define RWHO 0
X#define RUSERS 1
X#define RUPTIME 2
X
X#ifdef hpux
X#define bcopy(a, b, c) memcpy(b, a, c)
X#endif
X#ifndef SYSHOSTS
X#define SYSHOSTS "/usr/local/etc/yhosts"
X#endif
Xtypedef struct hosts_t {
X struct hostent hp;
X struct hosts_t *next;
X} hosts_t;
X
Xextern char *ctime();
Xextern char *strchr();
Xextern char *getenv();
Xextern char *sys_errlist[];
Xextern int errno;
Xstatic char *Malloc();
Xstatic void do_host();
Xstatic void do_timeout();
Xstatic char *pname;
Xstatic int timeout;
Xstatic int what;
Xstatic jmp_buf goback;
Xstatic int interrupted;
Xstatic hosts_t *hosts = NIL(hosts_t), *hptr = NIL(hosts_t);
X
X
Xvoid
Xaddhost(h)
Xchar *h;
X{
X struct hostent *hp;
X struct hosts_t *hh;
X int i;
X
X if (h == NIL(char))
X return;
X
X if ((hp = gethostbyname(h)) == NIL(struct hostent)) {
X (void) fprintf(stderr,
X "gethostbyname: can't get addr for %s\n", h);
X return;
X }
X if ( hosts == NIL(hosts_t) )
X hosts = hptr = NEW(hosts_t);
X else {
X for (hh = hosts; hh != NIL(hosts_t); hh = hh->next)
X if (strcmp(hp->h_name, hh->hp.h_name) == 0)
X return;
X hptr->next = NEW(hosts_t);
X hptr = hptr->next;
X }
X hptr->hp = *hp;
X hptr->hp.h_name = strdup(hp->h_name);
X#ifndef h_addr
X hptr->hp.h_addr = NEWN(char, hp->h_length);
X bcopy(hp->h_addr, hptr->hp.h_addr, hp->h_length);
X#else
X for (i = 0; hp->h_addr_list[i] != NIL(char); i++);
X hptr->hp.h_addr_list = NEWN(char *, i + 1);
X hptr->hp.h_addr_list[i] = NIL(char);
X for (i--;i >= 0; i--) {
X hptr->hp.h_addr_list[i] = NEWN(char, hp->h_length);
X bcopy(hp->h_addr_list[i], hptr->hp.h_addr_list[i], hp->h_length);
X }
X#endif
X
X for (h = hptr->hp.h_name; *h; h++)
X *h = isupper(*h) ? tolower(*h) : *h;
X hptr->next = NIL(hosts_t);
X} /* end addhost */
X
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *fp;
X char *ptr;
X char *home;
X int err1, err2;
X char buffer[BUFSIZ];
X
X
X pname = strdup(*argv);
X if ( (ptr = strrchr(pname, '/')) != NIL(char) )
X pname = ptr + 1;
X
X what = RWHO;
X what += (pname[1] == 'u'); /* y(u)sers */
X what += (pname[2] == 'p'); /* yu(p)time */
X timeout = 2;
X
X
X if ( argc == 1 ) {
X home = getenv("HOME");
X sprintf(buffer, "%s%s.yhosts", home ? home : "", home ? "/" : "");
X fp = fopen(buffer, "r");
X
X if ( fp == NIL(FILE) ) {
X err1 = errno;
X fp = fopen(SYSHOSTS, "r");
X }
X
X if ( fp == NIL(FILE) ) {
X err2 = errno;
X (void) fprintf(stderr,
X "%s: Could not open \n\t`%s' (%s) or \n\t`%s' (%s).\n",
X pname, buffer, sys_errlist[err1], SYSHOSTS, sys_errlist[err2]);
X exit(1);
X }
X while ( fgets(buffer, BUFSIZ, fp) != 0 ) {
X ptr = strtok(buffer, SEP);
X if ( ptr == NIL(char) )
X continue;
X if ( ptr[0] == '#' )
X continue;
X if ( strcmp(ptr, "timeout") == 0 ) {
X if ((ptr = strtok(NIL(char), "= \t\n")) == NIL(char)) {
X (void) fprintf(stderr,
X "%s: Missing timeout value.\n", pname);
X exit(1);
X }
X if ( sscanf(ptr, "%d", &timeout) != 1 ) {
X (void) fprintf(stderr,
X "%s: Bad timeout value (%s).\n", pname,
X ptr);
X exit(1);
X }
X if ( timeout <= 0 ) {
X (void) fprintf(stderr,
X "%s: Negative or zero timeout value (%d).\n", pname,
X timeout);
X exit(1);
X }
X continue;
X }
X addhost(ptr);
X }
X (void) fclose(fp);
X }
X else {
X int i;
X char *s;
X
X for ( i = 1; i < argc; i++ )
X if (argv[i][0] == '-')
X for (s = &argv[i][1]; *s; s++)
X switch (*s) {
X case 'g':
X setnetgrent(argv[++i]);
X do {
X char *hp = NIL(char), *gp = NIL(char), *dp = NIL(char);
X if (getnetgrent(&hp, &gp, &dp) == 0)
X break;
X addhost(hp);
X } while (1);
X endnetgrent();
X break;
X default:
X (void) fprintf(stderr,
X "Usage: %s [<host>]|[-g <netgroup>]\n",
X pname);
X exit(1);
X }
X else
X addhost(argv[i]);
X }
X if (hosts == NIL(hosts_t)) {
X (void) fprintf(stderr, "%s: No hosts.\n", pname);
X exit(1);
X }
X
X
X switch ( what ) {
X case RWHO :
X#if !defined(hpux) || defined(__hpux)
X (void) fprintf(stdout,
X "%-16.16s %-8.8s %-8.8s %-12.12s %6.6s %-16.16s\n",
X "Host", "User", "tty", "login at ", "idle", "from host");
X#else
X (void) fprintf(stdout,
X "%-16.16s %-8.8s %-8.8s %-12.12s %6.6s\n",
X "Host", "User", "tty", "login at ", "idle");
X#endif
X break;
X case RUSERS :
X break;
X case RUPTIME :
X break;
X }
X
X (void) signal(SIGALRM, do_timeout);
X (void) signal(SIGINT, do_timeout);
X (void) fflush(stdout);
X interrupted = 0;
X for ( hptr = hosts; hptr != NIL(hosts_t); hptr = hptr->next ) {
X if ( !setjmp(goback) ) {
X alarm(timeout+1);
X interrupted = 0;
X do_host(hptr);
X }
X alarm(0);
X }
X exit(0);
X}
X
Xstatic struct utmpidlearr cutmpidlearr;
Xstatic struct statstime sttime;
X
X/* do_host():
X * Somehow I am corrupting memory. If I don't declare utmpidlearray
X * and sttime as globals, I core dump *sometimes*. Allocation for
X * these might be wrong. Anyway it is working now. Till it breaks
X * again.
X */
Xstatic void
Xdo_host(hst)
Xhosts_t *hst;
X{
X char nick_name[HST_LEN], tmp[BUFSIZ];
X int ss, dd, hh, mm, printed;
X int addrlen, i, j, sock;
X register CLIENT *client, *client_st;
X struct hostent *hp;
X struct timeval pertry_timeout, total_timeout;
X struct sockaddr_in server_addr;
X enum clnt_stat clnt_stat, clnt_stat_st;
X char *ptr, *host;
X
X
X (void) strncpy(nick_name, hst->hp.h_name, HST_LEN);
X
X hp = &hst->hp;
X
X if ( ! isdigit(nick_name[0]) )
X if ( ptr = strchr(nick_name, '.'))
X *ptr = '\0';
X
X
X if ( what == RWHO || what == RUPTIME ) {
X (void) fprintf(stdout, "%-16.16s ", nick_name);
X (void) fflush(stdout);
X }
X if ( what == RUPTIME ) {
X sock = RPC_ANYSOCK;
X pertry_timeout.tv_sec = timeout;
X pertry_timeout.tv_usec = 0;
X total_timeout.tv_sec = timeout;
X total_timeout.tv_usec = 0;
X addrlen = sizeof(struct sockaddr_in);
X bcopy(hp->h_addr, (caddr_t) &server_addr.sin_addr, hp->h_length);
X server_addr.sin_family = AF_INET;
X server_addr.sin_port = 0;
X if ((client_st = clntudp_create(&server_addr, RSTATPROG,
X RSTATVERS_TIME, pertry_timeout, &sock)) == NULL) {
X (void) fprintf(stdout, "down\n");
X return;
X }
X clnt_stat_st = clnt_call(client_st, RSTATPROC_STATS, xdr_void,
X 0, xdr_statstime, &sttime, total_timeout);
X if ( clnt_stat_st != RPC_SUCCESS ) {
X switch ( what ) {
X case RWHO :
X case RUPTIME :
X case RUSERS :
X clnt_perror(client_st, "RSTAT");
X break;
X }
X return;
X }
X clnt_freeres(client_st, xdr_statstime, &sttime);
X clnt_destroy(client_st);
X }
X
X sock = RPC_ANYSOCK;
X pertry_timeout.tv_sec = timeout;
X pertry_timeout.tv_usec = 0;
X total_timeout.tv_sec = timeout;
X total_timeout.tv_usec = 0;
X addrlen = sizeof(struct sockaddr_in);
X bcopy(hp->h_addr, (caddr_t) &server_addr.sin_addr, hp->h_length);
X server_addr.sin_family = AF_INET;
X server_addr.sin_port = 0;
X if ((client = clntudp_create(&server_addr, RUSERSPROG,
X RUSERSVERS_IDLE, pertry_timeout, &sock)) == NULL) {
X switch (what) {
X case RWHO :
X clnt_pcreateerror("clntudp_create");
X break;
X case RUSERS :
X break;
X case RUPTIME :
X break;
X }
X return;
X }
X
X clnt_stat = clnt_call(client, RUSERSPROC_NAMES, xdr_void,
X 0, xdr_utmpidlearr, &cutmpidlearr, total_timeout);
X if ( clnt_stat != RPC_SUCCESS ) {
X switch ( what ) {
X case RWHO :
X case RUPTIME :
X case RUSERS :
X clnt_perror(client, "RUSERS");
X break;
X }
X return;
X }
X
X if ( what == RWHO )
X if ( cutmpidlearr.uia_cnt == 0 )
X (void) fprintf(stdout, "Nobody logged on.\n");
X
X switch ( what ) {
X case RWHO :
X for (i = 0; i < cutmpidlearr.uia_cnt; i++) {
X j = cutmpidlearr.uia_arr[i]->ui_utmp.ut_time;
X
X dd = hh = 0;
X mm = cutmpidlearr.uia_arr[i]->ui_idle;
X
X if (mm >= 60) {
X hh = mm / 60;
X mm = mm % 60;
X }
X if (hh >= 24) {
X dd = hh / 24;
X hh = hh % 24;
X }
X
X if ( dd == 0 )
X if ( hh == 0 )
X if ( mm == 0 )
X *tmp = 0;
X else
X (void) sprintf(tmp, " %2d", mm);
X else
X (void) sprintf(tmp, " %2d:%-2.2d", hh, mm);
X else
X (void) sprintf(tmp, "%2dd%-2.2dh", dd, hh);
X
X (void) fprintf(stdout, "%-8.8s %-8.8s %-12.12s %-6.6s ",
X cutmpidlearr.uia_arr[i]->ui_utmp.ut_name,
X cutmpidlearr.uia_arr[i]->ui_utmp.ut_line,
X ctime(&j)+4, tmp);
X
X#if !defined(hpux) || defined(__hpux)
X if (*(host = cutmpidlearr.uia_arr[i]->ui_utmp.ut_host)) {
X char *ptr, flg;
X for (ptr = tmp, flg = isdigit(*host) ? '\0' : '.';
X *host != '\0' && ptr <
X &tmp[sizeof(cutmpidlearr.uia_arr[i]->ui_utmp.ut_host)] &&
X (*host != flg || ((host = strchr(host, ':')) != 0));
X host++) {
X if (*host == ':') flg = '\0';
X *ptr++ = isupper(*host) ? tolower(*host) : *host;
X *ptr = '\0';
X }
X (void) fprintf(stdout, " %-16.16s\n", tmp);
X }
X else
X#endif
X (void) fprintf(stdout, "\n");
X if ( i < cutmpidlearr.uia_cnt - 1 )
X (void) fprintf(stdout, "%-16.16s ", nick_name);
X }
X break;
X case RUSERS :
X /* print in rusers format */
X for (i = 0; i < cutmpidlearr.uia_cnt; i++) {
X printed = FALSE;
X if ( i == 0 )
X (void) sprintf(tmp, "%-16.16s:", nick_name);
X (void) strcat(tmp, " ");
X (void) strncat(tmp, cutmpidlearr.uia_arr[i]->ui_utmp.ut_name, 8);
X
X if ( strlen(tmp) > 60 ) {
X (void) fprintf(stdout, "%s\n", tmp);
X (void) strcpy(tmp, " ");
X printed = TRUE;
X }
X }
X if ( i > 0 && ! printed )
X (void) fprintf(stdout, "%s\n", tmp);
X (void) fflush(stdout);
X break;
X case RUPTIME :
X ss = sttime.curtime.tv_sec - sttime.boottime.tv_sec;
X mm = hh = dd = 0;
X if ( ss >= 60 ) {
X mm = ss / 60;
X ss = ss % 60;
X }
X if ( mm >= 60 ) {
X hh = mm / 60;
X mm = mm % 60;
X }
X if ( hh >= 24 ) {
X dd = hh / 24;
X hh = hh % 24;
X }
X if ( dd > 0 )
X (void) sprintf(tmp, "%3d+%.2d:%.2d", dd, hh, mm);
X else if ( hh > 0 )
X (void) sprintf(tmp, " %2d:%.2d", hh, mm);
X else
X (void) sprintf(tmp, " %2d", mm);
X
X (void) fprintf(stdout, " up %s, %3d %5s, load %3.2f, %3.2f, %3.2f\n",
X tmp,
X cutmpidlearr.uia_cnt,
X cutmpidlearr.uia_cnt == 1 ? " user" : "users",
X (double) sttime.avenrun[0] / FSCALE,
X (double) sttime.avenrun[1] / FSCALE,
X (double) sttime.avenrun[2] / FSCALE);
X break;
X }
X
X clnt_freeres(client, xdr_utmpidlearr, &cutmpidlearr);
X clnt_destroy(client);
X
X return;
X} /* end do_host */
X
X/* Malloc():
X * Memory checked malloc
X */
Xstatic char *
XMalloc(nth)
Xunsigned nth;
X{
X char *ptr;
X extern char *malloc();
X
X if ((ptr = malloc(nth)) == NIL(char)) {
X (void) fprintf(stderr, "%s: Out of memory.\n", pname);
X exit(1);
X }
X return(ptr);
X} /* end Malloc */
X
X/* do_timeout():
X * Since the select timeout does not work right, we use our's
X */
Xstatic void
Xdo_timeout(signum)
Xint signum;
X{
X switch ( what ) {
X case RWHO :
X if ( signum == SIGALRM )
X (void) fprintf(stdout, "No answer.\n");
X else if ( signum == SIGINT )
X if ( ! interrupted ) {
X interrupted = 1;
X (void) fprintf(stdout, "Interrupted.\n");
X sleep(1);
X }
X else {
X (void) fprintf(stdout, "Exiting.\n");
X exit(0);
X }
X (void) fflush(stdout);
X longjmp(goback, 1);
X break;
X case RUPTIME :
X if ( signum == SIGALRM )
X (void) fprintf(stdout, "down\n");
X else if ( signum == SIGINT )
X if ( ! interrupted ) {
X interrupted = 1;
X (void) fprintf(stdout, "Interrupted.\n");
X sleep(1);
X }
X else {
X (void) fprintf(stdout, "Exiting.\n");
X exit(0);
X }
X longjmp(goback, 1);
X break;
X case RUSERS :
X if ( signum == SIGALRM ) ;
X else if ( signum == SIGINT )
X if ( ! interrupted ) {
X interrupted = 1;
X (void) fprintf(stdout, "Interrupted.\n");
X sleep(1);
X }
X else {
X (void) fprintf(stdout, "Exiting.\n");
X exit(0);
X }
X (void) fflush(stdout);
X longjmp(goback, 1);
X break;
X }
X} /* end do_timeout */
X
X#ifdef hpux
Xvoid (*
Xsignal(s, a))()
X int s;
Xvoid (*a)();
X{
X struct sigvec osv, sv;
X
X sigvector(s, 0, &osv);
X sv = osv;
X sv.sv_handler = a;
X sv.sv_flags = SV_BSDSIG;
X if (sigvector(s, &sv, 0) < 0)
X return (BADSIG);
X return (osv.sv_handler);
X}
X#endif
END_OF_FILE
if test 14519 -ne `wc -c <'ywho/ywho.c'`; then
echo shar: \"'ywho/ywho.c'\" unpacked with wrong size!
fi
# end of 'ywho/ywho.c'
fi
if test -f 'ywho/yhosts' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ywho/yhosts'\"
else
echo shar: Extracting \"'ywho/yhosts'\" \(1532 characters\)
sed "s/^X//" >'ywho/yhosts' <<'END_OF_FILE'
X#
X# yhosts - list of hosts monitored by ywho/yuptime/yusers
X#
X
X timeout=10
X
X tesla.ee.cornell.edu
X# paxvax.ee.cornell.edu (RPC is not yet set up)
X# popov.ee.cornell.edu (RPC is not yet set up)
X# elvis.ee.cornell.edu (no RPC support on VMS)
X# mosvax.ee.cornell.edu (RPC is not yet set up)
X
X phaeton.ee.cornell.edu
X white.ee.cornell.edu
X kafka.ee.cornell.edu
X camus.ee.cornell.edu
X sibelius.ee.cornell.edu
X gonzo.ee.cornell.edu
X vonnegut.ee.cornell.edu
X jacobi.ee.cornell.edu
X seidel.ee.cornell.edu
X lewis.ee.cornell.edu
X london.ee.cornell.edu
X bigwood.ee.cornell.edu
X# frost.ee.cornell.edu (Prof. Berger is on sabbatical leave)
X twain.ee.cornell.edu
X
X hyperion.ee.cornell.edu
X zombie.ee.cornell.edu
X bakul.ee.cornell.edu
X guillemin.ee.cornell.edu
X macdlab.ee.cornell.edu
X
X ambrose.ee.cornell.edu
X whamo.ee.cornell.edu
X cardinal.ee.cornell.edu
X archy.ee.cornell.edu
X abarth.ee.cornell.edu
X# nano.ee.cornell.edu (not yet upgraded to HP/UX 6.5)
X# pico.ee.cornell.edu (not yet upgraded to HP/UX 6.5)
X femto.ee.cornell.edu
X pixel.ee.cornell.edu
X alto.ee.cornell.edu
X ragmanns.ee.cornell.edu
X dugout.ee.cornell.edu
X dunbars.ee.cornell.edu
X
X# pplab1.ee.cornell.edu (no RPC support on System V)
X# pplab2.ee.cornell.edu (no RPC support on System V)
X pplab3.ee.cornell.edu
X# pplab4.ee.cornell.edu (no RPC support on System V)
X pplab5.ee.cornell.edu
X
X# nyquist.ee.cornell.edu (no RPC support on System V)
X# comp-sim.ee.cornell.edu (no RPC support on System V)
X
X# ee-demo.ee.cornell.edu (demo machine)
END_OF_FILE
if test 1532 -ne `wc -c <'ywho/yhosts'`; then
echo shar: \"'ywho/yhosts'\" unpacked with wrong size!
fi
# end of 'ywho/yhosts'
fi
echo shar: End of shell archive.
exit 0
--
+------------------------------------------------------------------------+
| Christos Zoulas | 389 Theory Center, Electrical Engineering, |
| christos at ee.cornell.edu | Cornell University, Ithaca NY 14853. |
| christos at crnlee.bitnet | Phone: Disconnected | Fax: (607) 254 4565 |
More information about the Alt.sources
mailing list