[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20080111041030.043498178@mvista.com>
Date: Thu, 10 Jan 2008 20:10:30 -0800
From: Daniel Walker <dwalker@...sta.com>
To: apw@...dowen.org
CC: jschopp@...tin.ibm.com
Subject: [PATCH] checkpatch.pl: allow piping
A little feature addition to allow checkpatch.pl to check patches piped
into it, in addition to specific file arguments.
Signed-off-by: Daniel Walker <dwalker@...sta.com>
---
scripts/checkpatch.pl | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
Index: linux-2.6.23/scripts/checkpatch.pl
===================================================================
--- linux-2.6.23.orig/scripts/checkpatch.pl
+++ linux-2.6.23/scripts/checkpatch.pl
@@ -24,6 +24,7 @@ my $file = 0;
my $check = 0;
my $summary = 1;
my $mailback = 0;
+my $piped = (-t STDIN) ? 0 : 1;
my $root;
GetOptions(
'q|quiet+' => \$quiet,
@@ -43,7 +44,7 @@ GetOptions(
my $exit = 0;
-if ($#ARGV < 0) {
+if ($#ARGV < 0 && !$piped) {
print "usage: $P [options] patchfile\n";
print "version: $V\n";
print "options: -q => quiet\n";
@@ -181,6 +182,18 @@ if ($tree && -f "$root/$removal") {
}
my @rawlines = ();
+
+if ($piped) {
+ while (<STDIN>) {
+ chomp;
+ push(@rawlines, $_);
+ }
+ if (!process("", @rawlines)) {
+ $exit = 1;
+ }
+ @rawlines = ();
+}
+
for my $filename (@ARGV) {
if ($file) {
open(FILE, "diff -u /dev/null $filename|") ||
--
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists