2022-08-19 15:59:30 +02:00
|
|
|
#ifndef UTIL_ENV_H
|
|
|
|
#define UTIL_ENV_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2022-12-06 11:42:03 +01:00
|
|
|
/**
|
|
|
|
* Parse a bool from an environment variable.
|
|
|
|
*
|
|
|
|
* On success, the parsed value is returned. On error, false is returned.
|
|
|
|
*/
|
2022-08-19 15:59:30 +02:00
|
|
|
bool env_parse_bool(const char *option);
|
|
|
|
|
2022-12-06 11:42:03 +01:00
|
|
|
/**
|
|
|
|
* Pick a choice from an environment variable.
|
|
|
|
*
|
|
|
|
* On success, the choice index is returned. On error, zero is returned.
|
|
|
|
*
|
|
|
|
* switches is a NULL-terminated array.
|
|
|
|
*/
|
2022-12-06 11:43:26 +01:00
|
|
|
size_t env_parse_switch(const char *option, const char **switches);
|
2022-08-19 15:59:30 +02:00
|
|
|
|
|
|
|
#endif
|