VirtualBox

source: vbox/trunk/src/libs/curl-8.7.1/lib/easygetopt.c@ 106165

最後變更 在這個檔案從106165是 104083,由 vboxsync 提交於 8 月 前

curl-8.7.1: Applied and adjusted our curl changes to 8.4.0. bugref:10639

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.5 KB
 
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ | |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * ___|___/|_| ______|
7 *
8 * Copyright (C) Daniel Stenberg, <[email protected]>, et al.
9 *
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.
13 *
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.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24
25#include "curl_setup.h"
26#include "strcase.h"
27#include "easyoptions.h"
28
29#ifndef CURL_DISABLE_GETOPTIONS
30
31/* Lookups easy options at runtime */
32static struct curl_easyoption *lookup(const char *name, CURLoption id)
33{
34 DEBUGASSERT(name || id);
35 DEBUGASSERT(!Curl_easyopts_check());
36 if(name || id) {
37 struct curl_easyoption *o = &Curl_easyopts[0];
38 do {
39 if(name) {
40 if(strcasecompare(o->name, name))
41 return o;
42 }
43 else {
44 if((o->id == id) && !(o->flags & CURLOT_FLAG_ALIAS))
45 /* don't match alias options */
46 return o;
47 }
48 o++;
49 } while(o->name);
50 }
51 return NULL;
52}
53
54const struct curl_easyoption *curl_easy_option_by_name(const char *name)
55{
56 /* when name is used, the id argument is ignored */
57 return lookup(name, CURLOPT_LASTENTRY);
58}
59
60const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
61{
62 return lookup(NULL, id);
63}
64
65/* Iterates over available options */
66const struct curl_easyoption *
67curl_easy_option_next(const struct curl_easyoption *prev)
68{
69 if(prev && prev->name) {
70 prev++;
71 if(prev->name)
72 return prev;
73 }
74 else if(!prev)
75 return &Curl_easyopts[0];
76 return NULL;
77}
78
79#else
80const struct curl_easyoption *curl_easy_option_by_name(const char *name)
81{
82 (void)name;
83 return NULL;
84}
85
86const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
87{
88 (void)id;
89 return NULL;
90}
91
92const struct curl_easyoption *
93curl_easy_option_next(const struct curl_easyoption *prev)
94{
95 (void)prev;
96 return NULL;
97}
98#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette