link-checker commit: Make it clearer in output if a link has been already checked.

changeset:   389:4407b1a4c6b8
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Tue Mar 22 20:46:42 2011 +0200
files:       bin/checklink
description:
Make it clearer in output if a link has been already checked.


diff -r 3794d1106ee0 -r 4407b1a4c6b8 bin/checklink
--- a/bin/checklink	Thu Mar 17 23:10:40 2011 +0200
+++ b/bin/checklink	Tue Mar 22 20:46:42 2011 +0200
@@ -1463,7 +1463,7 @@
     }
     else {
         $response = &get_uri($method, $uri, $referer);
-        &record_results($uri, $method, $response);
+        &record_results($uri, $method, $response, $referer);
         &record_redirects($redirects, $response);
     }
     if (!$response->is_success()) {
@@ -1704,9 +1704,10 @@
 # Record the results of an HTTP request #
 #########################################
 
-sub record_results (\$$$)
+sub record_results (\$$$$)
 {
-    my ($uri, $method, $response) = @_;
+    my ($uri, $method, $response, $referer) = @_;
+    $results{$uri}{referer}        = $referer;
     $results{$uri}{response}       = $response;
     $results{$uri}{method}         = $method;
     $results{$uri}{location}{code} = $response->code();
@@ -2179,11 +2180,15 @@
         $response = &get_uri($method, $uri, $referer);
 
         # Get the information back from get_uri()
-        &record_results($uri, $method, $response);
+        &record_results($uri, $method, $response, $referer);
 
         # Record the redirects
         &record_redirects($redirects, $response);
     }
+    elsif (!($Opts{Summary_Only} || (!$doc_count && $Opts{HTML}))) {
+        my $ref = $results{$uri}{referer};
+        &hprintf("Already checked%s\n", $ref ? ", referrer $ref" : ".");
+    }
 
     # We got the response of the HTTP request. Stop here if it was a HEAD.
     return if ($method eq 'HEAD');

Received on Tuesday, 22 March 2011 20:34:02 UTC