X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Ffix-wiki-size.rb;h=53a480efdb4ee007bb948d1aff7698cc951d067e;hb=844f84ce4ba776bf5320b2e92db8b3a9e4d0d6d9;hp=2bc08c841c174d33cf4332b44169565b84d9b7e4;hpb=b022a029def51d63f330c12bf07156db294c8958;p=avr-crypto-lib.git
diff --git a/host/fix-wiki-size.rb b/host/fix-wiki-size.rb
index 2bc08c8..53a480e 100644
--- a/host/fix-wiki-size.rb
+++ b/host/fix-wiki-size.rb
@@ -19,6 +19,10 @@
along with this program. If not, see .
=end
+
+require 'rubygems'
+require 'getopt/std'
+
=begin
| Blake-28 || C || C
| 10916
@@ -32,7 +36,7 @@ memxor: 24
=end
-def fix_file(fin, fout)
+def fix_file(fin, fout, supress)
loop do
return if fin.eof()
comp = Array.new
@@ -45,9 +49,13 @@ def fix_file(fin, fout)
end until comp[i-1].match(/^\|/)
sum = 0
(i-1).times{ |j| sum += comp[j].match(/[^:]*:[\s]*([\d]*)/)[1].to_i}
- fout.puts(lb1)
- fout.printf("| %d
\n", sum)
- comp.each{ |s| fout.puts(s)}
+ fout.print(lb1.chomp)
+ if supress
+ fout.printf(" || %d |%s", sum, comp.last)
+ else
+ fout.printf("\n| %d
\n", sum)
+ comp.each{ |s| fout.puts(s)}
+ end
begin
lb1 = fin.readline()
fout.puts(lb1)
@@ -62,11 +70,12 @@ end
fin = STDIN
fout = STDOUT
+opts = Getopt::Std.getopts("s")
fin = File.open(ARGV[0], "r") if ARGV.size > 0
fout = File.open(ARGV[1], "w") if ARGV.size > 1
-fix_file(fin, fout)
+fix_file(fin, fout, opts["s"])
fin.close if ARGV.size > 0
fout.close if ARGV.size > 1