Files
MaxScale/system-test/maxtest/include/maxtest/envv.hh
Esa Korhonen 08f5174915 MXS-2900 Rename maxscale-system-test directory to system-test
A link with the old directory name is provided.
2020-07-28 15:24:27 +03:00

37 lines
1.3 KiB
C++

#pragma once
#include <string>
/**
* Read enviroment variable value. If variable is not set, set it to the given default value and return the
* written value.
*
* @param name Name of the variable
* @param format Default value format string
* @return Enviromental variable value
*/
char * readenv(const char* name, const char* format, ...) __attribute__ ((format (printf, 2, 3)));
std::string envvar_get_set(const char* name, const char* format, ...)
__attribute__ ((format (printf, 2, 3)));;
/**
* @brief readenv_int Read integer value of enviromental variable, if empty - set dafault
* @param name Name of the variable
* @param def Default value
* @return Enviromental variable value converted to int
*/
int readenv_int(const char * name, int def);
/**
* @brief readenv_int Read boolean value of enviromental variable, if empty - set dafault
* Values 'yes', 'y', 'true' (case independedant) are interpreted as TRUE, everything else - as FALSE
* @param name Name of the variable
* @param def Default value
* @return Enviromental variable value converted to bool
*/
bool readenv_bool(const char * name, bool def);
std::string string_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
std::string string_printf(const char *format, va_list args);