mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
35 lines
468 B
C
35 lines
468 B
C
#include <stdio.h>
|
|
|
|
#define T_INIT 0100
|
|
#define T_STOP 0111
|
|
|
|
long charin; /* number of input character */
|
|
|
|
main(argc, argv)
|
|
char **argv;
|
|
{
|
|
|
|
int npages = 0;
|
|
register int c;
|
|
|
|
while((c=getchar()) != EOF) {
|
|
charin++;
|
|
c &= 0377;
|
|
if(c != T_INIT)
|
|
continue;
|
|
else {
|
|
c=getchar();
|
|
c &= 0377;
|
|
if(c == T_STOP) {
|
|
npages++;
|
|
charin++;
|
|
}
|
|
}
|
|
}
|
|
if(charin<5) {
|
|
fprintf(stderr, "%s: no input\n", argv[0]);
|
|
exit(1);
|
|
}
|
|
printf("%d\n", npages);
|
|
}
|