1 | #!/usr/bin/env perl
|
---|
2 |
|
---|
3 | print <<HEAD
|
---|
4 | /***************************************************************************
|
---|
5 | * _ _ ____ _
|
---|
6 | * Project ___| | | | _ \\| |
|
---|
7 | * / __| | | | |_) | |
|
---|
8 | * | (__| |_| | _ <| |___
|
---|
9 | * \\___|\\___/|_| \\_\\_____|
|
---|
10 | *
|
---|
11 | * Copyright (C) Daniel Stenberg, <daniel\@haxx.se>, et al.
|
---|
12 | *
|
---|
13 | * This software is licensed as described in the file COPYING, which
|
---|
14 | * you should have received as part of this distribution. The terms
|
---|
15 | * are also available at https://curl.se/docs/copyright.html.
|
---|
16 | *
|
---|
17 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
---|
18 | * copies of the Software, and permit persons to whom the Software is
|
---|
19 | * furnished to do so, under the terms of the COPYING file.
|
---|
20 | *
|
---|
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
---|
22 | * KIND, either express or implied.
|
---|
23 | *
|
---|
24 | * SPDX-License-Identifier: curl
|
---|
25 | *
|
---|
26 | ***************************************************************************/
|
---|
27 |
|
---|
28 | /* This source code is generated by optiontable.pl - DO NOT EDIT BY HAND */
|
---|
29 |
|
---|
30 | #include "curl_setup.h"
|
---|
31 | #include "easyoptions.h"
|
---|
32 |
|
---|
33 | /* all easy setopt options listed in alphabetical order */
|
---|
34 | struct curl_easyoption Curl_easyopts[] = {
|
---|
35 | HEAD
|
---|
36 | ;
|
---|
37 |
|
---|
38 | my $lastnum=0;
|
---|
39 |
|
---|
40 | sub add {
|
---|
41 | my($opt, $type, $num)=@_;
|
---|
42 | my $name;
|
---|
43 | # remove all spaces from the type
|
---|
44 | $type =~ s/ //g;
|
---|
45 | my $ext = $type;
|
---|
46 |
|
---|
47 | if($opt =~ /OBSOLETE/) {
|
---|
48 | # skip obsolete options
|
---|
49 | next;
|
---|
50 | }
|
---|
51 |
|
---|
52 | if($opt =~ /^CURLOPT_(.*)/) {
|
---|
53 | $name=$1;
|
---|
54 | }
|
---|
55 | $ext =~ s/CURLOPTTYPE_//;
|
---|
56 | $ext =~ s/CBPOINT/CBPTR/;
|
---|
57 | $ext =~ s/POINT\z//;
|
---|
58 | $type = "CURLOT_$ext";
|
---|
59 |
|
---|
60 | $opt{$name} = $opt;
|
---|
61 | $type{$name} = $type;
|
---|
62 | push @names, $name;
|
---|
63 | if($num < $lastnum) {
|
---|
64 | print STDERR "ERROR: $opt has bad number: $num < $lastnum\n";
|
---|
65 | exit 2;
|
---|
66 | }
|
---|
67 | else {
|
---|
68 | $lastnum = $num;
|
---|
69 | }
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | my $fl;
|
---|
74 | while(<STDIN>) {
|
---|
75 | my $l = $_;
|
---|
76 | if($fl) {
|
---|
77 | # continued deprecation
|
---|
78 | if($l =~ /(.*)\),/) {
|
---|
79 | $fl .= $1;
|
---|
80 |
|
---|
81 | # the end
|
---|
82 | my @p=split(/, */, $fl);
|
---|
83 | add($p[0], $p[1], $p[2]);
|
---|
84 | undef $fl;
|
---|
85 | }
|
---|
86 | else {
|
---|
87 | # another line to append
|
---|
88 | chomp $l;
|
---|
89 | $fl .= $l;
|
---|
90 | }
|
---|
91 | }
|
---|
92 |
|
---|
93 | if(/^ *CURLOPTDEPRECATED\((.*)/) {
|
---|
94 | $fl = $1;
|
---|
95 | chomp $fl;
|
---|
96 | }
|
---|
97 |
|
---|
98 | if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
|
---|
99 | my($opt, $type, $num)=($1,$2,$3);
|
---|
100 | add($opt, $type, $num);
|
---|
101 | }
|
---|
102 |
|
---|
103 | # alias for an older option
|
---|
104 | # old = new
|
---|
105 | if(/^#define (CURLOPT_[^ ]*) *(CURLOPT_\S*)/) {
|
---|
106 | my ($o, $n)=($1, $2);
|
---|
107 | # skip obsolete ones
|
---|
108 | if(($n !~ /OBSOLETE/) && ($o !~ /OBSOLETE/)) {
|
---|
109 | $o =~ s/^CURLOPT_//;
|
---|
110 | $n =~ s/^CURLOPT_//;
|
---|
111 | $alias{$o} = $n;
|
---|
112 | push @names, $o,
|
---|
113 | }
|
---|
114 | }
|
---|
115 | }
|
---|
116 |
|
---|
117 |
|
---|
118 | for my $name (sort @names) {
|
---|
119 | my $oname = $name;
|
---|
120 | my $a = $alias{$name};
|
---|
121 | my $flag = "0";
|
---|
122 | if($a) {
|
---|
123 | $name = $alias{$name};
|
---|
124 | $flag = "CURLOT_FLAG_ALIAS";
|
---|
125 | }
|
---|
126 | $o = sprintf(" {\"%s\", %s, %s, %s},\n",
|
---|
127 | $oname, $opt{$name}, $type{$name}, $flag);
|
---|
128 | if(length($o) < 80) {
|
---|
129 | print $o;
|
---|
130 | }
|
---|
131 | else {
|
---|
132 | printf(" {\"%s\", %s,\n %s, %s},\n",
|
---|
133 | $oname, $opt{$name}, $type{$name}, $flag);
|
---|
134 | }
|
---|
135 | }
|
---|
136 |
|
---|
137 | print <<FOOT
|
---|
138 | {NULL, CURLOPT_LASTENTRY, CURLOT_LONG, 0} /* end of table */
|
---|
139 | };
|
---|
140 |
|
---|
141 | #ifdef DEBUGBUILD
|
---|
142 | /*
|
---|
143 | * Curl_easyopts_check() is a debug-only function that returns non-zero
|
---|
144 | * if this source file is not in sync with the options listed in curl/curl.h
|
---|
145 | */
|
---|
146 | int Curl_easyopts_check(void)
|
---|
147 | {
|
---|
148 | return ((CURLOPT_LASTENTRY%10000) != ($lastnum + 1));
|
---|
149 | }
|
---|
150 | #endif
|
---|
151 | FOOT
|
---|
152 | ;
|
---|