summaryrefslogtreecommitdiff
path: root/usr.bin/rup
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-10 22:20:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-10 22:20:55 +0000
commitb8aaa8bec8414f8e55cf9b61fe0873d242c773b8 (patch)
tree5e43016c4fae834239fd38972fd58355ed6b54b5 /usr.bin/rup
parentf18f6607440f6d2da08fac3522d88a65c77a5f3e (diff)
mostly ansi cleanup; pval ok
Diffstat (limited to 'usr.bin/rup')
-rw-r--r--usr.bin/rup/rup.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c
index 3a47cc1181c..5c900c0daa9 100644
--- a/usr.bin/rup/rup.c
+++ b/usr.bin/rup/rup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rup.c,v 1.16 2002/05/27 03:14:07 deraadt Exp $ */
+/* $OpenBSD: rup.c,v 1.17 2003/06/10 22:20:50 deraadt Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -34,7 +34,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: rup.c,v 1.16 2002/05/27 03:14:07 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rup.c,v 1.17 2003/06/10 22:20:50 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -66,8 +66,7 @@ void usage(void);
int print_rup_data(char *, statstime *host_stat);
int
-search_host(addr)
- struct in_addr addr;
+search_host(struct in_addr addr)
{
struct host_list *hp;
@@ -82,8 +81,7 @@ search_host(addr)
}
void
-remember_host(addr)
- struct in_addr addr;
+remember_host(struct in_addr addr)
{
struct host_list *hp;
@@ -97,7 +95,6 @@ remember_host(addr)
}
-
struct rup_data {
char *host;
struct statstime statstime;
@@ -106,7 +103,7 @@ struct rup_data *rup_data;
int rup_data_idx = 0;
int rup_data_max = 0;
-enum sort_type {
+enum sort_type {
SORT_NONE,
SORT_HOST,
SORT_LDAV,
@@ -115,10 +112,11 @@ enum sort_type {
enum sort_type sort_type;
int
-compare(d1, d2)
- struct rup_data *d1;
- struct rup_data *d2;
+compare(const void *v1, const void *v2)
{
+ const struct rup_data *d1 = v1;
+ const struct rup_data *d2 = v2;
+
switch(sort_type) {
case SORT_HOST:
return strcmp(d1->host, d2->host);
@@ -126,7 +124,7 @@ compare(d1, d2)
return d1->statstime.avenrun[0]
- d2->statstime.avenrun[0];
case SORT_UPTIME:
- return d1->statstime.boottime.tv_sec
+ return d1->statstime.boottime.tv_sec
- d2->statstime.boottime.tv_sec;
default:
/* something's really wrong here */
@@ -135,13 +133,11 @@ compare(d1, d2)
}
void
-remember_rup_data(host, st)
- char *host;
- struct statstime *st;
+remember_rup_data(char *host, struct statstime *st)
{
if (rup_data_idx >= rup_data_max) {
rup_data_max += 16;
- rup_data = realloc(rup_data,
+ rup_data = realloc(rup_data,
rup_data_max * sizeof(struct rup_data));
if (rup_data == NULL) {
err(1, NULL);
@@ -156,9 +152,7 @@ remember_rup_data(host, st)
int
-rstat_reply(replyp, raddrp)
- char *replyp;
- struct sockaddr_in *raddrp;
+rstat_reply(char *replyp, struct sockaddr_in *raddrp)
{
struct hostent *hp;
char *host;
@@ -185,9 +179,7 @@ rstat_reply(replyp, raddrp)
int
-print_rup_data(host, host_stat)
- char *host;
- statstime *host_stat;
+print_rup_data(char *host, statstime *host_stat)
{
unsigned int ups = 0, upm = 0, uph = 0, upd = 0;
struct tm *tmp_time, host_time;
@@ -244,8 +236,7 @@ print_rup_data(host, host_stat)
void
-onehost(host)
- char *host;
+onehost(char *host)
{
CLIENT *rstat_clnt;
statstime host_stat;
@@ -273,7 +264,7 @@ onehost(host)
}
void
-allhosts()
+allhosts(void)
{
statstime host_stat;
enum clnt_stat clnt_stat;
@@ -305,9 +296,7 @@ allhosts()
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int ch;
extern int optind;
@@ -346,7 +335,7 @@ main(argc, argv)
void
-usage()
+usage(void)
{
fprintf(stderr, "Usage: rup [-dhlt] [hosts ...]\n");
exit(1);