diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2014-01-29 03:20:23 -0500 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2014-01-29 03:20:23 -0500 |
commit | 8fc9e5ac4b3a699f8d6b78471829692f0c92d5fa (patch) | |
tree | 4d630aa158d65602307723e9c7c6d41eca82b94d /lib/utils_base.h | |
parent | 55f97c2021bf920b62148ea31fdf56d95572d944 (diff) | |
download | monitoring-plugins-8fc9e5ac4b3a699f8d6b78471829692f0c92d5fa.tar.gz |
Move negate' translate_state() to utils_base.h mp_translate_state()
Also use strcasecmp imported from gnulib for simplicity
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r-- | lib/utils_base.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h index b4bd92ee..04f6370c 100644 --- a/lib/utils_base.h +++ b/lib/utils_base.h | |||
@@ -79,6 +79,10 @@ int np_check_if_root(void); | |||
79 | * code from the above function, in case it's helpful for testing */ | 79 | * code from the above function, in case it's helpful for testing */ |
80 | int np_warn_if_not_root(void); | 80 | int np_warn_if_not_root(void); |
81 | 81 | ||
82 | /* mp_suid() returns true if the real and effective uids differs, such as when | ||
83 | * running a suid plugin */ | ||
84 | #define mp_suid() (getuid() != geteuid()) | ||
85 | |||
82 | /* | 86 | /* |
83 | * Extract the value from key/value pairs, or return NULL. The value returned | 87 | * Extract the value from key/value pairs, or return NULL. The value returned |
84 | * can be free()ed. | 88 | * can be free()ed. |
@@ -93,6 +97,11 @@ char *np_extract_value(const char*, const char*, char); | |||
93 | */ | 97 | */ |
94 | #define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') | 98 | #define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') |
95 | 99 | ||
100 | /* | ||
101 | * Read a string representing a state (ok, warning... or numeric: 0, 1) and | ||
102 | * return the corresponding NP_STATE or ERROR) | ||
103 | */ | ||
104 | int mp_translate_state (char *); | ||
96 | 105 | ||
97 | void np_enable_state(char *, int); | 106 | void np_enable_state(char *, int); |
98 | state_data *np_state_read(); | 107 | state_data *np_state_read(); |
@@ -102,8 +111,4 @@ void np_init(char *, int argc, char **argv); | |||
102 | void np_set_args(int argc, char **argv); | 111 | void np_set_args(int argc, char **argv); |
103 | void np_cleanup(); | 112 | void np_cleanup(); |
104 | 113 | ||
105 | /* mp_suid() returns true if the real and effective uids differs, such as when | ||
106 | * running a suid plugin */ | ||
107 | #define mp_suid() (getuid() != geteuid()) | ||
108 | |||
109 | #endif /* _UTILS_BASE_ */ | 114 | #endif /* _UTILS_BASE_ */ |