]>
git.ipfire.org Git - thirdparty/pciutils.git/blob - maint/gen-zone
2 # Create a DNS zone with PCI ID records
8 foreach our $file (@ARGV) {
9 my $fn = ($file =~ /\.gz$/) ?
"zcat $file |" : ($file =~ /\.bz2$/) ?
"bzcat $file |" : $file;
10 open F
, $fn or die "Unable to open $file: $!";
14 print STDERR
"Error in $file, line $.: @_\n";
23 if (my ($indent, $id, $ignored, $name) = /^(\t*)(([0-9a-fA-Z]+ ?)*)(( |\t|$)\s*(.*))$/) {
24 my $depth = length $indent;
25 $depth <= @id or err
"Mismatched indentation";
26 @id = (@id[0..$depth-1], $id);
27 my $i = join(":", @id);
29 !exists $ids{$i} or die "ID $i defined twice";
31 $comments{$i} = $comm if $comm;
48 foreach my $i (keys %ids) {
49 my $j = join(".", reverse split(/[: ]/, $i));
50 print "$j.pci\tTXT \"i=", esc
($ids{$i}), "\"\n";
51 # print "$j.pci\tTXT \"c=", esc($comments{$i}), "\"\n"