Annotation of embedaddon/curl/tests/manpage-syntax.pl, revision 1.1

1.1     ! misho       1: #!/usr/bin/env perl
        !             2: #***************************************************************************
        !             3: #                                  _   _ ____  _
        !             4: #  Project                     ___| | | |  _ \| |
        !             5: #                             / __| | | | |_) | |
        !             6: #                            | (__| |_| |  _ <| |___
        !             7: #                             \___|\___/|_| \_\_____|
        !             8: #
        !             9: # Copyright (C) 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
        !            10: #
        !            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.
        !            14: #
        !            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.
        !            18: #
        !            19: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            20: # KIND, either express or implied.
        !            21: #
        !            22: ###########################################################################
        !            23: #
        !            24: # Scan man page(s) and detect some simple and yet common formatting mistakes.
        !            25: #
        !            26: # Output all deviances to stderr.
        !            27: 
        !            28: use strict;
        !            29: use warnings;
        !            30: 
        !            31: # we may get the dir roots pointed out
        !            32: my @manpages=@ARGV;
        !            33: my $errors = 0;
        !            34: 
        !            35: sub scanmanpage {
        !            36:     my ($file) = @_;
        !            37: 
        !            38:     print "Check $file\n";
        !            39:     open(M, "<$file") || die "no such file: $file";
        !            40:     my $line = 1;
        !            41:     while(<M>) {
        !            42:         if($_ =~ /^\'/) {
        !            43:             print STDERR "$file:$line line starts with single quote!\n";
        !            44:             $errors++;
        !            45:         }
        !            46:         if($_ =~ /\\f([BI])(.*)/) {
        !            47:             my ($format, $rest) = ($1, $2);
        !            48:             if($rest !~ /\\fP/) {
        !            49:                 print STDERR "$file:$line missing \\f${format} terminator!\n";
        !            50:                 $errors++;
        !            51:             }
        !            52:         }
        !            53:         $line++;
        !            54:     }
        !            55:     close(M);
        !            56: }
        !            57: 
        !            58: 
        !            59: for my $m (@manpages) {
        !            60:     scanmanpage($m);
        !            61: }
        !            62: 
        !            63: exit $errors;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>