diff options
-rw-r--r-- | lib/optiontable.pl | 80 |
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*)/) { |