]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | # Civetweb API Reference |
2 | ||
3 | ### `mg_get_option( ctx, name );` | |
4 | ||
5 | ### Parameters | |
6 | ||
7 | | Parameter | Type | Description | | |
8 | | :--- | :--- | :--- | | |
9 | |**`ctx`**|`const struct mg_context *`| A pointer to the webserver context | | |
10 | |**`name`**|`const char *`| The name of the option to query | | |
11 | ||
12 | ### Return Value | |
13 | ||
14 | | Type | Description | | |
15 | | :--- | :--- | | |
16 | |`const char *`| A pointer to the option value in text, or NULL if an error occurred | | |
17 | ||
18 | ### Description | |
19 | ||
20 | When starting the CivetWeb webserver, options are provided to set the wanted behaviour of the server. The options which were used during startup can be queried through the `mg_get_option()` function. Options are read-only and cannot be changed while the webserver is running. The function returns a pointer to a text string containing the value of the queried option, or NULL if an error occurred. It is guaranteed however that if a valid option name is provided as a parameter to this function, that a pointer to a string is returned and not NULL. In case an option was empty or NULL during initialisation, `mg_get_option()` will return a pointer to an empty string. | |
21 | ||
22 | ### See Also | |
23 | ||
24 | * [`mg_start();`](mg_start.md) |