From: Daniel Stenberg Date: Thu, 22 Sep 2022 15:05:35 +0000 (+0200) Subject: manpage-syntax.pl: all libcurl option symbols should be \fI-tagged X-Git-Tag: curl-7_86_0~178 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a34610b92edba647e35bd4b9aaccd48c937bccbc;p=thirdparty%2Fcurl.git manpage-syntax.pl: all libcurl option symbols should be \fI-tagged ... as that makes them links to their corresponding man page. This script is used for test 1173. Closes #9574 --- diff --git a/tests/manpage-syntax.pl b/tests/manpage-syntax.pl index 49ab5b8e18..bf69370ca4 100644 --- a/tests/manpage-syntax.pl +++ b/tests/manpage-syntax.pl @@ -62,12 +62,29 @@ my @funcorder = ( my %shline; # section => line number my %symbol; + +# some CURLINFO_ symbols are not actual options for curl_easy_getinfo, +# mark them as "deprecated" to hide them from link-warnings +my %deprecated = ( + CURLINFO_TEXT => 1, + CURLINFO_HEADER_IN => 1, + CURLINFO_HEADER_OUT => 1, + CURLINFO_DATA_IN => 1, + CURLINFO_DATA_OUT => 1, + CURLINFO_SSL_DATA_IN => 1, + CURLINFO_SSL_DATA_OUT => 1, + ); sub allsymbols { open(F, "<$symbolsinversions") || die "$symbolsinversions: $|"; while() { - if($_ =~ /^([^ ]*)/) { - $symbol{$1}=$1; + if($_ =~ /^([^ ]*) +(.*)/) { + my ($name, $info) = ($1, $2); + $symbol{$name}=$name; + + if($info =~ /([0-9.]+) +([0-9.]+)/) { + $deprecated{$name}=$info; + } } } close(F); @@ -83,6 +100,7 @@ sub scanmanpage { my $shc = 0; my $optpage = 0; # option or function my @sh; + my $SH=""; open(M, "<$file") || die "no such file: $file"; if($file =~ /[\/\\](CURL|curl_)[^\/\\]*.3/) { @@ -131,6 +149,7 @@ sub scanmanpage { $n =~ s/\"(.*)\"\z/$1/; push @sh, $n; $shline{$n} = $line; + $SH = $n; } if($_ =~ /^\'/) { @@ -144,6 +163,19 @@ sub scanmanpage { $errors++; } } + if($optpage && $SH && ($SH !~ /^(SYNOPSIS|EXAMPLE|NAME|SEE ALSO)/i) && + ($_ =~ /(.*)(CURL(OPT_|MOPT_|INFO_)[A-Z0-9_]*)/)) { + # an option with its own man page, check that it is tagged + # for linking + my ($pref, $symbol) = ($1, $2); + if($deprecated{$symbol}) { + # let it be + } + elsif($pref !~ /\\fI\z/) { + print STDERR "$file:$line option $symbol missing \\fI tagging\n"; + $errors++; + } + } if($_ =~ /[ \t]+$/) { print STDERR "$file:$line trailing whitespace\n"; $errors++;