summaryrefslogtreecommitdiff
path: root/pod/splitman
blob: 9fe404a0610b2f104b3da2e70e7376145bd25909 (plain)
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
39
40
41
42
43
44
45
46
#!/usr/bin/perl

while (<>) {
    if ($seqno = 1 .. /^\.TH/) {
	unless ($seqno =~ /e/i) {
	    $header .= $_;
	} 
	next;
    } 

    if ( /^\.Ip\s*"(.*)"\s*\d+$/) {
	$desking = 0;
	$desc = $1;
	if (name($desc) ne $myname) {
	    $myname = name($desc);
	    print $myname, "\n";
	    open(MAN, "> $myname.3pl");
	    print MAN <<EOALL;
$header
.TH $myname 3PL "\\*(RP"
.SH NAME 
$myname
.SH SYNOPSIS 
.B $desc
EOALL
	} else {
	    print MAN <<EOMORE;
.br
.ti +3n
or
.br
.B $desc
EOMORE
	} 
	next;
    } 
    unless ($desking) {
	print MAN ".SH DESCRIPTION\n";
	$desking = 1;
    } 
    print MAN;
} 

sub name {
    ($_[0] =~ /(\w+)/)[0];
}