mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tomasz Warniełło" <tomasz.warniello@gmail.com>
To: corbet@lwn.net
Cc: "Tomasz Warniełło" <tomasz.warniello@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 03/15] scripts: kernel-doc: Transform documentation into POD (3/15)
Date: Mon,  3 Jan 2022 05:43:36 +0100	[thread overview]
Message-ID: <20220103044338.506244-3-tomasz.warniello@gmail.com> (raw)
In-Reply-To: <20220103044338.506244-1-tomasz.warniello@gmail.com>

Step 3) Relink argument parsing error handling to pod2usage

The former usage function is substituted, although not as the -h and -help
parameter handler yet.

See step 1 for the series details.

Signed-off-by: Tomasz Warniełło <tomasz.warniello@gmail.com>
---
 scripts/kernel-doc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c8fbf1d3d5aa..9be526073b75 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,
+			);
     }
 }
 
-- 
2.30.2


  parent reply	other threads:[~2022-01-03  4:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  4:43 [PATCH v2 01/15] scripts: kernel-doc: Transform documentation into POD (1/15) Tomasz Warniełło
2022-01-03  4:43 ` [PATCH v2 02/15] scripts: kernel-doc: Transform documentation into POD (2/15) Tomasz Warniełło
2022-01-03  4:43 ` Tomasz Warniełło [this message]
2022-01-03  4:43 ` [PATCH v2 04/15] scripts: kernel-doc: Transform documentation into POD (4/15) Tomasz Warniełło
2022-01-03  4:43 ` [PATCH v2 05/15] scripts: kernel-doc: Transform documentation into POD (5/15) Tomasz Warniełło

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220103044338.506244-3-tomasz.warniello@gmail.com \
    --to=tomasz.warniello@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome