X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Fnessie_check.rb;h=cea8925e31438c8295f1b01ab5c89279d0677d13;hb=c26c0ae7602db9d3b2d7baf6ae6fc9639539ad02;hp=9ec83b2560539ba1f11f0bd62a633a21f0cd15e0;hpb=d3db763eeb456ce00849ecf658782f95b9f5634c;p=avr-crypto-lib.git diff --git a/host/nessie_check.rb b/host/nessie_check.rb index 9ec83b2..cea8925 100644 --- a/host/nessie_check.rb +++ b/host/nessie_check.rb @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/ruby # nessie_check.rb =begin This file is part of the AVR-Crypto-Lib. @@ -18,23 +18,25 @@ along with this program. If not, see . =end +$debug = true + def skip_header(file) begin l = file.gets().strip + l = '' if !l end until /[*]{10,}.*/.match(l) - puts("DBG 0.0: "+l) begin l = file.gets().strip + l = '' if !l end until /[*]{10,}.*/.match(l) - puts("DBG 0.1: "+l) begin l = file.gets().strip + l = '' if !l end until /[=]{5,}.*/.match(l) - puts("DBG 0.2: "+l) begin l = file.gets().strip + l = '' if !l end until /[=]{5,}.*/.match(l) - puts("DBG 0.3: "+l) end def get_next_assign(file, i) @@ -51,7 +53,7 @@ def get_next_assign(file, i) return nil if file.eof l = file.gets().strip() if not /[^=]+=[^=]+/.match(l) - value += l if /[0-9A-Fa-f]{5}/.match(l) + value += l if /^[0-9A-Fa-f]{5}/.match(l) end end until /[^=]+=[^=]+/.match(l) $last_assign[i] = l @@ -63,7 +65,7 @@ def get_next_assign(file, i) return nil if file.eof l = file.gets().strip() if not /[^=]+=[^=]+/.match(l) - value += l if /[0-9A-Fa-f]{5}/.match(l) + value += l if /^[0-9A-Fa-f]{5}/.match(l) end end until /[^=]+=[^=]+/.match(l) $last_assign[i] = l @@ -82,17 +84,16 @@ def compare(fname1, fname2) a = get_next_assign(file1, 0) b = get_next_assign(file2, 1) return if(a==nil or b==nil) - puts("") if pos%$linewidth==0 and pos!=0 - putc((a==b)?'*':'!') -# puts("a == nil") if a==nil -# puts("b == nil") if b==nil - + if not $quiet + puts("") if pos%$linewidth==0 and pos!=0 + putc((a==b)?'*':'!') + pos +=1 + end if(a!=b and a!=nil and b!=nil) - $error = 1 - puts("a key: "+a[0]+" value: "+a[1]) - puts("b key: "+b[0]+" value: "+b[1]) - end - pos +=1 + $error += 1 + puts("a key: "+a[0]+" value: "+a[1]) if $debug + puts("b key: "+b[0]+" value: "+b[1]) if $debug + end end until a==nil or b==nil end @@ -100,14 +101,30 @@ $error = 0 $linewidth=64 $last_assign=[nil, nil] -if ARGV.size!=2 +if ARGV.size<2 or ARGV.size>3 STDERR.print <