diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..4b3bed7 --- /dev/null +++ b/src/util.h @@ -0,0 +1,20 @@ +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include <stdlib.h> +#include <stdio.h> + +const char* check_get_env(char* env); + +#ifdef _UTIL_DEF_ +const char* check_get_env(char* env) { + char *env_val = getenv(env); + if (!env_val) { + fprintf(stderr, "%s not set", env); + exit(1); + } + return env_val; +} +#endif + +#endif |