#!/usr/bin/env perl1#***************************************************************************2# _ _ ____ _3# Project ___| | | | _ \| |4# / __| | | | |_) | |5# | (__| |_| | _ <| |___6# \___|\___/|_| \_\_____|7#8# Copyright (C) Daniel Stenberg, <[email protected]>, et al.9#10# This software is licensed as described in the file COPYING, which11# you should have received as part of this distribution. The terms12# are also available at https://curl.se/docs/copyright.html.13#14# You may opt to use, copy, modify, merge, publish, distribute and/or sell15# copies of the Software, and permit persons to whom the Software is16# furnished to do so, under the terms of the COPYING file.17#18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY19# KIND, either express or implied.20#21# SPDX-License-Identifier: curl22#23###########################################################################24#25# Verify that curl_version_info.3 documents all the CURL_VERSION_ bits26# from the header.27#2829use strict;30use warnings;3132my $manpage=$ARGV[0];33my $header=$ARGV[1];34my $source=$ARGV[2];35my %manversion;36my %headerversion;37my %manname;38my %sourcename;39my $error=0;4041open(my $m, "<", "$manpage");42while(<$m>) {43if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) {44$manversion{$1}++;45}46if($_ =~ /^\.ip (.*)/i) {47$manname{$1}++;48}49}50close($m);5152open(my $h, "<", "$header");53while(<$h>) {54if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {55$headerversion{$1}++;56}57}58close($h);5960open(my $s, "<", "$source");61while(<$s>) {62if($_ =~ /FEATURE\("([^"]*)"/) {63$sourcename{$1}++;64}65}66close($s);67$sourcename{'NTLM_WB'}++; # deprecated, fake its presence in code6869for my $h (keys %headerversion) {70if(!$manversion{$h}) {71print STDERR "$manpage: missing $h\n";72$error++;73}74}75for my $h (keys %manversion) {76if(!$headerversion{$h}) {77print STDERR "$manpage: $h is not in the header!\n";78$error++;79}80}81for my $n (keys %sourcename) {82if(!$manname{$n}) {83print STDERR "$manpage: missing feature name $n\n";84$error++;85}86}87for my $n (keys %manname) {88if(!$sourcename{$n} && ($n ne "\"no name\"")) {89print STDERR "$manpage: $n is not in the source!\n";90$error++;91}92}9394exit $error;959697