aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/tst/cf.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
commit1c7864f6d4380797b07c7149111066b61f69f689 (patch)
tree59057c26f97fdf846b0193e852eeea7e707a9e20 /code/tools/lcc/tst/cf.c
parent91db83f0cc7c564ff6c853eeb4e790732dae81cd (diff)
downloadioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.tar.gz
ioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.zip
* Moved lcc and q3asm into code/tools
git-svn-id: svn://svn.icculus.org/quake3/trunk@134 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools/lcc/tst/cf.c')
-rw-r--r--code/tools/lcc/tst/cf.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/code/tools/lcc/tst/cf.c b/code/tools/lcc/tst/cf.c
new file mode 100644
index 0000000..28efab7
--- /dev/null
+++ b/code/tools/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;
+}