link-checker commit: Improve command line mode usability: -h is now an alias for --help, -H for

changeset:   22:b63aba9a617d
user:        ville
date:        Sat Mar 27 19:09:41 2004 +0000
files:       ChangeLog bin/checklink bin/checklink.pod docs/checklink.html
description:
Improve command line mode usability: -h is now an alias for --help, -H for
--html, and the usage message is displayed if no URIs to check are given.
Also tune STDERR/STDOUT usage a bit.


diff -r 106bd24eb7bf -r b63aba9a617d ChangeLog
--- a/ChangeLog	Sat Mar 27 15:41:50 2004 +0000
+++ b/ChangeLog	Sat Mar 27 19:09:41 2004 +0000
@@ -1,6 +1,10 @@
 2004-03-27  Ville Skyttä  <ville.skytta@iki.fi>
 
 	* Appease Perl 5.6.1's taint mode.
+
+	* Improve command line mode usability: -h is now an alias for
+	--help, -H for --html, and the usage message is displayed if no
+	URIs to check are given.
 
 2004-03-23  Ville Skyttä  <ville.skytta@iki.fi>
 
diff -r 106bd24eb7bf -r b63aba9a617d bin/checklink
--- a/bin/checklink	Sat Mar 27 15:41:50 2004 +0000
+++ b/bin/checklink	Sat Mar 27 19:09:41 2004 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2004 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 3.14 2004-03-27 09:55:37 ville Exp $
+# $Id: checklink,v 3.15 2004-03-27 19:09:41 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -92,7 +92,7 @@
   $PROGRAM       = 'W3C checklink';
   ($AGENT        = $PROGRAM) =~ s/\s+/-/g;
   $VERSION       = '3.9.1';
-  ($CVS_VERSION) = q$Revision: 3.14 $ =~ /(\d+[\d\.]*\.\d+)/;
+  ($CVS_VERSION) = q$Revision: 3.15 $ =~ /(\d+[\d\.]*\.\d+)/;
   $REVISION      = sprintf('version %s [%s] (c) 1999-2004 W3C',
                            $VERSION, $CVS_VERSION);
 
@@ -206,6 +206,8 @@
 
   # Parse command line
   &parse_arguments();
+  &usage(1) unless @ARGV;
+
   &ask_password() if ($Opts{User} && !$Opts{Password});
 
   my $first = 1;
@@ -350,7 +352,7 @@
   Getopt::Long::Configure('bundling', 'no_ignore_case');
   my $masq = '';
 
-  GetOptions('help|?'          => sub { usage(0) },
+  GetOptions('help|h|?'        => sub { usage(0) },
              'q|quiet'         => sub { $Opts{Quiet} = 1;
                                         $Opts{Summary_Only} = 1;
                                       },
@@ -361,7 +363,7 @@
              'e|dir-redirects' => sub { $Opts{Dir_Redirects} = 0; },
              'v|verbose'       => \$Opts{Verbose},
              'i|indicator'     => \$Opts{Progress},
-             'h|html'          => \$Opts{HTML},
+             'H|html'          => \$Opts{HTML},
              'n|noacclanguage' => sub { $Opts{Accept_Language} = 0; },
              'r|recursive'     => sub { $Opts{Depth} = -1
                                           if $Opts{Depth} == 0; },
@@ -396,7 +398,7 @@
 
 sub version ()
 {
-  print STDERR "$PROGRAM $REVISION\n";
+  print "$PROGRAM $REVISION\n";
   exit(0);
 }
 
@@ -409,7 +411,8 @@
   my $langs = defined($Opts{Languages}) ? " (default: $Opts{Languages})" : '';
   my $trust = defined($Opts{Trusted})   ? " (default: $Opts{Trusted})"   : '';
 
-  print STDERR "$msg$PROGRAM $REVISION
+  select(STDERR) if $exitval;
+  print "$msg$PROGRAM $REVISION
 
 Usage: checklink <options> <uris>
 Options:
@@ -440,8 +443,8 @@
   --masquerade \"base1 base2\"  Masquerade base URI base1 as base2.  See manual
                               page for more information.
   -y/--proxy proxy            Specify an HTTP proxy server.
-  -h/--html                   HTML output.
-  -?/--help                   Show this message.
+  -H/--html                   HTML output.
+  -?/-h/--help                Show this message.
   -V/--version                Output version information.
 
 See \"perldoc Net::FTP\" for information about various environment variables
diff -r 106bd24eb7bf -r b63aba9a617d bin/checklink.pod
--- a/bin/checklink.pod	Sat Mar 27 15:41:50 2004 +0000
+++ b/bin/checklink.pod	Sat Mar 27 19:09:41 2004 +0000
@@ -1,4 +1,4 @@
-$Id: checklink.pod,v 1.3 2004-03-23 21:38:08 ville Exp $
+$Id: checklink.pod,v 1.4 2004-03-27 19:09:41 ville Exp $
 
 =head1 NAME
 
@@ -27,7 +27,7 @@
 
 =over 5
 
-=item B<-?, --help>
+=item B<-?, -h, --help>
 
 Show summary of options.
 
@@ -120,7 +120,7 @@
 
 Specify an HTTP proxy server.
 
-=item B<-h, --html>
+=item B<-H, --html>
 
 HTML output.
 
diff -r 106bd24eb7bf -r b63aba9a617d docs/checklink.html
--- a/docs/checklink.html	Sat Mar 27 15:41:50 2004 +0000
+++ b/docs/checklink.html	Sat Mar 27 19:09:41 2004 +0000
@@ -6,7 +6,7 @@
     <title>W3C Link Checker Documentation</title>
     <link rev="made" href="mailto:www-validator@w3.org" />
     <style type="text/css" media="all">@import "checklink.css";</style>
-    <meta name="revision" content="$Id: checklink.html,v 1.8 2004-03-27 15:41:50 ville Exp $" />
+    <meta name="revision" content="$Id: checklink.html,v 1.9 2004-03-27 19:09:41 ville Exp $" />
   </head>
 
   <body>
@@ -154,8 +154,7 @@
     </ol>
 
     <p>
-      Calling <kbd>checklink</kbd> without any arguments runs the
-      CGI version, and running <kbd>checklink --help</kbd> shows how to
+      Running <kbd>checklink --help</kbd> shows how to
       use the command line version.  The distribution package also includes
       more extensive <abbr title="Plain Old Documentation">POD</abbr>
       documentation, use
@@ -207,7 +206,7 @@
         alt="Valid XHTML 1.0!" /></a>
       <a title="Send Feedback for the W3C Link Checker"
         href="http://validator.w3.org/feedback.html">The W3C Validator Team</a><br />
-      $Date: 2004-03-27 15:41:50 $
+      $Date: 2004-03-27 19:09:41 $
     </address>
     <p class="copyright">
       <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &copy; 1994-2004

Received on Thursday, 5 August 2010 14:47:07 UTC