On Thu, 2002-03-28 at 12:28, Dan Jacobson wrote: > First I should mention the version. > $ checklink --version > W3C checklink Revision: 2.86 (c) 1999-2001 W3C > GET file://localhost/home/jidanni/--version fetched in 0.0s > > Error: 404 File `/home/jidanni/--version' does not exist > $ bin/checklink -version > $ > > OK, never mind that. FYI, there's no -version or --version option in that version of checklink. And due to a bit sloppy option parsing, running "checklink -version" is in that version equal to running "checklink --summary" or "checklink -s". I have a patch for this, attached. This and more patches for validator and checklink can be found at http://koti.welho.com/vskytta/patches/w3c-validator/ > Anyways, my dream is I want to analyze the internal links in my tree > of html files on my disk. > > $ checklink -r -l . index.html [...] I might get into hacking this one too shortly... -- Ville Skyttä ville.skytta@iki.fi Index: httpd/cgi-bin/checklink.pl =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/checklink.pl,v retrieving revision 2.89 diff -a -u -r2.89 checklink.pl --- httpd/cgi-bin/checklink.pl 2002/02/01 21:29:09 2.89 +++ httpd/cgi-bin/checklink.pl 2002/03/29 17:32:50 @@ -84,12 +84,12 @@ if ($#ARGV >= 0) { $_cl = 1; # Parse command line - my @uris = &parse_arguments(); + &parse_arguments(); if ($_user && (! $_password)) { &ask_password(); } my $uri; - foreach $uri (@uris) { + foreach $uri (@ARGV) { if (!$_summary) { printf("%s %s\n", $PROGRAM ,$VERSION) if (! $_html); } else { @@ -163,95 +163,44 @@ ################################ sub parse_arguments() { - my @uris; - my $uris = 0; - while (@ARGV) { - $_ = shift(@ARGV); - if ($uris) { - push(@uris, $_); - } elsif (m/^--$/) { - $uris = 1; - } elsif (m/^-[^-DupytdlL]/) { - if (m/q/) { - $_quiet = 1; - $_summary = 1; - } - if (m/s/) { - $_summary = 1; - } - if (m/b/) { - $_redirects = 0; - } - if (m/e/) { - $_dir_redirects = 0; - } - if (m/v/) { - $_verbose = 1; - } - if (m/i/) { - $_progress = 1; - } - if (m/h/) { - $_html = 1; - } - if (m/n/) { - $_accept_language = 0; - } - if (m/r/) { - if ($_depth == 0) { - $_depth = -1; - } - } - } elsif (m/^--help$/) { - &usage(); - } elsif (m/^--quiet$/) { - $_quiet = 1; - } elsif (m/^--summary$/) { - $_summary = 1; - } elsif (m/^--broken$/) { - $_redirects = 0; - } elsif (m/^--dir-redirects$/) { - $_dir_redirects = 0; - } elsif (m/^--verbose$/) { - $_verbose = 1; - } elsif (m/^--indicator$/) { - $_progress = 1; - } elsif (m/^--html$/) { - $_html = 1; - } elsif (m/^--noacclanguage$/) { - $_accept_language = 0; - } elsif (m/^--recursive$/) { - if ($_depth == 0) { - $_depth = -1; - } - } elsif (m/^-l|--location$/) { - $_base_location = shift(@ARGV); - } elsif (m/^-u|--user$/) { - $_user = shift(@ARGV); - } elsif (m/^-p|--password$/) { - $_password = shift(@ARGV); - } elsif (m/^-t|--timeout$/) { - $_timeout = shift(@ARGV); - } elsif (m/^-L|--languages$/) { - $_languages = shift(@ARGV); - } elsif (m/^-D|--depth$/) { - my $value = shift(@ARGV); - $_depth = $value unless($value == 0); - } elsif (m/^-d|--domain$/) { - $_trusted = shift(@ARGV); - } elsif (m/^-y|--proxy$/) { - $_http_proxy = shift(@ARGV); - } elsif (m/^--masquerade$/) { - $_masquerade = 1; - $_local_dir = shift(@ARGV); - $_remote_masqueraded_uri = shift(@ARGV); - } elsif (m/^--hide-same-realm$/) { - $_hide_same_realm = 1; - } else { - push(@uris, $_); - } + + use Getopt::Long 2.17 qw(GetOptions); + Getopt::Long::Configure('no_ignore_case'); + my @masq = (); + + GetOptions('help' => \&usage, + 'q|quiet' => sub { $_quiet = 1; $_summary = 1; }, + 's|summary' => \$_summary, + 'b|broken' => sub { $_redirects = 0; }, + 'e|dir-redirects' => sub { $_dir_redirects = 0; }, + 'v|verbose' => \$_verbose, + 'i|indicator' => \$_progress, + 'h|html' => \$_html, + 'n|noacclanguage' => sub { $_accept_language = 0; }, + 'r|recursive' => sub { $_depth = -1 if $_depth == 0; }, + 'l|location=s' => \$_base_location, + 'u|user=s' => \$_user, + 'p|password=s' => \$_password, + 't|timeout=i' => \$_timeout, + 'L|languages=s' => \$_languages, + 'D|depth=i' => sub { $_depth = $_[1] unless $_[1] == 0; }, + 'd|domain=s' => \$_trusted, + 'y|proxy=s' => \$_http_proxy, + 'masquerade' => \@masq, + 'hide-same-realm' => \$_hide_same_realm, + 'V|version' => \&version, + ); + + if (@masq) { + $_masquerade = 1; + $_local_dir = shift(@masq); + $_remote_masqueraded_uri = shift(@masq); } - return(@uris); +} + +sub version() { + print STDERR "$PROGRAM $VERSION\n"; + exit(0); } sub usage() { @@ -278,7 +227,7 @@ -i/--indicator Show progress while parsing. -u/--user username Specify a username for authentication. -p/--password password Specify a password. - --hide-same-real Hide 401's that are in the same realm as the + --hide-same-realm Hide 401's that are in the same realm as the document checked. -t/--timeout value Timeout for the HTTP requests. -d/--domain domain Regular expression describing the domain to @@ -290,6 +239,7 @@ -y/--proxy proxy Specify an HTTP proxy server. -h/--html HTML output. --help Show this message. + -V/--version Output version information. Documentation at: http://www.w3.org/2000/07/checklink Please send bug reports and comments to the www-validator mailing list:Received on Friday, 29 March 2002 13:09:07 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 1 October 2009 14:48:44 GMT