Reading Software Tools again recently, I came across

"wordcount is naive about a construct such as "either/or", which most
people would count as two words...".

GNU wc is naive about this too.  Not a bug, but an inaccuracy.  Well,
fixing this is very simple.  In <textutils>/src/wc.c, the function
"wc" has a switch statement like so:

[...]
              switch (*p++)
                {
                case '\n':
                  lines++;
                  /* Fall through. */
                case '\r':
                case '\f':
                case '\t':
                case '\v':
                case ' ':
[...]

Here, I appended an aditional line:

                case '/':

Hardly earth-shattering, I know, but it does make wc -w more accurate.

Paul

Reply via email to