fluffy

Network Archaeology tools for Unix
git clone https://git.woozle.org/neale/fluffy.git

commit
fb2cc4c
parent
16ac8bd
author
Neale Pickett
date
2023-11-15 13:13:47 -0700 MST
New printy command
1 files changed,  +23, -0
A printy.c
+23, -0
 1@@ -0,0 +1,23 @@
 2+#include <stdio.h>
 3+#include <ctype.h>
 4+
 5+int main(int argc, char *argv[]) {
 6+    int c;
 7+    unsigned int count = 0;
 8+    unsigned int printy = 0;
 9+
10+    for (;;) {
11+        c = getchar();
12+        if (EOF == c) {
13+            break;
14+        }
15+        if (isprint(c)) {
16+            printy += 1;
17+        }
18+        count += 1;
19+    }
20+
21+    printf("%f\n", printy/(float)count);
22+
23+    return 0;
24+}