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