diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-16 09:10:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-16 09:10:30 +0000 |
commit | 2182d934cbcfcac23f77714fd1f1e81e6cdc9b87 (patch) | |
tree | d644274395c74ba1f289ab85d1d394f743a93f94 /usr.bin/rup | |
parent | cfda2b37698fe1a867d0968437c712e0b60cbb4e (diff) |
indent
Diffstat (limited to 'usr.bin/rup')
-rw-r--r-- | usr.bin/rup/rup.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c index 72181eafc19..066f71a40de 100644 --- a/usr.bin/rup/rup.c +++ b/usr.bin/rup/rup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rup.c,v 1.2 1996/06/26 05:38:52 deraadt Exp $ */ +/* $OpenBSD: rup.c,v 1.3 1996/08/16 09:10:29 deraadt Exp $ */ /*- * Copyright (c) 1993, John Brezak @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rup.c,v 1.2 1996/06/26 05:38:52 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rup.c,v 1.3 1996/08/16 09:10:29 deraadt Exp $"; #endif /* not lint */ #include <stdio.h> @@ -118,7 +118,7 @@ compare(d1, d2) case SORT_HOST: return strcmp(d1->host, d2->host); case SORT_LDAV: - return d1->statstime.avenrun[0] + return d1->statstime.avenrun[0] - d2->statstime.avenrun[0]; case SORT_UPTIME: return d1->statstime.boottime.tv_sec @@ -137,7 +137,7 @@ remember_rup_data(host, st) if (rup_data_idx >= rup_data_max) { rup_data_max += 16; rup_data = realloc (rup_data, - rup_data_max * sizeof(struct rup_data)); + rup_data_max * sizeof(struct rup_data)); if (rup_data == NULL) { err (1, NULL); /* NOTREACHED */ @@ -161,8 +161,7 @@ rstat_reply(replyp, raddrp) if (!search_host(raddrp->sin_addr)) { hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr, - sizeof(struct in_addr), AF_INET); - + sizeof(struct in_addr), AF_INET); if (hp) host = hp->h_name; else @@ -170,11 +169,10 @@ rstat_reply(replyp, raddrp) remember_host(raddrp->sin_addr); - if (sort_type != SORT_NONE) { + if (sort_type != SORT_NONE) remember_rup_data(host, host_stat); - } else { + else print_rup_data(host, host_stat); - } } return (0); @@ -204,13 +202,13 @@ print_rup_data(host, host_stat) if (host_uptime.tm_yday != 0) sprintf(days_buf, "%3d day%s, ", host_uptime.tm_yday, - (host_uptime.tm_yday > 1) ? "s" : ""); + (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); + host_uptime.tm_hour, host_uptime.tm_min); else if (host_uptime.tm_min != 0) sprintf(hours_buf, "%2d mins, ", host_uptime.tm_min); @@ -219,14 +217,14 @@ print_rup_data(host, host_stat) if (printtime) printf(" %2d:%02d%cm", host_time.tm_hour % 12, - host_time.tm_min, - (host_time.tm_hour >= 12) ? 'p' : 'a'); + host_time.tm_min, + (host_time.tm_hour >= 12) ? 'p' : 'a'); printf(" up %9.9s%9.9s load average: %.2f %.2f %.2f\n", - days_buf, hours_buf, - (double)host_stat->avenrun[0]/FSCALE, - (double)host_stat->avenrun[1]/FSCALE, - (double)host_stat->avenrun[2]/FSCALE); + days_buf, hours_buf, + (double)host_stat->avenrun[0]/FSCALE, + (double)host_stat->avenrun[1]/FSCALE, + (double)host_stat->avenrun[2]/FSCALE); return(0); } @@ -247,7 +245,8 @@ onehost(host) } bzero((char *)&host_stat, sizeof(host_stat)); - if (clnt_call(rstat_clnt, RSTATPROC_STATS, xdr_void, NULL, xdr_statstime, &host_stat, timeout) != RPC_SUCCESS) { + if (clnt_call(rstat_clnt, RSTATPROC_STATS, xdr_void, NULL, + xdr_statstime, &host_stat, timeout) != RPC_SUCCESS) { warnx("%s", clnt_sperror(rstat_clnt, host)); return; } @@ -269,8 +268,7 @@ allhosts() } clnt_stat = clnt_broadcast(RSTATPROG, RSTATVERS_TIME, RSTATPROC_STATS, - xdr_void, NULL, - xdr_statstime, &host_stat, rstat_reply); + xdr_void, NULL, xdr_statstime, &host_stat, rstat_reply); if (clnt_stat != RPC_SUCCESS && clnt_stat != RPC_TIMEDOUT) { warnx("%s", clnt_sperrno(clnt_stat)); exit(1); @@ -278,10 +276,12 @@ allhosts() if (sort_type != SORT_NONE) { putchar('\n'); - qsort(rup_data, rup_data_idx, sizeof(struct rup_data), compare); + qsort(rup_data, rup_data_idx, sizeof(struct rup_data), + compare); for (i = 0; i < rup_data_idx; i++) { - print_rup_data(rup_data[i].host, &rup_data[i].statstime); + print_rup_data(rup_data[i].host, + &rup_data[i].statstime); } } } |