summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/utils.c')
-rw-r--r--plugins/utils.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/utils.c b/plugins/utils.c
index 49e4d3d..8bec1cf 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -58,6 +58,44 @@ char *strpcat (char *dest, const char *src, const char *str);
58 58
59#define max(a,b) ((a)>(b))?(a):(b) 59#define max(a,b) ((a)>(b))?(a):(b)
60 60
61/* **************************************************************************
62 * max_state(result, STATE_x)
63 * compares STATE_x to result and returns result if STATE_x is less than a based on the following
64 * STATE_UNKNOWN < STATE_OK < STATE_WARNING < STATE_CRITICAL
65 *
66 * Note that numerically the above does not hold
67 ****************************************************************************/
68
69int
70max_state(int a, int b)
71{
72 if(a == STATE_CRITICAL){
73 return a;
74 }
75 else if (a == STATE_WARNING) {
76
77 if (b == STATE_CRITICAL){
78 return b;
79 }else {
80 return a;
81 }
82 }
83 else if (a == STATE_OK) {
84
85 if ( b== STATE_CRITICAL || b == STATE_WARNING) {
86 return b;
87 }else{
88 return a;
89 }
90 }
91 else {
92 /* a == UNKNOWN */
93 return b;
94 }
95
96
97}
98
61char * 99char *
62my_basename (char *path) 100my_basename (char *path)
63{ 101{