File: genmanpage.pl

package info (click to toggle)
devscripts 2.15.3%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 4,680 kB
  • ctags: 793
  • sloc: perl: 16,581; sh: 7,295; python: 950; makefile: 224; ansic: 28
file content (38 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (7)
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 .= $_;
    }
}