Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/pod/splitman

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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];
} 

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.