aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJuanma Barranquero2006-11-02 11:52:15 +0000
committerJuanma Barranquero2006-11-02 11:52:15 +0000
commit43983eb155ae7edca7ad3f035147dfdde5875860 (patch)
tree8533c6c80af05d7a67d970b5d572934b104516d4 /lib-src
parent82306b14c3da167cb468bf716f08a669a7ab6e7f (diff)
downloademacs-43983eb155ae7edca7ad3f035147dfdde5875860.tar.gz
emacs-43983eb155ae7edca7ad3f035147dfdde5875860.zip
When called with no arguments (not even a filter), show help instead of
blindingly dumping every single ChangeLog available. Doc fix. Update version.
Diffstat (limited to 'lib-src')
-rwxr-xr-xlib-src/grep-changelog49
1 files changed, 30 insertions, 19 deletions
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
index e3d3af2c577..8c19486ea2e 100755
--- a/lib-src/grep-changelog
+++ b/lib-src/grep-changelog
@@ -36,22 +36,33 @@ use vars qw($author $regexp $exclude $from_date $to_date
36 @entries); 36 @entries);
37 37
38use Getopt::Long; 38use Getopt::Long;
39my $result = GetOptions ("author=s" => \$author, 39
40 "text=s" => \$regexp, 40my $result;
41 "exclude=s" => \$exclude, 41
42 "from-date=s" => \$from_date, 42if (@ARGV == 0) {
43 "to-date=s" => \$to_date, 43
44 "rcs-log" => \$rcs_log, 44 # No arguments cannot posibly mean "show everything"!!
45 "with-date" => \$with_date, 45 $result = 0;
46 "reverse!" => \$reverse, 46
47 "version" => \$version, 47} else {
48 "help" => \$help); 48
49 49 $result = GetOptions ("author=s" => \$author,
50# If date options are specified, check that they have the format 50 "text=s" => \$regexp,
51# YYYY-MM-DD. 51 "exclude=s" => \$exclude,
52 52 "from-date=s" => \$from_date,
53$result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/; 53 "to-date=s" => \$to_date,
54$result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/; 54 "rcs-log" => \$rcs_log,
55 "with-date" => \$with_date,
56 "reverse!" => \$reverse,
57 "version" => \$version,
58 "help" => \$help);
59
60 # If date options are specified, check that they have the format
61 # YYYY-MM-DD.
62
63 $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
64 $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
65}
55 66
56# Print usage information and exit when necessary. 67# Print usage information and exit when necessary.
57 68
@@ -77,7 +88,7 @@ Valid options are:
77 --help Print this help 88 --help Print this help
78 89
79If no CHANGELOG is specified scan the files "ChangeLog" and 90If no CHANGELOG is specified scan the files "ChangeLog" and
80"ChangeLog.1+" in the current directory. Old-style dates in ChangeLogs 91"ChangeLog.N+" in the current directory. Old-style dates in ChangeLogs
81are not recognized. 92are not recognized.
82USAGE 93USAGE
83 exit !$help; 94 exit !$help;
@@ -86,7 +97,7 @@ USAGE
86# Print version info and exit if `--version' was specified. 97# Print version info and exit if `--version' was specified.
87 98
88if ($version) { 99if ($version) {
89 print "0.2\n"; 100 print "0.3\n";
90 exit 0; 101 exit 0;
91} 102}
92 103
@@ -233,7 +244,7 @@ sub parse_changelog {
233 244
234# If files were specified on the command line, parse those files in the 245# If files were specified on the command line, parse those files in the
235# order supplied by the user; otherwise parse default files ChangeLog and 246# order supplied by the user; otherwise parse default files ChangeLog and
236# ChangeLog.1+ according to $reverse. 247# ChangeLog.NNN according to $reverse.
237unless (@ARGV > 0) { 248unless (@ARGV > 0) {
238 @ARGV = ("ChangeLog"); 249 @ARGV = ("ChangeLog");
239 250