diff options
| author | Hannes Eder <hannes@hanneseder.net> | 2009-09-21 20:04:37 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:48 -0400 |
| commit | 77f5b10a82bbd832c99ec4b120d5645342a5b140 (patch) | |
| tree | 13359c9798da6babc144262b59f777e664ac195e | |
| parent | 30dad6ebecffebddf6b9947d11e31377fa900ff3 (diff) | |
checkpatch: make -f alias --file, add --help, more verbose help message
Impact:
- More verbose help/usage message.
- Make the option -f an alias for --file.
- On -h, --help, and --version display help message and exit(0).
- With no FILE(s) given, exit(1) with "no input files".
- On invalid options display help/usage and exit(1).
Based on a patch by Pavel Machek.
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rwxr-xr-x | scripts/checkpatch.pl | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b6f267b72035..e3c6b4922fff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -28,6 +28,41 @@ my $mailback = 0; | |||
| 28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
| 29 | my $root; | 29 | my $root; |
| 30 | my %debug; | 30 | my %debug; |
| 31 | my $help = 0; | ||
| 32 | |||
| 33 | sub help { | ||
| 34 | my ($exitcode) = @_; | ||
| 35 | |||
| 36 | print << "EOM"; | ||
| 37 | Usage: $P [OPTION]... [FILE]... | ||
| 38 | Version: $V | ||
| 39 | |||
| 40 | Options: | ||
| 41 | -q, --quiet quiet | ||
| 42 | --no-tree run without a kernel tree | ||
| 43 | --no-signoff do not check for 'Signed-off-by' line | ||
| 44 | --patch treat FILE as patchfile (default) | ||
| 45 | --emacs emacs compile window format | ||
| 46 | --terse one line per report | ||
| 47 | -f, --file treat FILE as regular source file | ||
| 48 | --subjective, --strict enable more subjective tests | ||
| 49 | --root=PATH PATH to the kernel tree root | ||
| 50 | --no-summary suppress the per-file summary | ||
| 51 | --mailback only produce a report in case of warnings/errors | ||
| 52 | --summary-file include the filename in summary | ||
| 53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
| 54 | 'values', 'possible', 'type', and 'attr' (default | ||
| 55 | is all off) | ||
| 56 | --test-only=WORD report only warnings/errors containing WORD | ||
| 57 | literally | ||
| 58 | -h, --help, --version display this help and exit | ||
| 59 | |||
| 60 | When FILE is - read standard input. | ||
| 61 | EOM | ||
| 62 | |||
| 63 | exit($exitcode); | ||
| 64 | } | ||
| 65 | |||
| 31 | GetOptions( | 66 | GetOptions( |
| 32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
| 33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
| @@ -35,7 +70,7 @@ GetOptions( | |||
| 35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
| 36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
| 37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
| 38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
| 39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
| 40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
| 41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
| @@ -45,22 +80,16 @@ GetOptions( | |||
| 45 | 80 | ||
| 46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
| 47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
| 48 | ) or exit; | 83 | 'h|help' => \$help, |
| 84 | 'version' => \$help | ||
| 85 | ) or help(1); | ||
| 86 | |||
| 87 | help(0) if ($help); | ||
| 49 | 88 | ||
| 50 | my $exit = 0; | 89 | my $exit = 0; |
| 51 | 90 | ||
| 52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
| 53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
| 54 | print "version: $V\n"; | ||
| 55 | print "options: -q => quiet\n"; | ||
| 56 | print " --no-tree => run without a kernel tree\n"; | ||
| 57 | print " --terse => one line per report\n"; | ||
| 58 | print " --emacs => emacs compile window format\n"; | ||
| 59 | print " --file => check a source file\n"; | ||
| 60 | print " --strict => enable more subjective tests\n"; | ||
| 61 | print " --root => path to the kernel tree root\n"; | ||
| 62 | print " --no-summary => suppress the per-file summary\n"; | ||
| 63 | print " --summary-file => include the filename in summary\n"; | ||
| 64 | exit(1); | 93 | exit(1); |
| 65 | } | 94 | } |
| 66 | 95 | ||
