summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_snmp.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index cb985cab..750c47ea 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -453,11 +453,8 @@ process_arguments (int argc, char **argv)
453 453
454 /* Test parameters */ 454 /* Test parameters */
455 case 'c': /* critical time threshold */ 455 case 'c': /* critical time threshold */
456 if (strspn (optarg, "0123456789:,") < strlen (optarg)) { 456 if (strspn (optarg, "0123456789:,") < strlen (optarg))
457 printf (_("Invalid critical threshold: %s\n"), optarg); 457 usage2 (_("Invalid critical threshold: %s\n"), optarg);
458 print_usage ();
459 exit (STATE_UNKNOWN);
460 }
461 for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) { 458 for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) {
462 if (lu_getll (&lower_crit_lim[jj], ptr) == 1) 459 if (lu_getll (&lower_crit_lim[jj], ptr) == 1)
463 eval_method[jj] |= CRIT_LT; 460 eval_method[jj] |= CRIT_LT;
@@ -467,11 +464,8 @@ process_arguments (int argc, char **argv)
467 } 464 }
468 break; 465 break;
469 case 'w': /* warning time threshold */ 466 case 'w': /* warning time threshold */
470 if (strspn (optarg, "0123456789:,") < strlen (optarg)) { 467 if (strspn (optarg, "0123456789:,") < strlen (optarg))
471 printf (_("Invalid warning threshold: %s\n"), optarg); 468 usage2 (_("Invalid warning threshold: %s\n"), optarg);
472 print_usage ();
473 exit (STATE_UNKNOWN);
474 }
475 for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) { 469 for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) {
476 if (lu_getll (&lower_warn_lim[ii], ptr) == 1) 470 if (lu_getll (&lower_warn_lim[ii], ptr) == 1)
477 eval_method[ii] |= WARN_LT; 471 eval_method[ii] |= WARN_LT;
@@ -545,10 +539,9 @@ process_arguments (int argc, char **argv)
545 } 539 }
546 labels[nlabels - 1] = optarg; 540 labels[nlabels - 1] = optarg;
547 ptr = thisarg (optarg); 541 ptr = thisarg (optarg);
542 labels[nlabels - 1] = ptr;
548 if (strstr (ptr, "'") == ptr) 543 if (strstr (ptr, "'") == ptr)
549 labels[nlabels - 1] = ptr + 1; 544 labels[nlabels - 1] = ptr + 1;
550 else
551 labels[nlabels - 1] = ptr;
552 while (ptr && (ptr = nextarg (ptr))) { 545 while (ptr && (ptr = nextarg (ptr))) {
553 if (nlabels >= labels_size) { 546 if (nlabels >= labels_size) {
554 labels_size += 8; 547 labels_size += 8;
@@ -576,10 +569,9 @@ process_arguments (int argc, char **argv)
576 } 569 }
577 unitv[nunits - 1] = optarg; 570 unitv[nunits - 1] = optarg;
578 ptr = thisarg (optarg); 571 ptr = thisarg (optarg);
572 unitv[nunits - 1] = ptr;
579 if (strstr (ptr, "'") == ptr) 573 if (strstr (ptr, "'") == ptr)
580 unitv[nunits - 1] = ptr + 1; 574 unitv[nunits - 1] = ptr + 1;
581 else
582 unitv[nunits - 1] = ptr;
583 while (ptr && (ptr = nextarg (ptr))) { 575 while (ptr && (ptr = nextarg (ptr))) {
584 if (nunits >= unitv_size) { 576 if (nunits >= unitv_size) {
585 unitv_size += 8; 577 unitv_size += 8;
@@ -832,23 +824,21 @@ char *
832nextarg (char *str) 824nextarg (char *str)
833{ 825{
834 if (strstr (str, "'") == str) { 826 if (strstr (str, "'") == str) {
827 str[0] = 0;
835 if (strlen (str) > 1) { 828 if (strlen (str) > 1) {
836 str = strstr (str + 1, "'"); 829 str = strstr (str + 1, "'");
837 str[0] = 0;
838 return (++str); 830 return (++str);
839 } 831 }
840 else { 832 else {
841 str[0] = 0;
842 return NULL; 833 return NULL;
843 } 834 }
844 } 835 }
845 if (strstr (str, ",") == str) { 836 if (strstr (str, ",") == str) {
837 str[0] = 0;
846 if (strlen (str) > 1) { 838 if (strlen (str) > 1) {
847 str[0] = 0;
848 return (++str); 839 return (++str);
849 } 840 }
850 else { 841 else {
851 str[0] = 0;
852 return NULL; 842 return NULL;
853 } 843 }
854 } 844 }