repo.or.cz
/
minix3.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Improve the process for GNU tools
[minix3.git]
/
external
/
bsd
/
flex
/
dist
/
examples
/
fastwc
/
wc1.l
blob
0d4fcf23cdf9f6872a931f53d4128cf7c138c62d
1
/* First cut at a flex-based "wc" tool. */
2
3
ws [ \t]
4
nonws [^ \t\n]
5
6
%option main noyywrap
7
%%
8
int cc = 0, wc = 0, lc = 0;
9
10
{nonws}+ cc += yyleng; ++wc;
11
12
{ws}+ cc += yyleng;
13
14
\n ++lc; ++cc;
15
16
<<EOF>> {
17
printf( "%8d %8d %8d\n", lc, wc, cc );
18
yyterminate();
19
}