Hopefully somebody better at this than I can correct this somewhat
iffy change. The problem with the last checkin is twofold- first %q should refer to quad_t, not u_int64_r. Second, for the alpha compiler, %q is taken to be 'long long'- which is definitely not the same as u_int64_t. Take home lesson- didn't build on alpha. I thought about an #ifdef __alpha__- but that's wrong, so I put in a runtime determinant to set a constant format string. Like I said, I hope somebody better than I can fix it right.
This commit is contained in:
parent
a72d37c4fa
commit
f16e878646
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: wc.c,v 1.15 1999/02/13 15:53:17 explorer Exp $ */
|
/* $NetBSD: wc.c,v 1.16 1999/02/14 18:03:18 mjacob Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1980, 1987, 1991, 1993
|
* Copyright (c) 1980, 1987, 1991, 1993
|
||||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1987, 1991, 1993\n\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95";
|
static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: wc.c,v 1.15 1999/02/13 15:53:17 explorer Exp $");
|
__RCSID("$NetBSD: wc.c,v 1.16 1999/02/14 18:03:18 mjacob Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -72,6 +72,7 @@ __RCSID("$NetBSD: wc.c,v 1.15 1999/02/13 15:53:17 explorer Exp $");
|
|||||||
static u_int64_t tlinect, twordct, tcharct;
|
static u_int64_t tlinect, twordct, tcharct;
|
||||||
static int doline, doword, dochar;
|
static int doline, doword, dochar;
|
||||||
static int rval = 0;
|
static int rval = 0;
|
||||||
|
static char *qfmt;
|
||||||
|
|
||||||
static void cnt __P((char *));
|
static void cnt __P((char *));
|
||||||
static void print_counts __P((u_int64_t, u_int64_t, u_int64_t, char *));
|
static void print_counts __P((u_int64_t, u_int64_t, u_int64_t, char *));
|
||||||
@ -86,6 +87,10 @@ main(argc, argv)
|
|||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
if (sizeof (u_int64_t) > 4)
|
||||||
|
qfmt = " %7u";
|
||||||
|
else
|
||||||
|
qfmt = " %7qu";
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "lwcm")) != -1)
|
while ((ch = getopt(argc, argv, "lwcm")) != -1)
|
||||||
switch((char)ch) {
|
switch((char)ch) {
|
||||||
@ -253,11 +258,11 @@ print_counts(lines, words, chars, name)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (doline)
|
if (doline)
|
||||||
printf(" %7qu", lines);
|
printf(qfmt, lines);
|
||||||
if (doword)
|
if (doword)
|
||||||
printf(" %7qu", words);
|
printf(qfmt, words);
|
||||||
if (dochar)
|
if (dochar)
|
||||||
printf(" %7qu", chars);
|
printf(qfmt, chars);
|
||||||
|
|
||||||
printf(" %s\n", name);
|
printf(" %s\n", name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user