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
This commit is contained in:
Daniel Stenberg 2022-09-22 17:05:35 +02:00
parent a068818528
commit a34610b92e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -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(<F>) {
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++;