1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_easy_option_by_name
5Section: 3
6Source: libcurl
7See-also:
8  - curl_easy_option_by_id (3)
9  - curl_easy_option_next (3)
10  - curl_easy_setopt (3)
11Protocol:
12  - All
13---
14
15# NAME
16
17curl_easy_option_by_name - find an easy setopt option by name
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24const struct curl_easyoption *curl_easy_option_by_name(const char *name);
25~~~
26
27# DESCRIPTION
28
29Given a **name**, this function returns a pointer to the
30*curl_easyoption* struct, holding information about the
31curl_easy_setopt(3) option using that name. The name should be specified
32without the "CURLOPT_" prefix and the name comparison is made case
33insensitive.
34
35If libcurl has no option with the given name, this function returns NULL.
36
37# EXAMPLE
38
39~~~c
40int main(void)
41{
42  const struct curl_easyoption *opt = curl_easy_option_by_name("URL");
43  if(opt) {
44    printf("This option wants CURLoption %x\n", (int)opt->id);
45  }
46}
47~~~
48
49# AVAILABILITY
50
51This function was added in libcurl 7.73.0
52
53# RETURN VALUE
54
55A pointer to the *curl_easyoption* struct for the option or NULL.
56