]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib/optiontable.pl: adapt to CURLOPTDEPRECATED()
authorDaniel Stenberg <daniel@haxx.se>
Mon, 28 Nov 2022 15:32:43 +0000 (16:32 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 29 Nov 2022 13:43:42 +0000 (14:43 +0100)
Follow-up from 6967571bf20624bc

Reported-by: Gisle Vanem
Fixes #9992
Closes #9993

lib/optiontable.pl

index 78ce580121f0e421fbb300d418304a1390d69e39..588c0b4d99a852b0ac13b1abc1b6533868ae4a88 100644 (file)
@@ -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*)/) {