1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

do not print spurious whitespace when reading from stdin;

from Bernd Ahlers with a twist from me; ok millert@
This commit is contained in:
otto 2008-06-19 18:29:06 +00:00
parent b8a088aa42
commit 170cb2792b

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wc.c,v 1.11 2005/10/19 21:49:02 espie Exp $ */
/* $OpenBSD: wc.c,v 1.12 2008/06/19 18:29:06 otto Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
@ -39,7 +39,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95";
#else
static char rcsid[] = "$OpenBSD: wc.c,v 1.11 2005/10/19 21:49:02 espie Exp $";
static char rcsid[] = "$OpenBSD: wc.c,v 1.12 2008/06/19 18:29:06 otto Exp $";
#endif
#endif /* not lint */
@ -224,7 +224,7 @@ cnt(char *file)
}
}
print_counts(linect, wordct, charct, file ? file : "");
print_counts(linect, wordct, charct, file);
/*
* Don't bother checking doline, doword, or dochar -- speeds
@ -263,5 +263,8 @@ print_counts(int64_t lines, int64_t words, int64_t chars, char *name)
if (dochar)
format_and_print((long long)chars);
(void)printf(" %s\n", name);
if (name)
(void)printf(" %s\n", name);
else
(void)printf("\n");
}