c -- 214
Implementation is almost right out of K&R. Relies on K&R semantics for main (unspecified return type), but I think it otherwise conforms to c89. Output format is specified below (but it assumes that chars == bytes).
#include <stdio.h>
int b,w,l,t,L;main(int c,char**v){FILE*f=fopen(v[1],"r");for(;(c=getc(f))
!=-1;++b){t++;if(c=='\n')l++,L=t>L?t:L,t=0;else if(c==' '||c=='\t')w++;}
L=t>L?t:L;printf("%d (%d) %d %d %d\n",l,L,w,b,b);}
There is some ambiguity in the meaning of "words" as yet. This version defines words as breaking only on '[ \t\n]
and does not account for a word that ends with EOF. This will work for files following the old unix convention of always ending with a newline, but break for those that stop hard on EOF.
It does test lines that end of EOF for maximal length.
Un-golfed
#include <stdio.h>
int b, /* bytes */
w, /* words */
l, /* lines */
t, /*this line*/
L; /* longest line */
main(int c,char**v){
FILE*f=fopen(v[1],"r");
for(;(c=getc(f))!=-1;++b){
t++;
if(c=='\n') l++, L = t>L ? t : L, t=0;
else if(c==' '||c=='\t')w++;
}
L = t>L ? t : L;
/* Output format is lines (max line length) words chars bytes */
printf("%d (%d) %d %d %d\n",l,L,w,b,b);
}
Validation
$ gcc -o wc wordcount_golf.c
$ ./wc wordcount.c
17 (67) 82 410 410
$ ./wc wordcount_golf.c
4 (74) 9 217 217
$ wc wordcount.c
17 67 410 wordcount.c
$ wc wordcount_golf.c
4 13 217 wordcount_golf.c