summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/doc-guide/kernel-doc.rst30
-rwxr-xr-xscripts/split-man.pl28
2 files changed, 30 insertions, 28 deletions
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst
index 64ca081d075e..466347067f79 100644
--- a/Documentation/doc-guide/kernel-doc.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -528,32 +528,6 @@ How to use kernel-doc to generate man pages
528------------------------------------------- 528-------------------------------------------
529 529
530If you just want to use kernel-doc to generate man pages you can do this 530If you just want to use kernel-doc to generate man pages you can do this
531from the Kernel git tree:: 531from the kernel git tree::
532 532
533 $ scripts/kernel-doc -man $(git grep -l '/\*\*' |grep -v Documentation/) | ./split-man.pl /tmp/man 533 $ scripts/kernel-doc -man $(git grep -l '/\*\*' -- :^Documentation :^tools) | scripts/split-man.pl /tmp/man
534
535Using the small ``split-man.pl`` script below::
536
537
538 #!/usr/bin/perl
539
540 if ($#ARGV < 0) {
541 die "where do I put the results?\n";
542 }
543
544 mkdir $ARGV[0],0777;
545 $state = 0;
546 while (<STDIN>) {
547 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) {
548 if ($state == 1) { close OUT }
549 $state = 1;
550 $fn = "$ARGV[0]/$1.9";
551 print STDERR "Creating $fn\n";
552 open OUT, ">$fn" or die "can't open $fn: $!\n";
553 print OUT $_;
554 } elsif ($state != 0) {
555 print OUT $_;
556 }
557 }
558
559 close OUT;
diff --git a/scripts/split-man.pl b/scripts/split-man.pl
new file mode 100755
index 000000000000..bfe16cbe42df
--- /dev/null
+++ b/scripts/split-man.pl
@@ -0,0 +1,28 @@
1#!/usr/bin/perl
2# SPDX-License-Identifier: GPL-2.0
3#
4# Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5#
6# Produce manpages from kernel-doc.
7# See Documentation/doc-guide/kernel-doc.rst for instructions
8
9if ($#ARGV < 0) {
10 die "where do I put the results?\n";
11}
12
13mkdir $ARGV[0],0777;
14$state = 0;
15while (<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 $_;
25 }
26}
27
28close OUT;