mirror of https://github.com/dirtbags/fluffy.git
Compare commits
No commits in common. "c66c6aea959048b5ff4a8ae6490c07b1fa684704" and "16ac8bd6acc2b63d54b052ca979a66f75dc3791c" have entirely different histories.
c66c6aea95
...
16ac8bd6ac
1
Makefile
1
Makefile
|
@ -16,7 +16,6 @@ TARGETS += hex
|
|||
TARGETS += entropy
|
||||
TARGETS += freq
|
||||
TARGETS += histogram
|
||||
TARGETS += printy
|
||||
|
||||
SCRIPTS += octets
|
||||
|
||||
|
|
13
README.md
13
README.md
|
@ -232,19 +232,6 @@ Displays the Shannon entropy of the input.
|
|||
0.865857
|
||||
|
||||
|
||||
## printy: show density of printable octets
|
||||
|
||||
Displays the number of printable octets
|
||||
divided by the total number of octets.
|
||||
|
||||
$ echo -n abcd | ./printy
|
||||
1.000000
|
||||
$ echo abcd | ./printy # Newline is not printable
|
||||
0.800000
|
||||
$ echo 00 41 | ./unhex | ./printy
|
||||
0.500000
|
||||
|
||||
|
||||
## pyesc: python escape input
|
||||
|
||||
Escapes input octets for pasting into a python "print" statement.
|
||||
|
|
23
printy.c
23
printy.c
|
@ -1,23 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int c;
|
||||
unsigned int count = 0;
|
||||
unsigned int printy = 0;
|
||||
|
||||
for (;;) {
|
||||
c = getchar();
|
||||
if (EOF == c) {
|
||||
break;
|
||||
}
|
||||
if (isprint(c)) {
|
||||
printy += 1;
|
||||
}
|
||||
count += 1;
|
||||
}
|
||||
|
||||
printf("%f\n", printy/(float)count);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue