summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-05-25 12:33:24 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2006-05-25 12:33:24 (GMT)
commit5fd2550d4c96318b2de4a4a44e15e3c50c268e79 (patch)
treeb712838611281a444a9b603949352bc4003de657 /plugins/check_http.c
parent80e155c9cf826d977393ee130a07be599401335e (diff)
downloadmonitoring-plugins-5fd2550d4c96318b2de4a4a44e15e3c50c268e79.tar.gz
Use coreutils' regexp libraries, so regexp always available now
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1403 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index e25e5db..1869837 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -51,19 +51,17 @@ X509 *server_cert;
51int no_body = FALSE; 51int no_body = FALSE;
52int maximum_age = -1; 52int maximum_age = -1;
53 53
54#ifdef HAVE_REGEX_H
55enum { 54enum {
56 REGS = 2, 55 REGS = 2,
57 MAX_RE_SIZE = 256 56 MAX_RE_SIZE = 256
58}; 57};
59#include <regex.h> 58#include "regex.h"
60regex_t preg; 59regex_t preg;
61regmatch_t pmatch[REGS]; 60regmatch_t pmatch[REGS];
62char regexp[MAX_RE_SIZE]; 61char regexp[MAX_RE_SIZE];
63char errbuf[MAX_INPUT_BUFFER]; 62char errbuf[MAX_INPUT_BUFFER];
64int cflags = REG_NOSUB | REG_EXTENDED | REG_NEWLINE; 63int cflags = REG_NOSUB | REG_EXTENDED | REG_NEWLINE;
65int errcode; 64int errcode;
66#endif
67 65
68struct timeval tv; 66struct timeval tv;
69 67
@@ -333,13 +331,6 @@ process_arguments (int argc, char **argv)
333 case 'T': /* Content-type */ 331 case 'T': /* Content-type */
334 asprintf (&http_content_type, "%s", optarg); 332 asprintf (&http_content_type, "%s", optarg);
335 break; 333 break;
336#ifndef HAVE_REGEX_H
337 case 'l': /* linespan */
338 case 'r': /* linespan */
339 case 'R': /* linespan */
340 usage4 (_("Call for regex which was not a compiled option"));
341 break;
342#else
343 case 'l': /* linespan */ 334 case 'l': /* linespan */
344 cflags &= ~REG_NEWLINE; 335 cflags &= ~REG_NEWLINE;
345 break; 336 break;
@@ -355,7 +346,6 @@ process_arguments (int argc, char **argv)
355 return ERROR; 346 return ERROR;
356 } 347 }
357 break; 348 break;
358#endif
359 case '4': 349 case '4':
360 address_family = AF_INET; 350 address_family = AF_INET;
361 break; 351 break;
@@ -992,7 +982,7 @@ check_http (void)
992 exit (STATE_CRITICAL); 982 exit (STATE_CRITICAL);
993 } 983 }
994 } 984 }
995#ifdef HAVE_REGEX_H 985
996 if (strlen (regexp)) { 986 if (strlen (regexp)) {
997 errcode = regexec (&preg, page, REGS, pmatch, 0); 987 errcode = regexec (&preg, page, REGS, pmatch, 0);
998 if (errcode == 0) { 988 if (errcode == 0) {
@@ -1016,7 +1006,6 @@ check_http (void)
1016 } 1006 }
1017 } 1007 }
1018 } 1008 }
1019#endif
1020 1009
1021 /* make sure the page is of an appropriate size */ 1010 /* make sure the page is of an appropriate size */
1022 /* page_len = get_content_length(header); */ 1011 /* page_len = get_content_length(header); */
@@ -1270,7 +1259,6 @@ certificate expiration times."));
1270 -T, --content-type=STRING\n\ 1259 -T, --content-type=STRING\n\
1271 specify Content-Type header media type when POSTing\n"), HTTP_EXPECT); 1260 specify Content-Type header media type when POSTing\n"), HTTP_EXPECT);
1272 1261
1273#ifdef HAVE_REGEX_H
1274 printf (_("\ 1262 printf (_("\
1275 -l, --linespan\n\ 1263 -l, --linespan\n\
1276 Allow regex to span newlines (must precede -r or -R)\n\ 1264 Allow regex to span newlines (must precede -r or -R)\n\
@@ -1278,7 +1266,6 @@ certificate expiration times."));
1278 Search page for regex STRING\n\ 1266 Search page for regex STRING\n\
1279 -R, --eregi=STRING\n\ 1267 -R, --eregi=STRING\n\
1280 Search page for case-insensitive regex STRING\n")); 1268 Search page for case-insensitive regex STRING\n"));
1281#endif
1282 1269
1283 printf (_("\ 1270 printf (_("\
1284 -a, --authorization=AUTH_PAIR\n\ 1271 -a, --authorization=AUTH_PAIR\n\