3 # fixprogs - run through the list of entropy commands and
7 $entscale = 50; # divisor for optional entropy measurement
10 return("Usage: $0 <command file>\n");
13 if (($#ARGV == -1) || ($#ARGV>1)) {
17 # 'undocumented' option - run ent (in second param) on the output
24 $infilename = $ARGV[0];
26 if (!open(IN
, "<".$infilename)) {
27 die("Couldn't open input file");
29 $outfilename=$infilename.".out";
30 if (!open(OUT
, ">$outfilename")) {
31 die("Couldn't open output file $outfilename");
35 select(OUT
); $|=1; select(STDOUT
);
38 if (/^\s*\#/ || /^\s*$/) {
42 ($cmd, $path, $est) = /^\"([^\"]+)\"\s+([\w\/_
-]+)\s
+([\d\
.\
-]+)/o
;
43 @args = split(/ /, $cmd);
44 if (! ($pid = fork())) {
46 close STDIN
; close STDOUT
; close STDERR
;
47 open (STDIN
, "</dev/null");
48 open (STDOUT
, ">/dev/null");
49 open (STDERR
, ">/dev/null");
51 exit 1; # shouldn't be here
54 waitpid ($pid, 0); $ret=$?
>> 8;
60 # now try to run ent on the command
61 $mostargs=join(" ", splice(@args,1));
62 print "Evaluating '$path $mostargs'\n";
63 @ent = qx{$path $mostargs | $entcmd -b
-t
};
64 @ent = grep(/^1,/, @ent);
65 ($null, $null, $rate) = split(/,/, $ent[0]);
66 $est = $rate / $entscale; # scale the estimate back
69 print OUT
"\"$cmd\" $path $est\n";