repo.or.cz
/
netbsd-mini2440.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
No empty .Rs/.Re
[netbsd-mini2440.git]
/
share
/
man
/
tools
/
pages.c
blob
725a2d81bbaa6525456bae1f5d7b18032e1821ac
1
/* $NetBSD$ */
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
}