From b0d61785cae024b1f44119446a940ee14c9ac959 Mon Sep 17 00:00:00 2001 From: rgrimes Date: Mon, 30 May 1994 19:09:18 +0000 Subject: BSD 4.4 Lite Share Sources --- share/man/tools/pages.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 share/man/tools/pages.c (limited to 'share/man/tools/pages.c') diff --git a/share/man/tools/pages.c b/share/man/tools/pages.c new file mode 100644 index 0000000..9e2e6d4 --- /dev/null +++ b/share/man/tools/pages.c @@ -0,0 +1,34 @@ +#include + +#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); +} -- cgit v1.1