#!/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###########################################################################2425use strict;26use warnings;2728my $sort = 0;2930# we may get the dir root pointed out31my $root = shift @ARGV;32while(defined $root) {3334if($root =~ /--heading=(.*)/) {35print "$1\n";36$root = shift @ARGV;37next;38}39elsif($root =~ /--sort/) {40$sort = 1;41$root = shift @ARGV;42next;43}4445last;46}4748if(!defined $root) {49$root = ".";50}5152$root = "$root/include/curl";53opendir(D, "$root") || die "Cannot open directory $root: $!\n";54my @dir = readdir(D);55closedir(D);5657my @incs;58foreach (sort(@dir)) {59if($_ =~ /\.h$/) {60push(@incs, "$root/$_");61}62}6364my $verbose=0;65my $summary=0;66my $misses=0;6768my @out;69foreach my $f (@incs) {70open H, "<$f" || die;71my $first = "";72while(<H>) {73s/CURL_DEPRECATED\(.*"\)//;74s/ */ /g;75if(/^(^CURL_EXTERN .*?)\(/) {76my $decl = $1;77$decl =~ s/\r$//;78$decl =~ /([a-z_]+)$/;79push(@out, "$1");80}81elsif(/^(^CURL_EXTERN .*)/) {82# handle two-line declarations83my $decl = $1;84$decl =~ s/\r$//;85$first = $decl;86}87elsif($first) {88if(/^ *(.*)\(/) {89my $decl = $1;90$decl =~ s/\r$//;91$first .= $decl;92$first =~ /([a-z_]+)$/;93push(@out, "$1");94}95$first = "";96}97}98close H;99}100101if($sort) {102@out = sort(@out);103}104105foreach (@out) {106print("$_\n");107}108109110