From 3042ea1f5236f1a2ede27e24d91291f14a8527ae Mon Sep 17 00:00:00 2001 From: Philippe Charnier Date: Mon, 11 Aug 1997 07:28:19 +0000 Subject: [PATCH] Use err(3) instead of local redefinition. --- usr.bin/size/size.1 | 2 +- usr.bin/size/size.1aout | 2 +- usr.bin/size/size.c | 44 ++++++++++------------------------------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/usr.bin/size/size.1 b/usr.bin/size/size.1 index ee46bb285da6..e99b9d1b5d69 100644 --- a/usr.bin/size/size.1 +++ b/usr.bin/size/size.1 @@ -56,6 +56,6 @@ attempts to report on the file .Xr a.out 5 .Sh HISTORY A -.Nm size +.Nm command appeared in .At v6 . diff --git a/usr.bin/size/size.1aout b/usr.bin/size/size.1aout index ee46bb285da6..e99b9d1b5d69 100644 --- a/usr.bin/size/size.1aout +++ b/usr.bin/size/size.1aout @@ -56,6 +56,6 @@ attempts to report on the file .Xr a.out 5 .Sh HISTORY A -.Nm size +.Nm command appeared in .At v6 . diff --git a/usr.bin/size/size.c b/usr.bin/size/size.c index b34e24c7e86a..50fc31407416 100644 --- a/usr.bin/size/size.c +++ b/usr.bin/size/size.c @@ -32,27 +32,30 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1988, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)size.c 8.2 (Berkeley) 12/9/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include #include -#include +#include #include #include #include #include #include -void err __P((const char *, ...)); int show __P((int, char *)); -void usage __P((void)); +static void usage __P((void)); int main(argc, argv) @@ -91,12 +94,12 @@ show(count, name) int fd; if ((fd = open(name, O_RDONLY, 0)) < 0) { - err("%s: %s", name, strerror(errno)); + warn("%s", name); return (1); } if (read(fd, &head, sizeof(head)) != sizeof(head) || N_BADMAG(head)) { (void)close(fd); - err("%s: not in a.out format", name); + warnx("%s: not in a.out format", name); return (1); } (void)close(fd); @@ -114,36 +117,9 @@ show(count, name) return (0); } -void +static void usage() { (void)fprintf(stderr, "usage: size [file ...]\n"); exit(1); } - -#if __STDC__ -#include -#else -#include -#endif - -void -#if __STDC__ -err(const char *fmt, ...) -#else -err(fmt, va_alist) - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "size: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); -}