/* reccount.c - count the number of records in a filr */ /* ufilter2.c - prototype filter program - line (actually record) oriented */ /***************************************\ * * * fails for binary files * * * \***************************************/ #include #include #define BUFSIZ 4096 char buffer[BUFSIZ]; long k; main(argc,argv) char **argv; BEGIN register int howlong; /* char length of this record */ k = 0; WHILE (!feof(stdin)) DO howlong = fget(buffer,BUFSIZ,stdin); IF (ferror(stdin)) THEN error("read failure $$ferr=%oo\7\n",$$ferr); FI IF (feof(stdin)) THEN break; FI k++; OD printf("%ld.\n",k); END /* end: ufilter2.c */ /* end: reccount.c */