summaryrefslogtreecommitdiff
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorTomasz Warniełło <tomasz.warniello@gmail.com>2022-02-18 19:16:19 +0100
committerJonathan Corbet <corbet@lwn.net>2022-02-24 10:52:45 -0700
commit43caf1a6823dc7c156cf38a6c71881c1e90cd3c2 (patch)
treeacf3fc3aeca91077934c82df8f30e3bdb3f28eb3 /scripts/kernel-doc
parenta5cdaea525c32e7def563ba07d9fef9bc6edffab (diff)
downloadlwn-43caf1a6823dc7c156cf38a6c71881c1e90cd3c2.tar.gz
lwn-43caf1a6823dc7c156cf38a6c71881c1e90cd3c2.zip
scripts: kernel-doc: Relink argument parsing error handling to pod2usage
The former usage function is substituted, although not as the -h and -help parameter handler yet. Purpose: Use Pod::Usage to handle documentation printing in an integrated way. Signed-off-by: Tomasz Warniełło <tomasz.warniello@gmail.com> Tested-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Disliked-by: Akira Yokosawa <akiyks@gmail.com> Link: https://lore.kernel.org/r/20220218181628.1411551-3-tomasz.warniello@gmail.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc20
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c8fbf1d3d5aa..e7f7251771bb 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -16,6 +16,8 @@ use strict;
## This software falls under the GNU General Public License. ##
## Please read the COPYING file for more information ##
+use Pod::Usage qw/pod2usage/;
+
=head1 NAME
kernel-doc - Print formatted kernel documentation to stdout
@@ -298,7 +300,13 @@ my $blankline_rst = "\n";
# read arguments
if ($#ARGV == -1) {
- usage();
+ pod2usage(
+ -message => "No arguments!\n",
+ -exitval => 1,
+ -verbose => 99,
+ -sections => 'SYNOPSIS',
+ -output => \*STDERR,
+ );
}
my $kernelversion;
@@ -518,8 +526,14 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
die "Sphinx version should either major.minor or major.minor.patch format\n";
}
} else {
- # Unknown argument
- usage();
+ # Unknown argument
+ pod2usage(
+ -message => "Argument unknown!\n",
+ -exitval => 1,
+ -verbose => 99,
+ -sections => 'SYNOPSIS',
+ -output => \*STDERR,
+ );
}
}