static char *sccsid
= "@(#)wc.c 4.3 (Berkeley) %G%";
/* wc line and word count */
long linect
, wordct
, charct
, pagect
;
long tlinect
, twordct
, tcharct
, tpagect
;
int baud
=300; /* baud rate */
int cps
=30; /* # of chars per second */
int lpp
=66; /* # of lines per page */
while (argc
> 1 && *argv
[1] == '-') {
case 'l': case 'w': case 'c': case 'p': case 't':
fprintf(stderr
, "Usage: wc [-lwcpt] [-v] [-u] [-spagesize] [-bbaudrate]\n");
cps
= cps
* 9 / 10; /* 27 cps at 300 baud */
printf("time@%d\t",baud
);
if(argc
>1 && (fp
=fopen(argv
[i
], "r")) == NULL
) {
fprintf(stderr
, "wc: can't open %s\n", argv
[i
]);
/* print lines, words, chars */
wcp(wd
, charct
, wordct
, linect
, pagect
);
printf(" %s\n", argv
[i
]);
wcp(wd
, tcharct
, twordct
, tlinect
, tpagect
);
wcp(wd
, charct
, wordct
, linect
, pagect
)
long charct
; long wordct
; long linect
, pagect
;
while (*wd
) switch (*wd
++) {
printf("%4.1f %2s\t", t
, units
);