1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 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