diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-08-26 22:34:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-08-26 22:34:16 +0000 |
commit | 3a95bfe33afff44f54dc1db694ec1877e4260cdd (patch) | |
tree | 9c24459c5cef3f1786a37bc84bf9e97b26413823 /convert/merge2pcitable.pl | |
parent | bd3cc3f6b46bc7e90f9209a2ebdecc87c65f47d2 (diff) | |
download | ldetect-lst-3a95bfe33afff44f54dc1db694ec1877e4260cdd.tar ldetect-lst-3a95bfe33afff44f54dc1db694ec1877e4260cdd.tar.gz ldetect-lst-3a95bfe33afff44f54dc1db694ec1877e4260cdd.tar.bz2 ldetect-lst-3a95bfe33afff44f54dc1db694ec1877e4260cdd.tar.xz ldetect-lst-3a95bfe33afff44f54dc1db694ec1877e4260cdd.zip |
enhance error detection (too many double quotes)
Diffstat (limited to 'convert/merge2pcitable.pl')
-rwxr-xr-x | convert/merge2pcitable.pl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/convert/merge2pcitable.pl b/convert/merge2pcitable.pl index 06e00afa..fb2973ae 100755 --- a/convert/merge2pcitable.pl +++ b/convert/merge2pcitable.pl @@ -24,6 +24,7 @@ if ($0 =~ /merge2pcitable/) my $d_pci = read_pcitable($pcitable, 'strict'); my $d_in = $read->($in); merge($d_pci, $d_in); + exit 1 if our $error; cleanup_subids($d_pci) if !$keep_subids; write_pcitable($d_pci); } else { 1 } @@ -36,7 +37,7 @@ sub dummy_module { sub to_string { my ($id, $driver) = @_; - @$driver == 2 or die "error: to_string $id\n"; + @$driver == 2 or error("error: to_string $id"); my ($module, $text) = map { qq("$_") } @$driver; my ($id1, $id2, $subid1, $subid2) = map { "0x$_" } ($id =~ /(....)/g); join "\t", $id1, $id2, "$subid1 $subid2" ne "0xffff 0xffff" ? ($subid1, $subid2) : (), $module, $text; @@ -50,8 +51,9 @@ sub read_pcitable { my $line = 0; my $rm_quote_silent = sub { s/^"//; s/"$//; $_ }; my $rm_quote = sub { - s/^"// or print STDERR "missing left quote at line $line\n"; - s/"$// or print STDERR "missing right quote at line $line\n"; + s/^"// or error("$f:$line: missing left quote"); + s/"$// or error("$f:$line: missing right quote"); + /"/ and error("$f:$line: bad double quote"); $_; }; foreach (cat_($f)) { @@ -85,10 +87,10 @@ sub read_pcitable { $module = '"yenta_socket"' if $module =~ /i82365/; my $id = join '', map { s/^0x//; - length == 4 or print STDERR "$f $line: bad number $_\n"; + length == 4 or error("$f $line: bad number $_"); lc($_); } $id1, $id2, $subid1, $subid2; - $drivers{$id} and print STDERR "$f $line: multiple entry for $id (skipping $module $text)\n"; + $drivers{$id} and error("$f $line: multiple entry for $id (skipping $module $text)"); $drivers{$id} ||= [ map &$rm_quote, $module, $text ]; } else { die "$f $line: bad line\n"; @@ -320,3 +322,8 @@ sub cleanup_subids { } } } + +sub error { + our $error = 1; + print STDERR "$_[0]\n"; +} |