simple/charhist/charhist.c

22 lines
389 B
C
Raw Permalink Normal View History

1998-10-12 11:55:15 +02:00
#include <ctype.h>
2000-01-19 12:31:57 +01:00
#include <locale.h>
1998-10-12 11:55:15 +02:00
#include <stdio.h>
#include <limits.h>
long hist[UCHAR_MAX+1];
int main (int argc, char **argv) {
int c;
2000-01-19 12:31:57 +01:00
setlocale(LC_ALL, "");
1998-10-12 11:55:15 +02:00
while ((c = getchar()) != EOF) {
hist[c]++;
}
for (c = 0; c <= UCHAR_MAX; c++) {
if (hist[c]) {
printf ("%x %d %o %c\t%ld\n", c, c, c, isprint(c) ? c : '.', hist[c]);
}
}
return 0;
}