summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2002-06-19 05:11:52 (GMT)
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2002-06-19 05:11:52 (GMT)
commitf4c6f7f09305c1c9916da6ac4f7aadcb31e319e0 (patch)
treebec7f042f90eac26b30122806846fc6a0e3f13b7 /plugins/utils.c
parentd36016a7adf28424d7f4adaa50612c41f1937c3b (diff)
downloadmonitoring-plugins-f4c6f7f09305c1c9916da6ac4f7aadcb31e319e0.tar.gz
more POSIX return value comparison related code fixes
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@55 f882894a-f735-0410-b71e-b25c423dba1c
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{