1 /***************************************************************************
3 * Project ___| | | | _ | |
5 * | (__| |_| | _ <| |___
8 * Copyright (C) 1998 - 2022, 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.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 * SPDX-License-Identifier: curl
23 ***************************************************************************/
25 #include "curl_setup.h"
27 #include "easyoptions.h"
29 #ifndef CURL_DISABLE_GETOPTIONS
31 /* Lookups easy options at runtime */
32 static struct curl_easyoption *lookup(const char *name, CURLoption id)
34 DEBUGASSERT(name || id);
35 DEBUGASSERT(!Curl_easyopts_check());
37 struct curl_easyoption *o = &Curl_easyopts[0];
40 if(strcasecompare(o->name, name))
44 if((o->id == id) && !(o->flags & CURLOT_FLAG_ALIAS))
45 /* don't match alias options */
54 const struct curl_easyoption *curl_easy_option_by_name(const char *name)
56 /* when name is used, the id argument is ignored */
57 return lookup(name, CURLOPT_LASTENTRY);
60 const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
62 return lookup(NULL, id);
65 /* Iterates over available options */
66 const struct curl_easyoption *
67 curl_easy_option_next(const struct curl_easyoption *prev)
69 if(prev && prev->name) {
75 return &Curl_easyopts[0];
80 const struct curl_easyoption *curl_easy_option_by_name(const char *name)
86 const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
92 const struct curl_easyoption *
93 curl_easy_option_next(const struct curl_easyoption *prev)