Prepare for the winners of **IOCCC28**. > However these are not the 2024 droids you are looking for. :-) The HTML menu (both JavaScript and non-JavaScript) has been updated. The `Status -> Rules and guidelines' have been replaced with two separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`. Added a new top level `social.html` page: built from a new `social.md`. Sorted rules for building specific web pages in the top level `Makefile`. Added `make social` to make the `social.html` page from `social.md`. The `bin/gen-top-html.sh` now is able to process a argument of **social** to process the new top level `social.html` page. Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13" to "2.0.1 2025-07-25". Below `About -> Home page` a new `About -> IOCCC social media` menu item as added. Because the menu change touched every HTML file, we changed the general copyright date range for HTML files from "1984-2024" to "1984-2025" due to the extensive changes made for **IOCCC28**. Those markdown files that were modified in 2025 had their copyright date range also changed from "1984-2024" to "1984-2025". Rebuilt tarballs and sitemap due to the extensive HTML rebuilding. Ran `make update` to perform the above.
To build:
make
Bugs and (Mis)features:
The current status of this entry is:
STATUS: INABIAF - please DO NOT fix
For more detailed information see 2019/burton in bugs.html.
To use:
./prog < file
./cow file
Try:
./try.sh
Judges' remarks:
A tiny, but punctually correct way of POSIX counting for text files. This one line, one word, 127 character beauty continues to expand the number of classic unix utilities available as winning entries.
You might find the author's commentary on one liners interesting.
Author's remarks:
Synopsis:
Feed it anything on stdin.
The output should look familiar.
Compiles cleanly with:
WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses"
cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c
Description:
Included is a test script, useful for the corner cases. As in all good Unix programs, it is silent upon success; any output demonstrates an error.
NOTICE to those who wish for a greater challenge:
If you want a greater challenge, don't read any further: just try to understand the program without running the command below.
If you get stuck, come back and run the following command:
out=cat ./check.sh ./prog
Instead of checking correctness, the check.sh script can simply output the results:
Interestingly, and a spoiler here: macOS and FreeBSD implement the common
utility "correctly". CentOS and Ubuntu both share a "flawed" utility that
changes output format based upon input redirection or pipeline(!). As well, the
latter two also behave slightly differently on what they count as whitespace:
\a and \b are both counted whitespace(!), even though the relevant man pages
on these systems omit these characters from the description.
This program follows FreeBSD and macOS, the arbiters of correct for these purposes.
Limits:
Requires the C locale and ASCII character set. Input should be less than ten million octets "toavoidthisproblem".
See Also:
You can enjoy this code from beginning to end. No whitespace was harmed in the creation of this program. All your base belong to us, but the constants seem a bit ... off?
Bonus
The script cow.sh provides a closer analog, and perhaps a more useful interface.
Included is a version without compilation warnings:
cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clean.c
Bugs
The flags are not supported. Although they could easily be added into cow.sh.
This exercise left to the reader.