linux-old/scripts/split-man
<<
>>
Prefs
   1#!/usr/bin/perl
   2#
   3#      split-man: create man pages from kernel-doc -man output
   4#
   5# Author:       Tim Waugh <twaugh@redhat.com>
   6# Modified by:  Christoph Hellwig <hch@infradead.org>
   7#
   8
   9use strict;
  10
  11die "$0: where do I put the results?\n" unless ($#ARGV >= 0);
  12die "$0: can't create $ARGV[0]: $!\n" unless mkdir $ARGV[0], 0777;
  13
  14my $state = 0;
  15
  16while (<STDIN>) {
  17        s/&amp;(\w+)/\\fB\1\\fP/g; # fix smgl uglinesses
  18        if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
  19                close OUT unless ($state++ == 0);
  20                my $fn = "$ARGV[0]/$1.9";
  21                if (open OUT, ">$fn") {
  22                        print STDERR "creating $fn\n";
  23                } else {
  24                        die "can't open $fn: $!\n";
  25                }
  26
  27                print OUT $_;
  28        } elsif ($state != 0) {
  29                print OUT $_;
  30        }
  31}
  32
  33close OUT;
  34
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.