Home | History | Annotate | Line # | Download | only in tools
      1 /*	$NetBSD: pages.c,v 1.2 1998/01/09 08:05:09 perry Exp $	*/
      2 
      3 #include <stdio.h>
      4 
      5 #define T_INIT	0100
      6 #define T_STOP	0111
      7 
      8 long	charin;			/* number of input character */
      9 
     10 main(argc, argv)
     11 char	**argv;
     12 {
     13 
     14 	int	 npages = 0;
     15 	register int	c;
     16 
     17 	while((c=getchar()) != EOF) {
     18 		charin++;
     19 		c &= 0377;
     20 		if(c != T_INIT)
     21 			continue;
     22 		else {
     23 			c=getchar();
     24 			c &= 0377;
     25 			if(c == T_STOP) {
     26 				npages++;
     27 				charin++;
     28 			}
     29 		}
     30 	}
     31 	if(charin<5) {
     32 		fprintf(stderr, "%s: no input\n", argv[0]);
     33 		exit(1);
     34 	}
     35 	printf("%d\n", npages);
     36 }
     37