1 /***************************************************************************
3 * Project ___| | | | _ | |
5 * | (__| |_| | _ <| |___
8 * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
23 #include "curl_setup.h"
25 #include "easyoptions.h"
27 #ifndef CURL_DISABLE_GETOPTIONS
29 /* Lookups easy options at runtime */
30 static struct curl_easyoption *lookup(const char *name, CURLoption id)
32 DEBUGASSERT(name || id);
33 DEBUGASSERT(!Curl_easyopts_check());
35 struct curl_easyoption *o = &Curl_easyopts[0];
38 if(strcasecompare(o->name, name))
42 if((o->id == id) && !(o->flags & CURLOT_FLAG_ALIAS))
43 /* don't match alias options */
52 const struct curl_easyoption *curl_easy_option_by_name(const char *name)
54 /* when name is used, the id argument is ignored */
55 return lookup(name, CURLOPT_LASTENTRY);
58 const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
60 return lookup(NULL, id);
63 /* Iterates over available options */
64 const struct curl_easyoption *
65 curl_easy_option_next(const struct curl_easyoption *prev)
67 if(prev && prev->name) {
73 return &Curl_easyopts[0];
78 const struct curl_easyoption *curl_easy_option_by_name(const char *name)
84 const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
90 const struct curl_easyoption *
91 curl_easy_option_next(const struct curl_easyoption *prev)