Trust uboot's device list only if it does not look suspicious.
[AROS.git] / scripts / catcheck.awk
blobaf353725804246bbc1acbb4e8b75587d8e72cde7
1 #!/usr/bin/awk -f
2 BEGIN {
3 if( ARGC!=4 )
5 print "too few arguments, use:"
6 print "awk -f catcheck.awk <somemessage> <cd-file> <ct-file>"
8 else
10 message=ARGV[1];
11 cdfile=ARGV[2];
12 ctfile=ARGV[3];
13 # print "cdfile:", cdfile;
14 defline=1;
15 countcd = 0;
16 while ((getline line <cdfile) > 0)
18 if( line ~ /^[;#]/ )
19 defline=1;
20 else if( line )
22 if( defline )
24 defline=0;
25 countcd++;
26 split(line, wrd, "[ \t\r\n]");
27 # print "def: ", line, "w:", wrd[1];
28 def[toupper(wrd[1])]=1;
32 # for(word in def) print "word: ", word, ";def: ", def[word];
33 # print "ctfile:", ctfile;
34 defline=1;
35 countct = 0;
36 countmatch = 0;
37 while ((getline line <ctfile) > 0)
39 if( line ~ /^[;#]/ )
40 defline=1;
41 else if( line )
43 if( defline )
45 defline=0;
46 countct++;
47 split(line, wrd, "[ \t\r\n]");
48 # print "def: ",line,"w:", wrd[1];
49 if( def[toupper(wrd[1])]==1 )
51 # print"Match!";
52 def[toupper(wrd[1])]=2
53 countmatch++;
55 else
57 print"+:" wrd[1];
62 for(word in def)
64 if( def[word]==1 ) print "-:" word;
66 # print "cd:" countcd " ct:" countct " match:" countmatch;
67 # final output format: message "number of entries in CD" : "missing entries in CT" : "extra entries in CT"
68 print message countcd ":" countcd-countmatch ":" countct-countmatch;