#!/usr/bin/perl # vim: set ts=4: if ($#ARGV < 1) { print STDERR "Usage: $0: SECTIONID TITLE [FILE]...\n"; exit(2); } my $section_id = shift; my $title = shift; print ' %comedilib_entities; ]>
', "$title", ' '; while(<>){ push @lines,$_; } $status="unknown"; while($s = shift @lines){ @x = $s; if($s =~ m/^\w+\:/){ $blank=0; chomp $s; $x = $s; LOOP: while($s = shift @lines){ if($s =~ m/^\w+:/ or $s eq "\n"){ unshift @lines, $s; last LOOP; } chomp $s; $x = "$x $s"; } if($x =~ m/^Driver: (.*)/){ $driver = $1; }elsif($x =~ m/^Description: (.*)/){ $description = $1; }elsif($x =~ m/^Devices: (.*)/){ $devices = $1; }elsif($x =~ m/^Author: (.*)/){ $author = $1 }elsif($x =~ m/^Status: (.*)/){ $status = $1 } }else{ if($s eq "\n"){ $blank ++; }else{ $blank = 0; } $comment = $comment . $s; } if($blank==3){ $comment =~ s/&/&/g; $comment =~ s/@/@/g; $comment =~ s//>/g; $author =~ s/&/&/g; $author =~ s/@/@/g; $author =~ s//>/g; $description =~ s/&/&/g; print "
$driver -- $description Author: $author Status: $status "; if($devices ne ""){ print " Manufacturer Device Name "; while($devices){ $_=$devices; if(m/^ *\[([^\]]+)\](.*)/){ $mfr = $1; $devices = $2; }elsif(m/^ *\(([^\)]+)\)(.*)/){ $name = $1; $devices = $2; }elsif(m/^ *([^\(,]+)(.*)/){ $dev = $1; $devices = $2; $dev =~ s/ *$//; }elsif(m/^ *,(.*)/){ $devices = $1; print " $mfr $dev $name "; }else{ die "parse error"; } } print " $mfr $dev $name "; } print " $comment
"; $blank=0; $comment=""; $status="unknown"; } } print "
"; exit(0);