remove sigio blocking
[bpt/emacs.git] / lib-src / grep-changelog
index 45bf841..ab8c5e3 100755 (executable)
@@ -1,24 +1,21 @@
 #! /usr/bin/perl
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-#               2005 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
-#
-# GNU Emacs is free software; you can redistribute it and/or modify
+
+# GNU Emacs is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
 # GNU Emacs is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-#
+
 # You should have received a copy of the GNU General Public License
-# along with GNU Emacs; see the file COPYING.  If not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 
 # Extract entries from ChangeLogs matching specified criteria.
@@ -36,22 +33,33 @@ use vars qw($author $regexp $exclude $from_date $to_date
             @entries);
 
 use Getopt::Long;
-my $result = GetOptions ("author=s" => \$author,
-                         "text=s"  => \$regexp,
-                         "exclude=s"  => \$exclude,
-                         "from-date=s" => \$from_date,
-                         "to-date=s" => \$to_date,
-                         "rcs-log" => \$rcs_log,
-                         "with-date" => \$with_date,
-                         "reverse!" => \$reverse,
-                         "version" => \$version,
-                         "help"    => \$help);
-
-# If date options are specified, check that they have the format
-# YYYY-MM-DD.
-
-$result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
-$result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+
+my $result;
+
+if (@ARGV == 0) {
+
+    # No arguments cannot possibly mean "show everything"!!
+    $result = 0;
+
+} else {
+
+    $result = GetOptions ("author=s" => \$author,
+                          "text=s"  => \$regexp,
+                          "exclude=s"  => \$exclude,
+                          "from-date=s" => \$from_date,
+                          "to-date=s" => \$to_date,
+                          "rcs-log" => \$rcs_log,
+                          "with-date" => \$with_date,
+                          "reverse!" => \$reverse,
+                          "version" => \$version,
+                          "help"    => \$help);
+
+    # If date options are specified, check that they have the format
+    # YYYY-MM-DD.
+
+    $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+    $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+}
 
 # Print usage information and exit when necessary.
 
@@ -77,7 +85,7 @@ Valid options are:
   --help                 Print this help
 
 If no CHANGELOG is specified scan the files "ChangeLog" and
-"ChangeLog.1+" in the current directory.  Old-style dates in ChangeLogs
+"ChangeLog.N+" in the current directory.  Old-style dates in ChangeLogs
 are not recognized.
 USAGE
     exit !$help;
@@ -86,7 +94,7 @@ USAGE
 # Print version info and exit if `--version' was specified.
 
 if ($version) {
-    print "0.2\n";
+    print "0.3\n";
     exit 0;
 }
 
@@ -233,7 +241,7 @@ sub parse_changelog {
 
 # 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.1+ according to $reverse.
+# ChangeLog.NNN according to $reverse.
 unless (@ARGV > 0) {
     @ARGV = ("ChangeLog");
 
@@ -254,5 +262,4 @@ while (defined (my $log = shift @ARGV)) {
 }
 
 
-# arch-tag: 9e4f6749-e053-4bb7-b3ad-11947318418e
 # grep-changelog ends here.