From 301777f2d2b2a34af34a5834dfe586268c99f4b0 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Mon, 1 Jul 2002 16:40:33 +0000 Subject: [PATCH] Modernise; ISOify, use __FBSDID(), use headers instead of hand-declaring. Fix easy warnings. --- usr.bin/rwho/rwho.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c index fe3a17d733f0..be82ad36d4dc 100644 --- a/usr.bin/rwho/rwho.c +++ b/usr.bin/rwho/rwho.c @@ -41,13 +41,16 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)rwho.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include + #include + #include #include #include @@ -56,13 +59,13 @@ static const char rcsid[] = #include #include #include +#include #include #include DIR *dirp; struct whod wd; -int utmpcmp(); #define NUSERS 1000 struct myutmp { char myhost[sizeof(wd.wd_hostname)]; @@ -71,7 +74,7 @@ struct myutmp { } myutmp[NUSERS]; int nusers; -#define WHDRSIZE (sizeof (wd) - sizeof (wd.wd_we)) +#define WHDRSIZE (ssize_t)(sizeof (wd) - sizeof (wd.wd_we)) /* * this macro should be shared with ruptime. */ @@ -84,13 +87,12 @@ static void usage(void); int utmpcmp(const void *, const void *); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ch; struct dirent *dp; - int cc, width; + int width; + ssize_t cc; register struct whod *w = &wd; register struct whoent *we; register struct myutmp *mp; @@ -196,17 +198,16 @@ main(argc, argv) static void -usage() +usage(void) { fprintf(stderr, "usage: rwho [-a]\n"); exit(1); } -#define MYUTMP(a) ((struct myutmp *)(a)) +#define MYUTMP(a) ((const struct myutmp *)(a)) int -utmpcmp(u1, u2) - const void *u1, *u2; +utmpcmp(const void *u1, const void *u2) { int rc;