summaryrefslogtreecommitdiffstats
path: root/convert
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-15 14:46:56 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-15 14:46:56 +0000
commite262ad505b6696be24aa3cd3081b26be400e43eb (patch)
tree531c4252bda46294e573071319646802f12c7d5f /convert
parentce6e3978607718324eb4db033543cc57d8329617 (diff)
downloadldetect-lst-e262ad505b6696be24aa3cd3081b26be400e43eb.tar
ldetect-lst-e262ad505b6696be24aa3cd3081b26be400e43eb.tar.gz
ldetect-lst-e262ad505b6696be24aa3cd3081b26be400e43eb.tar.bz2
ldetect-lst-e262ad505b6696be24aa3cd3081b26be400e43eb.tar.xz
ldetect-lst-e262ad505b6696be24aa3cd3081b26be400e43eb.zip
handle buggy redhat pcitable
Diffstat (limited to 'convert')
-rwxr-xr-xconvert/merge2pcitable.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/convert/merge2pcitable.pl b/convert/merge2pcitable.pl
index b70da22a..dd8127bb 100755
--- a/convert/merge2pcitable.pl
+++ b/convert/merge2pcitable.pl
@@ -20,7 +20,7 @@ if ($0 =~ /merge2pcitable/)
($format, $in, $pcitable) = @ARGV;
my $read = $main::{"read_$format"} or die "unknown format $format (must be one of $formats)\n";
- my $d_pci = read_pcitable($pcitable);
+ my $d_pci = read_pcitable($pcitable, 'strict');
my $d_in = $read->($in);
merge($d_pci, $d_in);
cleanup_subids($d_pci);
@@ -43,7 +43,7 @@ sub to_string {
# works for RedHat's pcitable old and new format, + mdk format (alike RedHat's old one)
# (the new format has ending .o's and double quotes are removed)
sub read_pcitable {
- my ($f) = @_;
+ my ($f, $strict) = @_;
my %drivers;
my $line = 0;
my $rm_quote_silent = sub { s/^"//; s/"$//; $_ };
@@ -55,6 +55,12 @@ sub read_pcitable {
foreach (cat_($f)) {
chomp; $line++;
next if /^#/ || /^\s*$/;
+
+ if (!$strict) {
+ #- help poor written pcitable's like redhat's :)
+ s/(\S+)\s+(\S+)\s+(.*)/$1\t$2\t$3/;
+ }
+
if (my ($id1, $id2, @l) = split /\t+/) {
my ($subid1, $subid2) = ('ffff', 'ffff');
($subid1, $subid2, @l) = @l if @l == 4;
@@ -82,6 +88,8 @@ sub read_pcitable {
} $id1, $id2, $subid1, $subid2;
$drivers{$id} and print STDERR "$f $line: multiple entry for $id (skipping $module $text)\n";
$drivers{$id} ||= [ map &$rm_quote, $module, $text ];
+ } else {
+ die "$f $line: bad line\n";
}
}
\%drivers;