blob: b52459d0ac2db9fff8abcd1c8e642ea318b9fd09 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) 2010 - 2022, 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.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# SPDX-License-Identifier: curl
23#
24###########################################################################
25#
26# Verify that curl_version_info.3 documents all the CURL_VERSION_ bits
27# from the header.
28#
29
30use strict;
31use warnings;
32
33my $manpage=$ARGV[0];
34my $header=$ARGV[1];
35my %manversion;
36my %headerversion;
37my $error;
38
39open(M, "<$manpage");
40while(<M>) {
41 if($_ =~ /^.ip (CURL_VERSION_[A-Z0-9_]+)/i) {
42 $manversion{$1}++;
43 }
44}
45close(M);
46
47open(H, "<$header");
48while(<H>) {
49 if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
50 $headerversion{$1}++;
51 }
52}
53close(H);
54
55for my $h (keys %headerversion) {
56 if(!$manversion{$h}) {
57 print STDERR "$manpage: missing $h\n";
58 $error++;
59 }
60}
61for my $h (keys %manversion) {
62 if(!$headerversion{$h}) {
63 print STDERR "$manpage: $h is not in the header!\n";
64 $error++;
65 }
66}
67
68exit $error;