Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/tests/test1135.pl
2066 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
#
27
28
use strict;
29
use warnings;
30
31
my $sort = 0;
32
33
# we may get the dir root pointed out
34
my $root = shift @ARGV;
35
while(defined $root) {
36
37
if($root =~ /--heading=(.*)/) {
38
print "$1\n";
39
$root = shift @ARGV;
40
next;
41
}
42
elsif($root =~ /--sort/) {
43
$sort = 1;
44
$root = shift @ARGV;
45
next;
46
}
47
48
last;
49
}
50
51
if(!defined $root) {
52
$root = ".";
53
}
54
55
$root = "$root/include/curl";
56
opendir(D, "$root") || die "Cannot open directory $root: $!\n";
57
my @dir = readdir(D);
58
closedir(D);
59
60
my @incs;
61
foreach (sort(@dir)) {
62
if($_ =~ /\.h$/) {
63
push(@incs, "$root/$_");
64
}
65
}
66
67
my $verbose=0;
68
my $summary=0;
69
my $misses=0;
70
71
my @out;
72
foreach my $f (@incs) {
73
open H, "<$f" || die;
74
my $first = "";
75
while(<H>) {
76
s/CURL_DEPRECATED\(.*"\)//;
77
s/ */ /g;
78
if (/^(^CURL_EXTERN .*?)\(/) {
79
my $decl = $1;
80
$decl =~ s/\r$//;
81
$decl =~ /([a-z_]+)$/;
82
push(@out, "$1");
83
}
84
elsif (/^(^CURL_EXTERN .*)/) {
85
# handle two-line declarations
86
my $decl = $1;
87
$decl =~ s/\r$//;
88
$first = $decl;
89
}
90
elsif($first) {
91
if (/^ *(.*)\(/) {
92
my $decl = $1;
93
$decl =~ s/\r$//;
94
$first .= $decl;
95
$first =~ /([a-z_]+)$/;
96
push(@out, "$1");
97
}
98
$first = "";
99
}
100
}
101
close H;
102
}
103
104
if($sort) {
105
@out = sort(@out);
106
}
107
108
foreach (@out) {
109
print("$_\n");
110
}
111
112