#!/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#2627use strict;28use warnings;2930my $sort = 0;3132# we may get the dir root pointed out33my $root = shift @ARGV;34while(defined $root) {3536if($root =~ /--heading=(.*)/) {37print "$1\n";38$root = shift @ARGV;39next;40}41elsif($root =~ /--sort/) {42$sort = 1;43$root = shift @ARGV;44next;45}4647last;48}4950if(!defined $root) {51$root = ".";52}5354$root = "$root/include/curl";55opendir(D, "$root") || die "Cannot open directory $root: $!\n";56my @dir = readdir(D);57closedir(D);5859my @incs;60foreach (sort(@dir)) {61if($_ =~ /\.h$/) {62push(@incs, "$root/$_");63}64}6566my $verbose=0;67my $summary=0;68my $misses=0;6970my @out;71foreach my $f (@incs) {72open H, "<$f" || die;73my $first = "";74while(<H>) {75s/CURL_DEPRECATED\(.*"\)//;76s/ */ /g;77if (/^(^CURL_EXTERN .*?)\(/) {78my $decl = $1;79$decl =~ s/\r$//;80$decl =~ /([a-z_]+)$/;81push(@out, "$1");82}83elsif (/^(^CURL_EXTERN .*)/) {84# handle two-line declarations85my $decl = $1;86$decl =~ s/\r$//;87$first = $decl;88}89elsif($first) {90if (/^ *(.*)\(/) {91my $decl = $1;92$decl =~ s/\r$//;93$first .= $decl;94$first =~ /([a-z_]+)$/;95push(@out, "$1");96}97$first = "";98}99}100close H;101}102103if($sort) {104@out = sort(@out);105}106107foreach (@out) {108print("$_\n");109}110111112