summaryrefslogtreecommitdiff
path: root/static/netbsd/tools/pages.c
diff options
context:
space:
mode:
Diffstat (limited to 'static/netbsd/tools/pages.c')
-rw-r--r--static/netbsd/tools/pages.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/static/netbsd/tools/pages.c b/static/netbsd/tools/pages.c
new file mode 100644
index 00000000..fe2304ec
--- /dev/null
+++ b/static/netbsd/tools/pages.c
@@ -0,0 +1,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);
+}