Merge tag 'upstream-4.18-rc1' of git://git.infradead.org/linux-ubifs
[linux-2.6/btrfs-unstable.git] / scripts / split-man.pl
blobc3db607ee9ec19909b8b1c78328795a1ce23f12c
1 #!/usr/bin/perl
2 # SPDX-License-Identifier: GPL-2.0
4 # Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6 # Produce manpages from kernel-doc.
7 # See Documentation/doc-guide/kernel-doc.rst for instructions
9 if ($#ARGV < 0) {
10 die "where do I put the results?\n";
13 mkdir $ARGV[0],0777;
14 $state = 0;
15 while (<STDIN>) {
16 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
17 if ($state == 1) { close OUT }
18 $state = 1;
19 $fn = "$ARGV[0]/$1.9";
20 print STDERR "Creating $fn\n";
21 open OUT, ">$fn" or die "can't open $fn: $!\n";
22 print OUT $_;
23 } elsif ($state != 0) {
24 print OUT $_;
28 close OUT;