unsigned int tpl_log_lvl = 0;
unsigned int tpl_log_initialized = 0;
+unsigned int tpl_getenv_initialized = 0;
+unsigned int tpl_getenv_enabled = 0;
unsigned int tpl_dump_lvl = 0;
struct _tpl_runtime {
#include <assert.h>
#include <pthread.h>
#include <string.h>
+#include <unistd.h>
#if defined(__GNUC__) && __GNUC__ >= 4
# define TPL_API __attribute__ ((visibility("default")))
/* 0:uninitialized, 1:initialized,no log, 2:user log */
extern unsigned int tpl_log_lvl;
extern unsigned int tpl_log_initialized;
+extern unsigned int tpl_getenv_initialized;
+extern unsigned int tpl_getenv_enabled;
extern unsigned int tpl_dump_lvl;
+#define TPL_GETENV_INIT() \
+ { \
+ if (!tpl_getenv_initialized) \
+ { \
+ int ret = access("/opt/usr/tpl_env", F_OK); \
+ if (ret == 0) \
+ tpl_getenv_enabled = 1; \
+ else \
+ tpl_getenv_enabled = 0; \
+ tpl_getenv_initialized = 1; \
+ } \
+ }
+
+inline char *tpl_getenv(const char *name)
+{
+ TPL_GETENV_INIT();
+ if (tpl_getenv_enabled)
+ return getenv(name);
+ else
+ return NULL;
+}
+
+
#define FONT_DEFAULT "\033[0m" /* for reset to default color */
#define FONT_RED "\033[31m" /* for error logs */
#define FONT_YELLOW "\033[33m" /* for warning logs */
}
#endif
-
typedef struct _tpl_list_node tpl_list_node_t;
typedef struct _tpl_list tpl_list_t;
typedef struct tpl_util_map_entry tpl_util_map_entry_t;