minix/commands/flex-2.5.4/MISC/fastwc/wc1.l
Philip Homburg 054e68baf6 Flex-2.5.4.
2005-07-11 12:54:10 +00:00

19 lines
247 B
Plaintext

/* First cut at a flex-based "wc" tool. */
ws [ \t]
nonws [^ \t\n]
%%
int cc = 0, wc = 0, lc = 0;
{nonws}+ cc += yyleng; ++wc;
{ws}+ cc += yyleng;
\n ++lc; ++cc;
<<EOF>> {
printf( "%8d %8d %8d\n", lc, wc, cc );
yyterminate();
}