summaryrefslogtreecommitdiffstats
path: root/share/man/tools/pages.c
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1994-05-30 19:09:18 +0000
committerrgrimes <rgrimes@FreeBSD.org>1994-05-30 19:09:18 +0000
commitb0d61785cae024b1f44119446a940ee14c9ac959 (patch)
tree5a495a583b002ae9e57f09848ae697160708c220 /share/man/tools/pages.c
parentd43599f73ba5858e573c7ad8b284f6a0808c5c93 (diff)
downloadFreeBSD-src-b0d61785cae024b1f44119446a940ee14c9ac959.zip
FreeBSD-src-b0d61785cae024b1f44119446a940ee14c9ac959.tar.gz
BSD 4.4 Lite Share Sources
Diffstat (limited to 'share/man/tools/pages.c')
-rw-r--r--share/man/tools/pages.c34
1 files changed, 34 insertions, 0 deletions
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 <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);
+}
OpenPOWER on IntegriCloud