diff options
author | Manoj Srivastava <srivasta@debian.org> | 2014-06-20 20:58:31 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2014-06-20 20:58:31 -0700 |
commit | 37dadb6c5f8f1c78bf6ce72856f251ba1080d2e6 (patch) | |
tree | 7bb6de7bc57812f7459c2e9a3048618704ae618f /examples/fastwc/mywc.c |
flex (2.5.39-8) unstable; urgency=low
* Added a missing build depends on vm-super-minimal, reuired fro
building the pdf documentation, (Closes: #752151).
* Move flex.pdf to the flex-doc package. This makes it possible for the
flex package's contents to not change if texinfo is not installed,
e.g. in the stage1 build profile. Thanks to Peter Pentchev
<roam@ringlet.net>
* Move the flex-doc build dependencies to B-D-I. Move the TeX Live
dependencies to Build-Depends-Indep and only build the HTML and PDF
documentation if actually requested. This breaks a circular build
dependency by not requiring texlive for the build of the
arch-dependent flex binary packages. (Closes: #749344).
* Bug fix #752151: "pdfetex error about missing cm-super", thanks to
Helmut Grohne and Cyril Brulebois
* Bug fix: #749344" Allow bootstrapping without texlive and
dh-autoreconf", thanks to Peter Pentchev
# imported from the archive
Diffstat (limited to 'examples/fastwc/mywc.c')
-rw-r--r-- | examples/fastwc/mywc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/fastwc/mywc.c b/examples/fastwc/mywc.c new file mode 100644 index 0000000..92e5a36 --- /dev/null +++ b/examples/fastwc/mywc.c @@ -0,0 +1,26 @@ +/* A simple but fairly efficient C version of the Unix "wc" tool */ + +#include <stdio.h> +#include <ctype.h> + +main() +{ + register int c, cc = 0, wc = 0, lc = 0; + FILE *f = stdin; + + while ((c = getc(f)) != EOF) { + ++cc; + if (isgraph(c)) { + ++wc; + do { + c = getc(f); + if (c == EOF) + goto done; + ++cc; + } while (isgraph(c)); + } + if (c == '\n') + ++lc; + } +done: printf( "%8d%8d%8d\n", lc, wc, cc ); +} |