[PATCH] checkpatch.pl: allow piping
From: Daniel Walker
Date: Thu Jan 10 2008 - 23:21:32 EST
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@xxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/