1 #!/usr/bin/env perl !! 1 #!/usr/bin/perl 2 # SPDX-License-Identifier: GPL-2.0 2 # SPDX-License-Identifier: GPL-2.0 3 # 3 # 4 # Author: Mauro Carvalho Chehab <mchehab+samsun 4 # Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> 5 # 5 # 6 # Produce manpages from kernel-doc. 6 # Produce manpages from kernel-doc. 7 # See Documentation/doc-guide/kernel-doc.rst f 7 # See Documentation/doc-guide/kernel-doc.rst for instructions 8 8 9 if ($#ARGV < 0) { 9 if ($#ARGV < 0) { 10 die "where do I put the results?\n"; 10 die "where do I put the results?\n"; 11 } 11 } 12 12 13 mkdir $ARGV[0],0777; 13 mkdir $ARGV[0],0777; 14 $state = 0; 14 $state = 0; 15 while (<STDIN>) { 15 while (<STDIN>) { 16 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { 16 if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { 17 if ($state == 1) { close OUT } 17 if ($state == 1) { close OUT } 18 $state = 1; 18 $state = 1; 19 $fn = "$ARGV[0]/$1.9"; 19 $fn = "$ARGV[0]/$1.9"; 20 print STDERR "Creating $fn\n"; 20 print STDERR "Creating $fn\n"; 21 open OUT, ">$fn" or die "can't open $f 21 open OUT, ">$fn" or die "can't open $fn: $!\n"; 22 print OUT $_; 22 print OUT $_; 23 } elsif ($state != 0) { 23 } elsif ($state != 0) { 24 print OUT $_; 24 print OUT $_; 25 } 25 } 26 } 26 } 27 27 28 close OUT; 28 close OUT;
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.