All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: allow piping
@ 2008-01-11  4:11 ` Daniel Walker
  2008-01-11  8:52   ` Jiri Slaby
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Walker @ 2008-01-11  4:11 UTC (permalink / raw)
  To: apw; +Cc: linux-kernel, rdunlap, jschopp

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@mvista.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|") ||
-- 

-- 

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-01-14 19:54 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11  4:11 [PATCH] checkpatch.pl: allow piping Daniel Walker
2008-01-11  4:11 ` Daniel Walker
2008-01-11  8:52   ` Jiri Slaby
2008-01-11  9:17     ` Daniel Walker
2008-01-11  9:21       ` Jiri Slaby
2008-01-11  9:23         ` Bernd Petrovitsch
2008-01-11  9:30           ` Daniel Walker
2008-01-11  9:34             ` Jiri Slaby
2008-01-11  9:36               ` Daniel Walker
2008-01-11  9:41                 ` Jiri Slaby
2008-01-11  9:47                   ` Daniel Walker
2008-01-11 10:11                     ` Bernd Petrovitsch
2008-01-11 11:16                 ` Stefan Richter
2008-01-11 11:50                   ` Jiri Slaby
2008-01-11 17:06                     ` [PATCH] checkpatch.pl: show how to read from stdin Stefan Richter
2008-01-11 17:09                       ` Daniel Walker
2008-01-11 17:29                         ` Stefan Richter
2008-01-11 17:39                           ` Daniel Walker
2008-01-14 17:17                       ` Andy Whitcroft
2008-01-14 17:35                         ` Daniel Walker
2008-01-14 19:12                           ` Andy Whitcroft
2008-01-14 19:17                             ` Daniel Walker
2008-01-14 19:31                               ` Stefan Richter
2008-01-14 19:44                                 ` Jiri Slaby
2008-01-14 19:51                                 ` Daniel Walker
2008-01-11 10:08             ` [PATCH] checkpatch.pl: allow piping Bernd Petrovitsch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.