summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index b53fb11..9ff3439 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -75,8 +75,7 @@ char *nextarg (char *str);
75void print_usage (void); 75void print_usage (void);
76void print_help (void); 76void print_help (void);
77 77
78#ifdef HAVE_REGEX_H 78#include "regex.h"
79#include <regex.h>
80char regex_expect[MAX_INPUT_BUFFER] = ""; 79char regex_expect[MAX_INPUT_BUFFER] = "";
81regex_t preg; 80regex_t preg;
82regmatch_t pmatch[10]; 81regmatch_t pmatch[10];
@@ -86,7 +85,6 @@ char perfstr[MAX_INPUT_BUFFER];
86int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 85int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
87int eflags = 0; 86int eflags = 0;
88int errcode, excode; 87int errcode, excode;
89#endif
90 88
91char *server_address = NULL; 89char *server_address = NULL;
92char *community = NULL; 90char *community = NULL;
@@ -292,7 +290,6 @@ main (int argc, char **argv)
292 290
293 /* Process this block for regex matching */ 291 /* Process this block for regex matching */
294 else if (eval_method[i] & CRIT_REGEX) { 292 else if (eval_method[i] & CRIT_REGEX) {
295#ifdef HAVE_REGEX_H
296 excode = regexec (&preg, response, 10, pmatch, eflags); 293 excode = regexec (&preg, response, 10, pmatch, eflags);
297 if (excode == 0) { 294 if (excode == 0) {
298 iresult = STATE_OK; 295 iresult = STATE_OK;
@@ -305,10 +302,6 @@ main (int argc, char **argv)
305 else { 302 else {
306 iresult = STATE_CRITICAL; 303 iresult = STATE_CRITICAL;
307 } 304 }
308#else
309 printf (_("Call for regex which was not a compiled option"));
310 exit (STATE_UNKNOWN);
311#endif
312 } 305 }
313 306
314 /* Process this block for existence-nonexistence checks */ 307 /* Process this block for existence-nonexistence checks */
@@ -542,11 +535,8 @@ process_arguments (int argc, char **argv)
542 ii++; 535 ii++;
543 break; 536 break;
544 case 'R': /* regex */ 537 case 'R': /* regex */
545#ifdef HAVE_REGEX_H
546 cflags = REG_ICASE; 538 cflags = REG_ICASE;
547#endif
548 case 'r': /* regex */ 539 case 'r': /* regex */
549#ifdef HAVE_REGEX_H
550 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 540 cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
551 strncpy (regex_expect, optarg, sizeof (regex_expect) - 1); 541 strncpy (regex_expect, optarg, sizeof (regex_expect) - 1);
552 regex_expect[sizeof (regex_expect) - 1] = 0; 542 regex_expect[sizeof (regex_expect) - 1] = 0;
@@ -558,10 +548,6 @@ process_arguments (int argc, char **argv)
558 } 548 }
559 eval_method[jj++] = CRIT_REGEX; 549 eval_method[jj++] = CRIT_REGEX;
560 ii++; 550 ii++;
561#else
562 printf (_("call for regex which was not a compiled option"));
563 exit (STATE_UNKNOWN);
564#endif
565 break; 551 break;
566 552
567 /* Format */ 553 /* Format */