-if (@ARGV > 0) {
- # If files were specified on the command line, parse those files.
- while (defined(my $log = shift @ARGV)) {
- parse_changelog ($log);
- }
-} else {
- # Parse default files ChangeLog and ChangeLog.9...ChangeLog.1 in
- # that order.
- parse_changelog ("ChangeLog");
- for (my $i = 9; $i >= 1; --$i) {
- my $log = "ChangeLog.$i";
- parse_changelog ($log) if -f $log;
- }
+# If files were specified on the command line, parse those files in the
+# order supplied by the user; otherwise parse default files ChangeLog and
+# ChangeLog.9...ChangeLog.1 according to $reverse.
+unless (@ARGV > 0) {
+ @ARGV = ("ChangeLog", map {"ChangeLog.$_"} reverse 1..9);
+ @ARGV = reverse @ARGV if $reverse;
+}
+
+while (defined (my $log = shift @ARGV)) {
+ parse_changelog ($log) if -f $log;