summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2002-06-19 05:11:52 +0000
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2002-06-19 05:11:52 +0000
commitf4c6f7f09305c1c9916da6ac4f7aadcb31e319e0 (patch)
treebec7f042f90eac26b30122806846fc6a0e3f13b7 /plugins/check_snmp.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/check_snmp.c')
-rw-r--r--plugins/check_snmp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 2f970b3d..8e977e82 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -97,6 +97,7 @@ char *community = NULL;
97char oid[MAX_INPUT_BUFFER] = ""; 97char oid[MAX_INPUT_BUFFER] = "";
98char *label = NULL; 98char *label = NULL;
99char *units = NULL; 99char *units = NULL;
100char *port = NULL;
100char string_value[MAX_INPUT_BUFFER] = ""; 101char string_value[MAX_INPUT_BUFFER] = "";
101char **labels = NULL; 102char **labels = NULL;
102char **unitv = NULL; 103char **unitv = NULL;
@@ -259,7 +260,7 @@ main (int argc, char **argv)
259 iresult = STATE_WARNING; 260 iresult = STATE_WARNING;
260 } 261 }
261 262
262 result = max (result, iresult); 263 result = max_state (result, iresult);
263 264
264 if (nlabels > 1 && i < nlabels && labels[i] != NULL) 265 if (nlabels > 1 && i < nlabels && labels[i] != NULL)
265 outbuff = ssprintf 266 outbuff = ssprintf
@@ -290,14 +291,14 @@ main (int argc, char **argv)
290 291
291 /* WARNING if output found on stderr */ 292 /* WARNING if output found on stderr */
292 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) 293 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
293 result = max (result, STATE_WARNING); 294 result = max_state (result, STATE_WARNING);
294 295
295 /* close stderr */ 296 /* close stderr */
296 (void) fclose (child_stderr); 297 (void) fclose (child_stderr);
297 298
298 /* close the pipe */ 299 /* close the pipe */
299 if (spclose (child_process)) 300 if (spclose (child_process))
300 result = max (result, STATE_WARNING); 301 result = max_state (result, STATE_WARNING);
301 302
302 if (nunits > 0) 303 if (nunits > 0)
303 printf ("%s %s -%s\n", label, state_text (result), outbuff); 304 printf ("%s %s -%s\n", label, state_text (result), outbuff);
@@ -348,6 +349,12 @@ process_arguments (int argc, char **argv)
348 if (units == NULL) 349 if (units == NULL)
349 units = strscpy (NULL, ""); 350 units = strscpy (NULL, "");
350 351
352 if (port == NULL)
353 port = strscpy(NULL,"161");
354
355 if (port == NULL)
356 port = strscpy(NULL,"161");
357
351 return c; 358 return c;
352} 359}
353 360
@@ -409,6 +416,7 @@ call_getopt (int argc, char **argv)
409 case 'r': 416 case 'r':
410 case 'l': 417 case 'l':
411 case 'u': 418 case 'u':
419 case 'p':
412 i++; 420 i++;
413 } 421 }
414 422
@@ -608,6 +616,8 @@ print_help (char *cmd)
608 " (default is \"public\")\n" 616 " (default is \"public\")\n"
609 " -u, --units=STRING\n" 617 " -u, --units=STRING\n"
610 " Units label(s) for output data (e.g., 'sec.').\n" 618 " Units label(s) for output data (e.g., 'sec.').\n"
619 " -p, --port=STRING\n"
620 " TCP port number target is listening on.\n"
611 " -d, --delimiter=STRING\n" 621 " -d, --delimiter=STRING\n"
612 " Delimiter to use when parsing returned data. Default is \"%s\"\n" 622 " Delimiter to use when parsing returned data. Default is \"%s\"\n"
613 " Any data on the right hand side of the delimiter is considered\n" 623 " Any data on the right hand side of the delimiter is considered\n"