diff options
author | zakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-08-26 04:48:05 +0000 |
---|---|---|
committer | zakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-08-26 04:48:05 +0000 |
commit | 952c5c128f9efaea89d41d882c4ea3ade7df4591 (patch) | |
tree | 91b84d9be7afad7e99ac64a640a65b6cb5081900 /lcc/tst/cf.c | |
parent | c2c2e0d25d6cdb7d42d7dc981a863f65f94f281d (diff) | |
download | ioquake3-aero-952c5c128f9efaea89d41d882c4ea3ade7df4591.tar.gz ioquake3-aero-952c5c128f9efaea89d41d882c4ea3ade7df4591.zip |
Itsa me, quake3io!
git-svn-id: svn://svn.icculus.org/quake3/trunk@2 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'lcc/tst/cf.c')
-rwxr-xr-x | lcc/tst/cf.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lcc/tst/cf.c b/lcc/tst/cf.c new file mode 100755 index 0000000..1c9226a --- /dev/null +++ b/lcc/tst/cf.c @@ -0,0 +1,32 @@ +/* cf - print character frequencies */
+float f[128];
+
+main(argc, argv)
+int argc;
+char *argv[];
+{
+ int i, c, nc;
+ float cutoff, atof();
+
+ if (argc <= 1)
+ cutoff = 0.0;
+ else
+ cutoff = atof(argv[1])/100;
+ for (i = 0; i <= 127; )
+ f[i++] = 0.0;
+ nc = 0;
+ while ((c = getchar()) != -1) {
+ f[c] += 1;
+ nc++;
+ }
+ printf("char\tfreq\n");
+ for (i = 0; i <= 127; ++i)
+ if (f[i] && f[i]/nc >= cutoff) {
+ if (i <= ' ')
+ printf("%03o", i);
+ else
+ printf("%c", i);
+ printf("\t%.1f\n", 100*f[i]/nc);
+ }
+ return 0;
+}
|