diff --git a/bin/checklink b/bin/checklink index ac29b22..99eb653 100755 --- a/bin/checklink +++ b/bin/checklink @@ -887,7 +887,7 @@ sub parse_arguments () for my $i (0 .. $#{$Opts{Suppress_Broken}}) { ${$Opts{Suppress_Broken}}[$i] =~ s/ /:/; my $sb_arg = ${$Opts{Suppress_Broken}}[$i]; - if ($sb_arg !~ /^(-1|[0-9]+):./) { + if ($sb_arg !~ /^(-1|[0-9]+)(:.)?/) { &usage(1, "Bad suppress-broken argument, should be prefixed by a numeric response code: $sb_arg" ); @@ -951,9 +951,11 @@ Options: the first URI to the same child of the second URI. This option may be specified multiple times. --suppress-temp-redirects Suppress warnings about temporary redirects. - --suppress-broken CODE:URI Do not report a broken link with the given CODE. + --suppress-broken CODE(:URI) Do not report a broken link with the given CODE. CODE is HTTP response, or -1 for robots exclusion. - This option may be specified multiple times. + This option may be specified multiple times, and + can optionally be limited to a single pair of CODE / + URI. --suppress-fragment URI Do not report the given broken fragment URI. A fragment URI contains \"#\". This option may be specified multiple times. @@ -1376,9 +1378,9 @@ EOF # List the broken fragments while (my ($fragment, $lines) = each(%{$ulinks->{fragments}})) { - - my $fragment_ok = $results{$u}{fragments}{$fragment}; - + my $fragment_ok = $results{$u}{fragments}{$fragment} + # 100 matches what we get for ignored error codes + || $results{$u}{location}{code} == 100; if ($Opts{Verbose}) { my @line_nums = sort { $a <=> $b } keys(%$lines); &hprintf( @@ -1845,8 +1847,9 @@ sub record_results (\$$$$) # print STDERR "success? " . $results{$uri}{location}{success} . ": $uri\n"; if (!$results{$uri}{location}{success}) { my $code = $results{$uri}{location}{code}; - my $match = grep { $_ eq "$code:$uri" } @{$Opts{Suppress_Broken}}; - if ($match) { + my $matchCodeUri = grep { $_ eq "$code:$uri" } @{$Opts{Suppress_Broken}}; + my $matchCode = grep { $_ eq "$code" } @{$Opts{Suppress_Broken}}; + if ($matchCodeUri || $matchCode) { $results{$uri}{location}{success} = 1; $results{$uri}{location}{code} = 100; $results{$uri}{location}{display} = 100;