1#!/usr/bin/env perl 2#*************************************************************************** 3# _ _ ____ _ 4# Project ___| | | | _ \| | 5# / __| | | | |_) | | 6# | (__| |_| | _ <| |___ 7# \___|\___/|_| \_\_____| 8# 9# Copyright (C) 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 $source=$ARGV[2]; 36my %manversion; 37my %headerversion; 38my %manname; 39my %sourcename; 40my $error=0; 41 42open(my $m, "<", "$manpage"); 43while(<$m>) { 44 if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) { 45 $manversion{$1}++; 46 } 47 if($_ =~ /^\.ip (.*)/i) { 48 $manname{$1}++; 49 } 50} 51close($m); 52 53open(my $h, "<", "$header"); 54while(<$h>) { 55 if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) { 56 $headerversion{$1}++; 57 } 58} 59close($h); 60 61open(my $s, "<", "$source"); 62while(<$s>) { 63 if($_ =~ /FEATURE\("([^"]*)"/) { 64 $sourcename{$1}++; 65 } 66} 67close($s); 68 69for my $h (keys %headerversion) { 70 if(!$manversion{$h}) { 71 print STDERR "$manpage: missing $h\n"; 72 $error++; 73 } 74} 75for my $h (keys %manversion) { 76 if(!$headerversion{$h}) { 77 print STDERR "$manpage: $h is not in the header!\n"; 78 $error++; 79 } 80} 81for my $n (keys %sourcename) { 82 if(!$manname{$n}) { 83 print STDERR "$manpage: missing feature name $n\n"; 84 $error++; 85 } 86} 87for my $n (keys %manname) { 88 if(!$sourcename{$n} && ($n ne "\"no name\"")) { 89 print STDERR "$manpage: $n is not in the source!\n"; 90 $error++; 91 } 92} 93 94exit $error; 95