提交 43caf1a6 编写于 作者: T Tomasz Warniełło 提交者: Jonathan Corbet

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: NTomasz Warniełło <tomasz.warniello@gmail.com>
Tested-by: NRandy Dunlap <rdunlap@infradead.org>
Acked-by: NRandy Dunlap <rdunlap@infradead.org>
Disliked-by: NAkira Yokosawa <akiyks@gmail.com>
Link: https://lore.kernel.org/r/20220218181628.1411551-3-tomasz.warniello@gmail.comSigned-off-by: NJonathan Corbet <corbet@lwn.net>
上级 a5cdaea5
...@@ -16,6 +16,8 @@ use strict; ...@@ -16,6 +16,8 @@ use strict;
## This software falls under the GNU General Public License. ## ## This software falls under the GNU General Public License. ##
## Please read the COPYING file for more information ## ## Please read the COPYING file for more information ##
use Pod::Usage qw/pod2usage/;
=head1 NAME =head1 NAME
kernel-doc - Print formatted kernel documentation to stdout kernel-doc - Print formatted kernel documentation to stdout
...@@ -298,7 +300,13 @@ my $blankline_rst = "\n"; ...@@ -298,7 +300,13 @@ my $blankline_rst = "\n";
# read arguments # read arguments
if ($#ARGV == -1) { if ($#ARGV == -1) {
usage(); pod2usage(
-message => "No arguments!\n",
-exitval => 1,
-verbose => 99,
-sections => 'SYNOPSIS',
-output => \*STDERR,
);
} }
my $kernelversion; my $kernelversion;
...@@ -518,8 +526,14 @@ while ($ARGV[0] =~ m/^--?(.*)/) { ...@@ -518,8 +526,14 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
die "Sphinx version should either major.minor or major.minor.patch format\n"; die "Sphinx version should either major.minor or major.minor.patch format\n";
} }
} else { } else {
# Unknown argument # Unknown argument
usage(); pod2usage(
-message => "Argument unknown!\n",
-exitval => 1,
-verbose => 99,
-sections => 'SYNOPSIS',
-output => \*STDERR,
);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册