2022-08-19 13:59:30 +00:00
|
|
|
#ifndef UTIL_ENV_H
|
|
|
|
#define UTIL_ENV_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2022-12-06 10:42:03 +00:00
|
|
|
/**
|
|
|
|
* Parse a bool from an environment variable.
|
|
|
|
*
|
|
|
|
* On success, the parsed value is returned. On error, false is returned.
|
|
|
|
*/
|
2022-08-19 13:59:30 +00:00
|
|
|
bool env_parse_bool(const char *option);
|
|
|
|
|
2022-12-06 10:42:03 +00: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 10:43:26 +00:00
|
|
|
size_t env_parse_switch(const char *option, const char **switches);
|
2022-08-19 13:59:30 +00:00
|
|
|
|
|
|
|
#endif
|