Merge from vendor branch OPENSSL:
[dragonfly.git] / share / man / tools / pages.c
1 #include <stdio.h>
2
3 #define T_INIT  0100
4 #define T_STOP  0111
5
6 long    charin;                 /* number of input character */
7
8 main(argc, argv)
9 char    **argv;
10 {
11
12         int      npages = 0;
13         register int    c;
14
15         while((c=getchar()) != EOF) {
16                 charin++;
17                 c &= 0377;
18                 if(c != T_INIT)
19                         continue;
20                 else {
21                         c=getchar();
22                         c &= 0377;
23                         if(c == T_STOP) {
24                                 npages++;
25                                 charin++;
26                         }
27                 }
28         }
29         if(charin<5) {
30                 fprintf(stderr, "%s: no input\n", argv[0]);
31                 exit(1);
32         }
33         printf("%d\n", npages);
34 }