提交 32a775df 编写于 作者: J Joshua Lock 提交者: Dr. Matthias St. Pierre

Make check_example_location() in find-doc-nits generic

Change to check_section_location(), a generic function to ensure that
section SECTION appears before section BEFORE in the man pages.
Reviewed-by: NMatthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: NRichard Levitte <levitte@openssl.org>

(cherry picked from commit 95f92d57755a9bfc83135a585da69d497f7293d9)
Reviewed-by: NMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8736)
上级 a345fa37
#! /usr/bin/env perl #! /usr/bin/env perl
# Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved. # Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.
# #
# Licensed under the OpenSSL license (the "License"). You may not use # Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy # this file except in compliance with the License. You can obtain a copy
...@@ -137,16 +137,18 @@ sub name_synopsis() ...@@ -137,16 +137,18 @@ sub name_synopsis()
} }
} }
# Check if EXAMPLES is located after RETURN VALUES section. # Check if SECTION is located before BEFORE
sub check_example_location() sub check_section_location()
{ {
my $filename = shift; my $filename = shift;
my $contents = shift; my $contents = shift;
my $section = shift;
my $before = shift;
return unless $contents =~ /=head1 RETURN VALUES/ return unless $contents =~ /=head1 $section/
and $contents =~ /=head1 EXAMPLES/; and $contents =~ /=head1 $before/;
print "$filename: RETURN VAULES should be placed before EXAMPLES section\n" print "$filename: $section should be placed before $before section\n"
if $contents =~ /=head1 EXAMPLES.*=head1 RETURN VALUES/ms; if $contents =~ /=head1 $before.*=head1 $section/ms;
} }
sub check() sub check()
...@@ -162,7 +164,8 @@ sub check() ...@@ -162,7 +164,8 @@ sub check()
close POD; close POD;
} }
&check_example_location($filename, $contents) if $filename =~ m|man3/|; # Check if EXAMPLES is located after RETURN VALUES section.
&check_section_location($filename, $contents, "RETURN VALUES", "EXAMPLES") if $filename =~ m|man3/|;
my $id = "${filename}:1:"; my $id = "${filename}:1:";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册