mirror of
https://github.com/curl/curl.git
synced 2024-12-21 06:50:10 +08:00
c386065878
It is hard to name the scripts sensibly. Lots of them are similarly named and the name did not tell which test that used them. The new approach is rather to name them based on the test number that runs them. Also helps us see which scripts are for individual tests rather than for general test infra. - badsymbols.pl -> test1167.pl - check-deprecated.pl -> test1222.pl - check-translatable-options.pl -> test1544.pl - disable-scan.pl -> test1165.pl - error-codes.pl -> test1175.pl - errorcodes.pl -> test1477.pl - extern-scan.pl -> test1135.pl - manpage-scan.pl -> test1139.pl - manpage-syntax.pl -> test1173.pl - markdown-uppercase.pl -> test1275.pl - mem-include-scan.pl -> test1132.pl - nroff-scan.pl -> test1140.pl - option-check.pl -> test1276.pl - options-scan.pl -> test971.pl - symbol-scan.pl -> test1119.pl - version-scan.pl -> test1177.pl Closes #12487
113 lines
3.1 KiB
Perl
Executable File
113 lines
3.1 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
#***************************************************************************
|
|
# _ _ ____ _
|
|
# Project ___| | | | _ \| |
|
|
# / __| | | | |_) | |
|
|
# | (__| |_| | _ <| |___
|
|
# \___|\___/|_| \_\_____|
|
|
#
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
#
|
|
# This software is licensed as described in the file COPYING, which
|
|
# you should have received as part of this distribution. The terms
|
|
# are also available at https://curl.se/docs/copyright.html.
|
|
#
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
#
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
# KIND, either express or implied.
|
|
#
|
|
# SPDX-License-Identifier: curl
|
|
#
|
|
###########################################################################
|
|
#
|
|
# scan nroff pages to find basic syntactic problems such as unbalanced \f
|
|
# codes or references to non-existing curl man pages.
|
|
|
|
my $docsroot = $ARGV[0];
|
|
|
|
if(!$docsroot || ($docsroot eq "-g")) {
|
|
print "Usage: nroff-scan.pl <docs root dir> [nroff files]\n";
|
|
exit;
|
|
}
|
|
|
|
|
|
shift @ARGV;
|
|
|
|
my @f = @ARGV;
|
|
|
|
my %manp;
|
|
|
|
sub manpresent {
|
|
my ($man) = @_;
|
|
if($manp{$man}) {
|
|
return 1;
|
|
}
|
|
elsif(-r "$docsroot/$man" ||
|
|
-r "$docsroot/libcurl/$man" ||
|
|
-r "$docsroot/libcurl/opts/$man") {
|
|
$manp{$man}=1;
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
sub file {
|
|
my ($f) = @_;
|
|
open(my $fh, "<", "$f") ||
|
|
die "no file";
|
|
my $line = 1;
|
|
while(<$fh>) {
|
|
chomp;
|
|
my $l = $_;
|
|
while($l =~ s/\\f(.)([^ ]*)\\f(.)//) {
|
|
my ($pre, $str, $post)=($1, $2, $3);
|
|
if($str =~ /^\\f[ib]/i) {
|
|
print "error: $f:$line: double-highlight\n";
|
|
$errors++;
|
|
}
|
|
if($post ne "P") {
|
|
print "error: $f:$line: missing \\fP after $str\n";
|
|
$errors++;
|
|
}
|
|
if($str =~ /((libcurl|curl)([^ ]*))\(3\)/i) {
|
|
my $man = "$1.3";
|
|
if(!manpresent($man)) {
|
|
print "error: $f:$line: referring to non-existing man page $man\n";
|
|
$errors++;
|
|
}
|
|
if($pre ne "I") {
|
|
print "error: $f:$line: use \\fI before $str\n";
|
|
$errors++;
|
|
}
|
|
}
|
|
}
|
|
if($l =~ /(curl([^ ]*)\(3\))/i) {
|
|
print "error: $f:$line: non-referencing $1\n";
|
|
$errors++;
|
|
}
|
|
if($l =~ /^\.BR (.*)/) {
|
|
my $i= $1;
|
|
while($i =~ s/((lib|)curl([^ ]*)) *\"\(3\)(,|) *\" *//i ) {
|
|
my $man = "$1.3";
|
|
if(!manpresent($man)) {
|
|
print "error: $f:$line: referring to non-existing man page $man\n";
|
|
$errors++;
|
|
}
|
|
}
|
|
}
|
|
$line++;
|
|
}
|
|
close($fh);
|
|
}
|
|
|
|
foreach my $f (@f) {
|
|
file($f);
|
|
}
|
|
|
|
print "OK\n" if(!$errors);
|
|
|
|
exit $errors?1:0;
|