Removing warning about OSNAME.
[minix.git] / external / bsd / flex / dist / examples / fastwc / mywc.c
bloba5adcf4035ba391032c2a5f18de98ad759fa3c0d
1 /* $NetBSD: mywc.c,v 1.1.1.1 2009/10/26 00:28:34 christos Exp $ */
3 /* A simple but fairly efficient C version of the Unix "wc" tool */
5 #include <stdio.h>
6 #include <ctype.h>
8 main()
10 register int c, cc = 0, wc = 0, lc = 0;
11 FILE *f = stdin;
13 while ((c = getc(f)) != EOF) {
14 ++cc;
15 if (isgraph(c)) {
16 ++wc;
17 do {
18 c = getc(f);
19 if (c == EOF)
20 goto done;
21 ++cc;
22 } while (isgraph(c));
24 if (c == '\n')
25 ++lc;
27 done: printf( "%8d%8d%8d\n", lc, wc, cc );