tgupdate: merge pcreposix-compat base into pcreposix-compat
[pcreposix-compat.git] / CheckMan
blob480d735481e0541493f6ed26ba594b37e3241dc3
1 #! /usr/bin/perl
3 # A script to scan PCRE's man pages to check for typos in the control
4 # sequences. I use only a small set of the available repertoire, so it is
5 # straightforward to check that nothing else has slipped in by mistake. This
6 # script should be called in the doc directory.
8 $yield = 0;
10 while (scalar(@ARGV) > 0)
12 $line = 0;
13 $file = shift @ARGV;
15 open (IN, $file) || die "Failed to open $file\n";
17 while (<IN>)
19 $line++;
20 if (/^\s*$/)
22 printf "Empty line $line of $file\n";
23 $yield = 1;
25 elsif (/^\./)
27 if (!/^\.\s*$|
28 ^\.B\s+\S|
29 ^\.TH\s\S|
30 ^\.SH\s\S|
31 ^\.SS\s\S|
32 ^\.TP(?:\s?\d+)?\s*$|
33 ^\.SM\s*$|
34 ^\.br\s*$|
35 ^\.rs\s*$|
36 ^\.sp\s*$|
37 ^\.nf\s*$|
38 ^\.fi\s*$|
39 ^\.P\s*$|
40 ^\.PP\s*$|
41 ^\.\\"(?:\ HREF)?\s*$|
42 ^\.\\"\sHTML\s<a\shref="[^"]+?">\s*$|
43 ^\.\\"\sHTML\s<a\sname="[^"]+?"><\/a>\s*$|
44 ^\.\\"\s<\/a>\s*$|
45 ^\.\\"\sJOINSH\s*$|
46 ^\.\\"\sJOIN\s*$/x
49 printf "Bad control line $line of $file\n";
50 $yield = 1;
53 else
55 if (/\\[^ef]|\\f[^IBP]/)
57 printf "Bad backslash in line $line of $file\n";
58 $yield = 1;
63 close(IN);
66 exit $yield;
67 # End