summaryrefslogtreecommitdiffstats
path: root/usr.bin/size/size.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-11 07:28:19 +0000
committercharnier <charnier@FreeBSD.org>1997-08-11 07:28:19 +0000
commit12409694bd9cd25a5d6e5f676f6794ebcb19dc6e (patch)
tree330fbe281289b51fc96fb5e39ef47f24a2735180 /usr.bin/size/size.c
parent44c0b1badf6259bd10fd1dacdd631005e46766fc (diff)
downloadFreeBSD-src-12409694bd9cd25a5d6e5f676f6794ebcb19dc6e.zip
FreeBSD-src-12409694bd9cd25a5d6e5f676f6794ebcb19dc6e.tar.gz
Use err(3) instead of local redefinition.
Diffstat (limited to 'usr.bin/size/size.c')
-rw-r--r--usr.bin/size/size.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/usr.bin/size/size.c b/usr.bin/size/size.c
index b34e24c..50fc314 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 <sys/param.h>
#include <sys/file.h>
-#include <errno.h>
+#include <err.h>
#include <a.out.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-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 <stdarg.h>
-#else
-#include <varargs.h>
-#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");
-}
OpenPOWER on IntegriCloud