X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Fnessie_check.rb;h=33eb4a383447dcb67cf10f6d0d6e663abef45dad;hb=69d6349f8ad9d35c2acdb4e4e38ad42cd28b426c;hp=9ec83b2560539ba1f11f0bd62a633a21f0cd15e0;hpb=d3db763eeb456ce00849ecf658782f95b9f5634c;p=avr-crypto-lib.git diff --git a/host/nessie_check.rb b/host/nessie_check.rb index 9ec83b2..33eb4a3 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. @@ -22,19 +22,15 @@ def skip_header(file) begin l = file.gets().strip end until /[*]{10,}.*/.match(l) - puts("DBG 0.0: "+l) begin l = file.gets().strip end until /[*]{10,}.*/.match(l) - puts("DBG 0.1: "+l) begin l = file.gets().strip end until /[=]{5,}.*/.match(l) - puts("DBG 0.2: "+l) begin l = file.gets().strip end until /[=]{5,}.*/.match(l) - puts("DBG 0.3: "+l) end def get_next_assign(file, i) @@ -51,7 +47,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 +59,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 +78,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]) +# puts("b key: "+b[0]+" value: "+b[1]) + end end until a==nil or b==nil end @@ -100,14 +95,30 @@ $error = 0 $linewidth=64 $last_assign=[nil, nil] -if ARGV.size!=2 +if ARGV.size<2 or ARGV.size>3 STDERR.print <