2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at https://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 ###########################################################################
24 # scan nroff pages to find basic syntactic problems such as unbalanced \f
25 # codes or references to non-existing curl man pages.
27 my $docsroot = $ARGV[0];
29 if(!$docsroot || ($docsroot eq "-g")) {
30 print "Usage: nroff-scan.pl <docs root dir> [nroff files]\n";
46 elsif(-r "$docsroot/$man" ||
47 -r "$docsroot/libcurl/$man" ||
48 -r "$docsroot/libcurl/opts/$man") {
63 while($l =~ s/\\f(.)([^ ]*)\\f(.)//) {
64 my ($pre, $str, $post)=($1, $2, $3);
66 print STDERR "error: $f:$line: missing \\fP after $str\n";
69 if($str =~ /((libcurl|curl)([^ ]*))\(3\)/i) {
71 if(!manpresent($man)) {
72 print STDERR "error: $f:$line: refering to non-existing man page $man\n";
76 print STDERR "error: $f:$line: use \\fI before $str\n";
81 if($l =~ /(curl([^ ]*)\(3\))/i) {
82 print STDERR "error: $f:$line: non-referencing $1\n";
85 if($l =~ /^\.BR (.*)/) {
87 while($i =~ s/((lib|)curl([^ ]*)) *\"\(3\)(,|) *\" *//i ) {
89 if(!manpresent($man)) {
90 print STDERR "error: $f:$line: refering to non-existing man page $man\n";