From 95e75e05f3db3b734eb1cbd68a62ab16973d17b8 Mon Sep 17 00:00:00 2001 From: hjp Date: Mon, 12 Oct 1998 09:55:15 +0000 Subject: [PATCH] *** empty log message *** --- charhist/GNUmakefile | 10 ++++++++++ charhist/charhist.c | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 charhist/GNUmakefile create mode 100644 charhist/charhist.c diff --git a/charhist/GNUmakefile b/charhist/GNUmakefile new file mode 100644 index 0000000..574c244 --- /dev/null +++ b/charhist/GNUmakefile @@ -0,0 +1,10 @@ +include GNUmakevars +include GNUmakerules + +all: charhist + +chartab: +clean: + rm -f charhist core foo bar baz + +install: $(BINDIR)/charhist diff --git a/charhist/charhist.c b/charhist/charhist.c new file mode 100644 index 0000000..0017be8 --- /dev/null +++ b/charhist/charhist.c @@ -0,0 +1,19 @@ +#include +#include +#include + +long hist[UCHAR_MAX+1]; + +int main (int argc, char **argv) { + int c; + + 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; +}