[PATCH 3/4] scripts/checkincludes.pl: Fix a bug introduced in the last commit

From: Cruz Julian Bishop
Date: Fri Aug 31 2012 - 09:18:27 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/