summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-06-22 02:54:26 -0500
committerKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-06-22 02:54:26 -0500
commitcc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0 (patch)
tree3562a2d6de79715b614de4a8bb1cac1a9b58136f
parentc69fe3b51d7d17095a844febf593cab057966960 (diff)
downloaduserland-cc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0.tar.gz
userland-cc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0.tar.bz2
userland-cc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0.tar.xz
userland-cc896b5a2e5dc0006ef2c359c5a25596ca4c3bd0.zip
usr.bin/wc: make buildable
-rw-r--r--usr.bin/wc/wc.c25
1 files 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 <sys/cdefs.h>
-#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 <sys/param.h>
@@ -63,11 +49,11 @@ __RCSID("$NetBSD: wc.c,v 1.35 2011/09/16 15:39:30 joerg Exp $");
#include <wctype.h>
#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 <stdin> */
size_t r = 0;