diff options
author | mike <mike@FreeBSD.org> | 2002-02-28 11:02:49 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2002-02-28 11:02:49 +0000 |
commit | 906748aa31a3ab72196c5304954ef4af1543402d (patch) | |
tree | b2d9a8602fb784e3a87d683416012f363ca6ec85 /usr.bin/wc | |
parent | dce4f706b7cf4e58cbb2346a403c73eb98097f1f (diff) | |
download | FreeBSD-src-906748aa31a3ab72196c5304954ef4af1543402d.zip FreeBSD-src-906748aa31a3ab72196c5304954ef4af1543402d.tar.gz |
Fix vendor ID (mostly obtained from rev 1.1).
Make use of `static' storage-class for local functions.
Replace uses of `u_quad_t' with `uintmax_t'.
Diffstat (limited to 'usr.bin/wc')
-rw-r--r-- | usr.bin/wc/wc.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index befb657..31a3526 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -31,20 +31,21 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> - -__FBSDID("$FreeBSD$"); - +#if 0 #ifndef lint -static const char copyright[] = +static char copyright[] = "@(#) Copyright (c) 1980, 1987, 1991, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif +#endif /* not lint */ #ifndef lint -static const char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93"; +static char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93"; +#endif /* not lint */ #endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include <sys/param.h> #include <sys/stat.h> @@ -52,16 +53,17 @@ static const char sccsid[] = "@(#)wc.c 8.1 (Berkeley) 6/6/93"; #include <err.h> #include <fcntl.h> #include <locale.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -u_quad_t tlinect, twordct, tcharct; +uintmax_t tlinect, twordct, tcharct; int doline, doword, dochar; -int cnt __P((const char *)); -void usage __P((void)); +static int cnt __P((const char *)); +static void usage __P((void)); int main(argc, argv) @@ -112,22 +114,22 @@ main(argc, argv) if (total > 1) { if (doline) - (void)printf(" %7qu", tlinect); + (void)printf(" %7ju", tlinect); if (doword) - (void)printf(" %7qu", twordct); + (void)printf(" %7ju", twordct); if (dochar) - (void)printf(" %7qu", tcharct); + (void)printf(" %7ju", tcharct); (void)printf(" total\n"); } exit(errors == 0 ? 0 : 1); } -int +static int cnt(file) const char *file; { struct stat sb; - u_quad_t linect, wordct, charct; + uintmax_t linect, wordct, charct; int fd, len; short gotsp; u_char *p; @@ -162,10 +164,10 @@ cnt(file) ++linect; } tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7ju", linect); if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7ju", charct); } (void)close(fd); return (0); @@ -216,21 +218,21 @@ word: for (gotsp = 1; (len = read(fd, buf, MAXBSIZE));) { } if (doline) { tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7ju", linect); } if (doword) { twordct += wordct; - (void)printf(" %7qu", wordct); + (void)printf(" %7ju", wordct); } if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7ju", charct); } (void)close(fd); return (0); } -void +static void usage() { (void)fprintf(stderr, "usage: wc [-clw] [file ...]\n"); |