1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#!/usr/bin/perl
use strict;
use warnings;
# Define item leadin/leadout for man output
my $ITEM_LEADIN = '.IP "\fI';
my $ITEM_LEADOUT = '\fR(1)"';
# Open control file
open(CONTROL, "< ../debian/control") or die "unable to open control: $!";
my $package;
my $description;
# Parse the control file
while(<CONTROL>) {
chomp;
# A line starting with ' -' indicates a script
if (/^ - ([^:]*): (.*)/) {
if ($package and $description) {
# If we get here, then we need to output the man code
print $ITEM_LEADIN . $package . $ITEM_LEADOUT . "\n";
print $description . "\n";
}
$package = $1;
$description = $2
}
# Handle the last description
elsif (/^ \./ and $package and $description) {
print $ITEM_LEADIN . $package . $ITEM_LEADOUT . "\n";
print $description . "\n";
}
else {
s/^.{3}//;
$description .= $_;
}
}
|