Module Name: src
Committed By: joerg
Date: Tue Sep 6 18:29:19 UTC 2011
Modified Files:
src/usr.bin/ruptime: ruptime.c
Log Message:
ANSIfy, static + __dead
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/ruptime/ruptime.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ruptime/ruptime.c
diff -u src/usr.bin/ruptime/ruptime.c:1.14 src/usr.bin/ruptime/ruptime.c:1.15
--- src/usr.bin/ruptime/ruptime.c:1.14 Mon Apr 13 07:10:25 2009
+++ src/usr.bin/ruptime/ruptime.c Tue Sep 6 18:29:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ruptime.c,v 1.14 2009/04/13 07:10:25 lukem Exp $ */
+/* $NetBSD: ruptime.c,v 1.15 2011/09/06 18:29:19 joerg Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@@ -37,7 +37,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)ruptime.c 8.2 (Berkeley) 4/5/94";*/
-__RCSID("$NetBSD: ruptime.c,v 1.14 2009/04/13 07:10:25 lukem Exp $");
+__RCSID("$NetBSD: ruptime.c,v 1.15 2011/09/06 18:29:19 joerg Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -55,7 +55,7 @@
#include <tzfile.h>
#include <unistd.h>
-struct hs {
+static struct hs {
struct whod *hs_wd;
int hs_nusers;
} *hs;
@@ -64,18 +64,16 @@
#define WHDRSIZE (sizeof(struct whod) - \
sizeof (((struct whod *)0)->wd_we))
-size_t nhosts;
-time_t now;
-int rflg = 1;
-
-int hscmp(const void *, const void *);
-char *interval(time_t, const char *);
-int lcmp(const void *, const void *);
-int main(int, char **);
-void morehosts(void);
-int tcmp(const void *, const void *);
-int ucmp(const void *, const void *);
-void usage(void);
+static size_t nhosts;
+static time_t now;
+static int rflg = 1;
+
+static int hscmp(const void *, const void *);
+static char *interval(time_t, const char *);
+static int lcmp(const void *, const void *);
+static int tcmp(const void *, const void *);
+static int ucmp(const void *, const void *);
+__dead static void usage(void);
int
main(int argc, char **argv)
@@ -186,7 +184,7 @@
exit(0);
}
-char *
+static char *
interval(time_t tval, const char *updown)
{
static char resbuf[32];
@@ -214,16 +212,15 @@
#define HS(a) ((const struct hs *)(a))
/* Alphabetical comparison. */
-int
-hscmp(a1, a2)
- const void *a1, *a2;
+static int
+hscmp(const void *a1, const void *a2)
{
return (rflg *
strcmp(HS(a1)->hs_wd->wd_hostname, HS(a2)->hs_wd->wd_hostname));
}
/* Load average comparison. */
-int
+static int
lcmp(const void *a1, const void *a2)
{
if (ISDOWN(HS(a1))) {
@@ -239,7 +236,7 @@
}
/* Number of users comparison. */
-int
+static int
ucmp(const void *a1, const void *a2)
{
if (ISDOWN(HS(a1))) {
@@ -254,7 +251,7 @@
}
/* Uptime comparison. */
-int
+static int
tcmp(const void *a1, const void *a2)
{
return (rflg * (
@@ -266,7 +263,7 @@
));
}
-void
+static void
usage(void)
{
(void)fprintf(stderr, "usage: ruptime [-alrtu]\n");