%%s 0/0/0 %%d D 1.1 25-Mar-82 12:02:29 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- ccnt.r 728 asc 25-mar-82 07:24:18 v1.1 (sw-tools v1.1) #-h- main 655 asc 25-mar-82 07:24:09 v1.1 (sw-tools v1.1) ## ccnt - count characters in input file(s) DRIVER(ccnt) integer getarg, open, ditoc character buf(MAXLINE), getch, c integer i, nc(2), int call query("usage: ccnt [file] ...") initdi(nc) for (i=1; ; i=i+1) { if (getarg(i, buf, MAXLINE) == EOF) { if (i == 1) while (getch(c, STDIN) != EOF) incrdi(nc) break } else if (buf(1) == '-' & buf(2) == EOS) while (getch(c, STDIN) != EOF) incrdi(nc) else { int = open(buf, READ) if (int == ERR) call cant(buf) while (getch(c, int) != EOF) incrdi(nc) call close(int) } } i = ditoc(nc, buf, MAXCHARS) call putlin(buf, STDOUT) call putc('@n') DRETURN end #-h- ccnt.fmt 515 asc 25-mar-82 07:24:19 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Ccnt (1) 11-Jan-79 character count .sy ccnt [file] ... .ds ccnt counts characters in the named file(s). Newlines are counted as characters. If no file name or the file '-' is given, standard input will be read. .fl none .sa wcnt - count words .br lcnt - count lines .br the Unix command `wc' .di A message is printed if an input file cannot be opened; further processing is terminated. .au Original from Kernighan and Plauger's 'Software Tools', with minor modifications by Debbie Scherrer. .bu %%E 1