Große Umstellung. Viel hinzugefügt.
[h316.git] / pc-tools / ldc / charcount.c
diff --git a/pc-tools/ldc/charcount.c b/pc-tools/ldc/charcount.c
new file mode 100644 (file)
index 0000000..525edcf
--- /dev/null
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+main ()
+{
+    unsigned char buf;
+    int stat[256];
+    int c;
+    for (c = 0; c < 256; c++)
+       stat[c] = 0;
+    int ret;
+    do {
+       ret = read (0, &buf, 1);
+       stat[buf]++;
+    }
+    while (ret);
+    for (c = 0; c < 256; c++)
+       printf ("%03i:%04i\n", c, stat[c]);
+
+}