File: mg_get_option.md

package info (click to toggle)
civetweb 1.16%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,576 kB
  • sloc: ansic: 32,463; cpp: 1,374; sh: 480; javascript: 204; makefile: 119; php: 11; perl: 6; python: 3
file content (24 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Civetweb API Reference

### `mg_get_option( ctx, name );`

### Parameters

| Parameter | Type | Description |
| :--- | :--- | :--- |
|**`ctx`**|`const struct mg_context *`| A pointer to the webserver context |
|**`name`**|`const char *`| The name of the option to query |

### Return Value

| Type | Description |
| :--- | :--- |
|`const char *`| A pointer to the option value in text, or NULL if an error occurred |

### Description

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.

### See Also

* [`mg_start();`](mg_start.md)