opt-docs: make sure all man pages have examples

Extended manpage-syntax.pl (run by test 1173) to check that every man
page for a libcurl option has an EXAMPLE section that is more than two
lines. Then fixed all errors it found and added examples.

Reviewed-by: Daniel Gustafsson
Closes #7656
This commit is contained in:
Daniel Stenberg 2021-09-01 09:23:37 +02:00
parent c8210ef06d
commit 1731a77989
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
11 changed files with 237 additions and 16 deletions

View file

@ -34,11 +34,28 @@ my $errors = 0;
sub scanmanpage {
my ($file) = @_;
my $reqex = 0;
my $inex = 0;
my $exsize = 0;
print "Check $file\n";
open(M, "<$file") || die "no such file: $file";
if($file =~ /\/CURL[^\/]*.3/) {
# This is the man page for an libcurl option. It requires an example!
$reqex = 1;
}
my $line = 1;
while(<M>) {
if($_ =~ /^.SH EXAMPLE/) {
$inex = 1;
}
elsif($_ =~ /^.SH/) {
$inex = 0;
}
elsif($inex) {
$exsize++;
}
if($_ =~ /^\'/) {
print STDERR "$file:$line line starts with single quote!\n";
$errors++;
@ -57,6 +74,11 @@ sub scanmanpage {
$line++;
}
close(M);
if($reqex && ($exsize < 2)) {
print STDERR "$file:$line missing EXAMPLE section\n";
$errors++;
}
}