summaryrefslogtreecommitdiff
path: root/lib/optiontable.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-11-28 16:32:43 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-11-29 14:43:42 +0100
commitea557cfa27305bf783665685362553e215e8bf56 (patch)
tree58b639a9c9442e2ab6f83a96eb9dcc10d866e05a /lib/optiontable.pl
parentf83610c89d4ce4e50c586bb2d5ca4761d92dbc73 (diff)
downloadcurl-ea557cfa27305bf783665685362553e215e8bf56.tar.gz
lib/optiontable.pl: adapt to CURLOPTDEPRECATED()
Follow-up from 6967571bf20624bc Reported-by: Gisle Vanem Fixes #9992 Closes #9993
Diffstat (limited to 'lib/optiontable.pl')
-rw-r--r--lib/optiontable.pl80
1 files changed, 56 insertions, 24 deletions
diff --git a/lib/optiontable.pl b/lib/optiontable.pl
index 78ce58012..588c0b4d9 100644
--- a/lib/optiontable.pl
+++ b/lib/optiontable.pl
@@ -37,37 +37,69 @@ HEAD
my $lastnum=0;
-while(<STDIN>) {
- if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
- my($opt, $type, $num)=($1,$2,$3);
- my $name;
- my $ext = $type;
+sub add {
+ my($opt, $type, $num)=@_;
+ my $name;
+ # remove all spaces from the type
+ $type =~ s/ //g;
+ my $ext = $type;
- if($opt =~ /OBSOLETE/) {
- # skip obsolete options
- next;
- }
+ if($opt =~ /OBSOLETE/) {
+ # skip obsolete options
+ next;
+ }
- if($opt =~ /^CURLOPT_(.*)/) {
- $name=$1;
- }
- $ext =~ s/CURLOPTTYPE_//;
- $ext =~ s/CBPOINT/CBPTR/;
- $ext =~ s/POINT\z//;
- $type = "CURLOT_$ext";
-
- $opt{$name} = $opt;
- $type{$name} = $type;
- push @names, $name;
- if($num < $lastnum) {
- print STDERR "ERROR: $opt has bad number\n";
- exit 2;
+ if($opt =~ /^CURLOPT_(.*)/) {
+ $name=$1;
+ }
+ $ext =~ s/CURLOPTTYPE_//;
+ $ext =~ s/CBPOINT/CBPTR/;
+ $ext =~ s/POINT\z//;
+ $type = "CURLOT_$ext";
+
+ $opt{$name} = $opt;
+ $type{$name} = $type;
+ push @names, $name;
+ if($num < $lastnum) {
+ print STDERR "ERROR: $opt has bad number: $num < $lastnum\n";
+ exit 2;
+ }
+ else {
+ $lastnum = $num;
+ }
+}
+
+
+my $fl;
+while(<STDIN>) {
+ my $l = $_;
+ if($fl) {
+ # continued deprecation
+ if($l =~ /(.*)\),/) {
+ $fl .= $1;
+
+ # the end
+ my @p=split(/, */, $fl);
+ add($p[0], $p[1], $p[2]);
+ undef $fl;
}
else {
- $lastnum = $num;
+ # another line to append
+ chomp $l;
+ $fl .= $l;
}
}
+ if(/^ *CURLOPTDEPRECATED\((.*)/) {
+ $fl = $1;
+ chomp $fl;
+ }
+
+ if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
+ my($opt, $type, $num)=($1,$2,$3);
+ add($opt, $type, $num);
+ }
+
# alias for an older option
# old = new
if(/^#define (CURLOPT_[^ ]*) *(CURLOPT_\S*)/) {