diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-09-09 12:40:30 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-09-09 12:40:30 +0000 |
commit | 6ca12dda6ac2a788fd9a495879e8e5651127b233 (patch) | |
tree | 1f7d55d0f84bde2cc7fb731293c9981d3a156a3b | |
parent | b2fc946d3f5794736d99e9c9dd426c636e268260 (diff) |
xpp-zaptel: fix init_card_2_30 opermode verification
* In case of any diff, exit with non-zero status so the build fails.
* Print filename:lineno of missing or changed lines.
* Fix two countries (typos fixed in COLOMBIA and CYPRUS).
From xpp rev. 6107.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4517 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-x | xpp/init_card_2_30 | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/xpp/init_card_2_30 b/xpp/init_card_2_30 index c682c19..859aca4 100755 --- a/xpp/init_card_2_30 +++ b/xpp/init_card_2_30 @@ -127,9 +127,9 @@ BULGARIA reg16=00 reg26=C2 reg30=03 reg31=20 CANADA reg16=00 reg26=C0 reg30=00 reg31=20 CHILE reg16=00 reg26=C0 reg30=00 reg31=20 CHINA reg16=00 reg26=30 reg30=0F reg31=20 -COLUMBIA reg16=00 reg26=C0 reg30=00 reg31=20 +COLOMBIA reg16=00 reg26=C0 reg30=00 reg31=20 CROATIA reg16=00 reg26=C2 reg30=02 reg31=20 -CYRPUS reg16=00 reg26=C2 reg30=02 reg31=20 +CYPRUS reg16=00 reg26=C2 reg30=02 reg31=20 CZECH reg16=00 reg26=C2 reg30=02 reg31=20 DENMARK reg16=00 reg26=C2 reg30=02 reg31=28 ECUADOR reg16=00 reg26=C0 reg30=00 reg31=20 @@ -263,6 +263,8 @@ sub opermode_to_string($) { sub opermode_verify($) { my $input = shift or die; my %verification_table; + my %location_lines; + my $status = 0; open(F, $input) or die "$0: Failed opening '$input': $!\n"; while(<F>) { @@ -275,22 +277,25 @@ sub opermode_verify($) { my ($key, $val) = split(/=/, $p, 2); $verification_table{$location}{$key} = $val; } + $location_lines{$location} = $.; } close F; # First test: check for missing data in our program foreach my $location (sort keys %verification_table) { my $mode = $opermode_table{$location}; if(! defined $mode) { - printf STDERR "Missing $location\n"; + printf STDERR "Missing $location at $input:$location_lines{$location}\n"; + $status = 1; next; } my $verify_mode = $verification_table{$location}; my $str1 = opermode_to_string($mode); my $str2 = opermode_to_string($verify_mode); if($str1 ne $str2) { - print STDERR "DIFF: $location:\n"; + print STDERR "DIFF: $location at $input:$location_lines{$location}\n"; printf STDERR "\t%-20s: %s\n", "program", $str1; printf STDERR "\t%-20s: %s\n", "verify", $str2; + $status = 1; } } # Second test: check for extra data in our program @@ -298,9 +303,11 @@ sub opermode_verify($) { my $mode = $verification_table{$location}; if(! defined $mode) { printf STDERR "Extra $location\n"; + $status = 1; next; } } + return $status; } sub read_defaults() { @@ -335,8 +342,7 @@ if(@ARGV and $ARGV[0] =~ /^verify(.*)/) { my $verify_file = $1; die "Usage: $0 verify=filename\n" unless $verify_file =~ s/^=//; main::debug "$0: opermode verification (input='$verify_file')"; - FXO::opermode_verify($verify_file); - exit 0; + exit FXO::opermode_verify($verify_file); } main::logit "Starting"; |