From cc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0 Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Sat, 22 Jun 2019 02:54:26 -0500 Subject: usr.bin/wc: make buildable --- usr.bin/wc/wc.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index 602a450..64abf67 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -29,20 +29,6 @@ * SUCH DAMAGE. */ -#include -#ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1980, 1987, 1991, 1993\ - The Regents of the University of California. All rights reserved."); -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95"; -#else -__RCSID("$NetBSD: wc.c,v 1.35 2011/09/16 15:39:30 joerg Exp $"); -#endif -#endif /* not lint */ - /* wc line, word, char count and optionally longest line. */ #include @@ -63,11 +49,11 @@ __RCSID("$NetBSD: wc.c,v 1.35 2011/09/16 15:39:30 joerg Exp $"); #include #ifdef NO_QUAD -typedef u_long wc_count_t; +typedef unsigned long wc_count_t; # define WCFMT " %7lu" # define WCCAST unsigned long #else -typedef u_quad_t wc_count_t; +typedef unsigned long long wc_count_t; # define WCFMT " %7llu" # define WCCAST unsigned long long #endif @@ -79,7 +65,7 @@ static int rval = 0; static void cnt(const char *); static void print_counts(wc_count_t, wc_count_t, wc_count_t, wc_count_t, const char *); -__dead static void usage(void); +static void usage(void); static size_t do_mb(wchar_t *, const char *, size_t, mbstate_t *, size_t *, const char *); @@ -175,12 +161,13 @@ do_mb(wchar_t *wc, const char *p, size_t len, mbstate_t *st, static void cnt(const char *file) { - u_char buf[MAXBSIZE]; +#define MAXBSIZE 64*1024 + unsigned char buf[MAXBSIZE]; wchar_t wbuf[MAXBSIZE]; struct stat sb; wc_count_t charct, linect, wordct, longest; mbstate_t st; - u_char *C; + unsigned char *C; wchar_t *WC; const char *name; /* filename or */ size_t r = 0; -- cgit v1.2.3-60-g2f50