Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/tests/test1177.pl
2645 views
1
#!/usr/bin/env perl
2
#***************************************************************************
3
# _ _ ____ _
4
# Project ___| | | | _ \| |
5
# / __| | | | |_) | |
6
# | (__| |_| | _ <| |___
7
# \___|\___/|_| \_\_____|
8
#
9
# Copyright (C) Daniel Stenberg, <[email protected]>, 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
30
use strict;
31
use warnings;
32
33
my $manpage=$ARGV[0];
34
my $header=$ARGV[1];
35
my $source=$ARGV[2];
36
my %manversion;
37
my %headerversion;
38
my %manname;
39
my %sourcename;
40
my $error=0;
41
42
open(my $m, "<", "$manpage");
43
while(<$m>) {
44
if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) {
45
$manversion{$1}++;
46
}
47
if($_ =~ /^\.ip (.*)/i) {
48
$manname{$1}++;
49
}
50
}
51
close($m);
52
53
open(my $h, "<", "$header");
54
while(<$h>) {
55
if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
56
$headerversion{$1}++;
57
}
58
}
59
close($h);
60
61
open(my $s, "<", "$source");
62
while(<$s>) {
63
if($_ =~ /FEATURE\("([^"]*)"/) {
64
$sourcename{$1}++;
65
}
66
}
67
close($s);
68
$sourcename{'NTLM_WB'}++; # deprecated, fake its presence in code
69
70
for my $h (keys %headerversion) {
71
if(!$manversion{$h}) {
72
print STDERR "$manpage: missing $h\n";
73
$error++;
74
}
75
}
76
for my $h (keys %manversion) {
77
if(!$headerversion{$h}) {
78
print STDERR "$manpage: $h is not in the header!\n";
79
$error++;
80
}
81
}
82
for my $n (keys %sourcename) {
83
if(!$manname{$n}) {
84
print STDERR "$manpage: missing feature name $n\n";
85
$error++;
86
}
87
}
88
for my $n (keys %manname) {
89
if(!$sourcename{$n} && ($n ne "\"no name\"")) {
90
print STDERR "$manpage: $n is not in the source!\n";
91
$error++;
92
}
93
}
94
95
exit $error;
96
97