diff options
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r-- | lib/utils_base.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h index f40fdb0f..8d0b2124 100644 --- a/lib/utils_base.h +++ b/lib/utils_base.h | |||
@@ -37,6 +37,23 @@ int get_status(double, thresholds *); | |||
37 | 37 | ||
38 | char *np_escaped_string (const char *); | 38 | char *np_escaped_string (const char *); |
39 | 39 | ||
40 | void np_set_output(const char *, const char *, int, int); | ||
41 | int np_adjust_verbosity(int); | ||
42 | void np_debug(int, const char *, ...) | ||
43 | __attribute__((format(printf, 2, 3))); | ||
44 | void np_verbose(const char *, ...) | ||
45 | __attribute__((format(printf, 1, 2))); | ||
46 | void np_die(int, const char *, ...) | ||
47 | __attribute__((noreturn, format(printf, 2, 3))); | ||
48 | |||
49 | #define np_verbatim(s) np_verbose("%s", s) | ||
50 | #define np_increase_verbosity(i) np_adjust_verbosity(i) | ||
51 | #define np_decrease_verbosity(i) np_adjust_verbosity(-i) | ||
52 | #define np_get_verbosity() np_adjust_verbosity(0) | ||
53 | #define np_set_verbosity(v) np_set_output(NULL, NULL, v, 0) | ||
54 | #define np_set_mynames(p, s) np_set_output(p, s, -2, 0) | ||
55 | |||
56 | /* TODO: die() can be removed as soon as all plugins use np_die() instead. */ | ||
40 | void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3))); | 57 | void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3))); |
41 | 58 | ||
42 | /* Return codes for _set_thresholds */ | 59 | /* Return codes for _set_thresholds */ |
@@ -64,4 +81,7 @@ char *np_extract_value(const char*, const char*, char); | |||
64 | */ | 81 | */ |
65 | #define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') | 82 | #define np_extract_ntpvar(l, n) np_extract_value(l, n, ',') |
66 | 83 | ||
84 | /* Given a numerical status, return a pointer to the according string. */ | ||
85 | const char *state_text(int); | ||
86 | |||
67 | #endif /* _UTILS_BASE_ */ | 87 | #endif /* _UTILS_BASE_ */ |