diff options
author | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
commit | c3f352d4ad515968c54d216a0e53252eff8ab3ef (patch) | |
tree | 48ddeda3c6c8d8572cc34bf52ccf9cb9bd97d488 /lib/librpc/rpcsvc/rstat.c | |
parent | ab124e78b0271ddb904b761b31e5c9a0cf24e070 (diff) | |
download | FreeBSD-src-c3f352d4ad515968c54d216a0e53252eff8ab3ef.zip FreeBSD-src-c3f352d4ad515968c54d216a0e53252eff8ab3ef.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'lib/librpc/rpcsvc/rstat.c')
-rw-r--r-- | lib/librpc/rpcsvc/rstat.c | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/librpc/rpcsvc/rstat.c b/lib/librpc/rpcsvc/rstat.c deleted file mode 100644 index fe83ae5..0000000 --- a/lib/librpc/rpcsvc/rstat.c +++ /dev/null @@ -1,85 +0,0 @@ -/* @(#)rstat.c 2.3 88/11/30 4.0 RPCSRC */ -/* - * Simple program that prints the status of a remote host, in a format - * similar to that used by the 'w' command, using the rstat.x service. - */ - -#include <stdio.h> -#include <sys/param.h> -#include <rpc/rpc.h> /* include <sys/time.h> */ -#include "rstat.h" - -main(argc, argv) -int argc; -char **argv; -{ - - char *host; - CLIENT *rstat_clnt; - statstime *host_stat; - struct tm *tmp_time; - struct tm host_time; - struct tm host_uptime; - char days_buf[16]; - char hours_buf[16]; - - if (argc != 2) - { - fprintf(stderr, "usage: %s \"host\"\n", argv[0]); - exit(1); - } - - host = argv[1]; - - /* client handle to rstat */ - rstat_clnt = clnt_create(host, RSTATPROG, RSTATVERS_TIME, "udp"); - if (rstat_clnt == NULL) - { - clnt_pcreateerror(argv[0]); - exit(1); - } - - host_stat = rstatproc_stats_3(NULL, rstat_clnt); - if (host_stat == NULL) - { - clnt_perror(rstat_clnt, argv[0]); - exit(1); - } - - tmp_time = localtime(&host_stat->curtime.tv_sec); - host_time = *tmp_time; - - host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; - - tmp_time = gmtime(&host_stat->curtime.tv_sec); - host_uptime = *tmp_time; - - if (host_uptime.tm_yday != 0) - sprintf(days_buf, "%d day%s, ", host_uptime.tm_yday, - (host_uptime.tm_yday > 1) ? "s" : ""); - else - days_buf[0] = '\0'; - - if (host_uptime.tm_hour != 0) - sprintf(hours_buf, "%2d:%02d,", - host_uptime.tm_hour, host_uptime.tm_min); - else - if (host_uptime.tm_min != 0) - sprintf(hours_buf, "%2d mins,", host_uptime.tm_min); - else - hours_buf[0] = '\0'; - - printf(" %2d:%02d%cm up %s%s load average: %.2f %.2f %.2f\n", - (host_time.tm_hour > 12) ? host_time.tm_hour - 12 - : host_time.tm_hour, - host_time.tm_min, - (host_time.tm_hour >= 12) ? 'p' - : 'a', - days_buf, - hours_buf, - (double)host_stat->avenrun[0]/FSCALE, - (double)host_stat->avenrun[1]/FSCALE, - (double)host_stat->avenrun[2]/FSCALE); - - exit(0); -} |