summaryrefslogtreecommitdiff
path: root/static/netbsd/tools/pages.c
blob: fe2304ecc91a6d4722490b46210d68244f79266c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*	$NetBSD: pages.c,v 1.2 1998/01/09 08:05:09 perry Exp $	*/

#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);
}