mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cruz Julian Bishop <cruzjbishop@gmail.com>
To: mcgrof@gmail.com
Cc: linux-kernel@vger.kernel.org, Cruz Julian Bishop <cruzjbishop@gmail.com>
Subject: [PATCH 3/4] scripts/checkincludes.pl: Fix a bug introduced in the last commit
Date: Fri, 31 Aug 2012 23:18:09 +1000	[thread overview]
Message-ID: <1346419090-3808-4-git-send-email-cruzjbishop@gmail.com> (raw)
In-Reply-To: <1346419090-3808-1-git-send-email-cruzjbishop@gmail.com>

Since the previous commit, simply specifying -r without any files
caused no message to be displayed.

Before said commit, the usage() function was called.

This commit simply calls the usage() function if no files were
specified - This includes once other arguments are supported.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
---
 scripts/checkincludes.pl |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl
index 7d713c2..cde7ce1 100755
--- a/scripts/checkincludes.pl
+++ b/scripts/checkincludes.pl
@@ -30,12 +30,16 @@ if ($#ARGV < 0) {
 	usage();
 }
 
+my $argc = 0;
+
 foreach my $arg (@ARGV) {
 	if ($arg eq "-r") {
 		$remove = 1;
 	} else {
 		open(my $f, '<', $arg)
 		    or die "Cannot open $arg: $!.\n";
+		    
+		$argc++;
 
 		my %includedfiles = ();
 		my @file_lines = ();
@@ -84,3 +88,7 @@ foreach my $arg (@ARGV) {
 		close($f);
 	}
 }
+
+if ($argc == 0) {
+	usage();
+}
-- 
1.7.9.5


  parent reply	other threads:[~2012-08-31 13:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-31 13:18 [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux Cruz Julian Bishop
2012-08-31 13:18 ` [PATCH 1/4] scripts/checkincludes.pl: Print usage with heredoc Cruz Julian Bishop
2012-08-31 13:18 ` [PATCH 2/4] scripts/checkincludes.pl: Simplify and shorten argument logic Cruz Julian Bishop
2012-08-31 15:42   ` Joe Perches
2012-08-31 21:54     ` Cruz Julian Bishop
2012-08-31 13:18 ` Cruz Julian Bishop [this message]
2012-08-31 13:18 ` [PATCH 4/4] scripts/checkincludes.pl: Introduce 'quiet' mode Cruz Julian Bishop
2012-08-31 13:23 ` [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux Cruz Julian Bishop
2012-08-31 18:09 ` Jesper Juhl
2012-08-31 21:55   ` Cruz Julian Bishop

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=1346419090-3808-4-git-send-email-cruzjbishop@gmail.com \
    --to=cruzjbishop@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@gmail.com \
    /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

all inboxes | Powered by JetHome®