/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "calico.p" */ #include /* character and line counts of a file susan p. scolman copyright (c) 1986 module library: delman */ /* begin module version */ #define version 1.08 main(argc, argv) int argc; Char *argv[]; { /* of calico.p 1993 January 27 origin: march 7, 1982 */ /* end module version */ /* begin module describe.calico */ /* name calico: character and line counts of a file synopsis calico(input: in, output: out); files input: a file for which one wants to know the number of characters and lines output: the number of characters and lines in input description there are many circumstances when one would like to know the number of characters and the number of lines in a file. examples will a file fit on one page? can this file be put into the memory of a personal computer for transportation to another computer? author susan p. scolman and thomas d. schneider bugs none known technical notes blanks at ends of lines are counted as characters. only the end of line mark is counted, not carriage return and line feed. */ /* end module describe.calico */ long tchars = 0; /* total characters */ long lines = 0; /* total lines */ PASCAL_MAIN(argc, argv); printf(" calico %4.2f\n", version); while (!P_eof(stdin)) { /* line count */ while (!P_eoln(stdin)) { /* character count */ getc(stdin); tchars++; } scanf("%*[^\n]"); getchar(); lines++; } printf(" the file contains"); printf(" %ld characters and %ld lines.\n", tchars, lines); exit(EXIT_SUCCESS); } /* calico */ /* End. */