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
13Added-in: 7.73.0
14---
15
16# NAME
17
18curl_easy_option_by_id - find an easy setopt option by id
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25const struct curl_easyoption *curl_easy_option_by_id(CURLoption id);
26~~~
27
28# DESCRIPTION
29
30Given a *CURLoption* **id**, this function returns a pointer to the
31*curl_easyoption* struct, holding information about the
32curl_easy_setopt(3) option using that id. The option id is the CURLOPT_
33prefix ones provided in the standard curl/curl.h header file. This function
34returns the non-alias version of the cases where there is an alias function as
35well.
36
37If libcurl has no option with the given id, this function returns NULL.
38
39# %PROTOCOLS%
40
41# EXAMPLE
42
43~~~c
44int main(void)
45{
46  const struct curl_easyoption *opt = curl_easy_option_by_id(CURLOPT_URL);
47  if(opt) {
48    printf("This option wants type %x\n", opt->type);
49  }
50}
51~~~
52
53# %AVAILABILITY%
54
55# RETURN VALUE
56
57A pointer to the *curl_easyoption* struct for the option or NULL.
58