aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib-src/grep-changelog33
1 files changed, 19 insertions, 14 deletions
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
index 455d2cea5a8..d3f6b21af49 100755
--- a/lib-src/grep-changelog
+++ b/lib-src/grep-changelog
@@ -1,5 +1,5 @@
1#! /usr/bin/perl 1#! /usr/bin/perl
2# $Id: grep-changelog,v 1.5 2001/07/20 10:02:06 gerd Exp $ 2# $Id: grep-changelog,v 1.6 2001/07/20 10:04:17 gerd Exp $
3 3
4# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. 4# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
5# 5#
@@ -27,19 +27,23 @@
27# author lines leading spaces, and file names are removed. 27# author lines leading spaces, and file names are removed.
28 28
29require 5; 29require 5;
30use strict;
30 31
31# Parse command line options. 32# Parse command line options.
32 33
34use vars qw($author $regexp $exclude $from_date $to_date
35 $rcs_log $with_date $version $help);
36
33use Getopt::Long; 37use Getopt::Long;
34$result = GetOptions ("author=s" => \$author, 38my $result = GetOptions ("author=s" => \$author,
35 "text=s" => \$regexp, 39 "text=s" => \$regexp,
36 "exclude=s" => \$exclude, 40 "exclude=s" => \$exclude,
37 "from-date=s" => \$from_date, 41 "from-date=s" => \$from_date,
38 "to-date=s" => \$to_date, 42 "to-date=s" => \$to_date,
39 "rcs-log" => \$rcs_log, 43 "rcs-log" => \$rcs_log,
40 "with-date" => \$with_date, 44 "with-date" => \$with_date,
41 "version" => \$version, 45 "version" => \$version,
42 "help" => \$help); 46 "help" => \$help);
43 47
44# If date options are specified, check that they have the format 48# If date options are specified, check that they have the format
45# YYYY-MM-DD. 49# YYYY-MM-DD.
@@ -161,13 +165,14 @@ sub print_log ($$) {
161 165
162sub parse_changelog ($) { 166sub parse_changelog ($) {
163 my $log = shift; 167 my $log = shift;
164 my $entry; 168 my $entry = undef;
169 my $header = undef;
165 my $match; 170 my $match;
166 171
167 # Open the ChangeLog. 172 # Open the ChangeLog.
168 open (IN, "< $log") || die "Cannot open $log: $!"; 173 open (IN, "< $log") || die "Cannot open $log: $!";
169 174
170 while ($line = <IN>) { 175 while (defined(my $line = <IN>)) {
171 if ($line =~ /^\S/) { 176 if ($line =~ /^\S/) {
172 # Line is an author-line. Print previous entry if 177 # Line is an author-line. Print previous entry if
173 # it matches. 178 # it matches.
@@ -209,14 +214,14 @@ sub parse_changelog ($) {
209 214
210if (@ARGV > 0) { 215if (@ARGV > 0) {
211 # If files were specified on the command line, parse those files. 216 # If files were specified on the command line, parse those files.
212 while ($log = shift @ARGV) { 217 while (defined(my $log = shift @ARGV)) {
213 parse_changelog ($log); 218 parse_changelog ($log);
214 } 219 }
215} else { 220} else {
216 # Parse default files ChangeLog and ChangeLog.9...ChangeLog.1 in 221 # Parse default files ChangeLog and ChangeLog.9...ChangeLog.1 in
217 # that order. 222 # that order.
218 parse_changelog ("ChangeLog"); 223 parse_changelog ("ChangeLog");
219 for ($i = 9; $i >= 1; --$i) { 224 for (my $i = 9; $i >= 1; --$i) {
220 my $log = "ChangeLog.$i"; 225 my $log = "ChangeLog.$i";
221 parse_changelog ($log) if -f $log; 226 parse_changelog ($log) if -f $log;
222 } 227 }