[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.14,1.15
Karl DeBisschop
kdebisschop at users.sourceforge.net
Wed Jan 15 22:30:02 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv6250/plugins
Modified Files:
check_http.c
Log Message:
add option to let regex span newlines
Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_http.c 13 Jan 2003 12:15:16 -0000 1.14
--- check_http.c 16 Jan 2003 06:29:02 -0000 1.15
***************
*** 45,49 ****
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
[-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
! [-s string] [-r <regex> | -R <case-insensitive regex>]\n\
[-P string]"
--- 45,49 ----
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
[-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
! [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
[-P string]"
***************
*** 75,79 ****
Wrap output in HTML link (obsoleted by urlize)\n\
-f, --onredirect=<ok|warning|critical|follow>\n\
! How to handle redirected pages\n%s\
-v, --verbose\n\
Show details for command-line debugging (do not use with nagios server)\n\
--- 75,79 ----
Wrap output in HTML link (obsoleted by urlize)\n\
-f, --onredirect=<ok|warning|critical|follow>\n\
! How to handle redirected pages\n%s%s\
-v, --verbose\n\
Show details for command-line debugging (do not use with nagios server)\n\
***************
*** 94,97 ****
--- 94,109 ----
#endif
+ #ifdef HAVE_REGEX_H
+ #define REGOPTIONS "\
+ -l, --linespan\n\
+ Allow regex to span newlines (must precede -r or -R)\n\
+ -r, --regex, --ereg=STRING\n\
+ Search page for regex STRING\n\
+ -R, --eregi=STRING\n\
+ Search page for case-insensitive regex STRING\n"
+ #else
+ #define REGOPTIONS ""
+ #endif
+
#define DESCRIPTION "\
This plugin will attempt to open an HTTP connection with the host. Successul\n\
***************
*** 287,290 ****
--- 299,303 ----
{"ereg", required_argument, 0, 'r'},
{"eregi", required_argument, 0, 'R'},
+ {"linespan", no_argument, 0, 'l'},
{"onredirect", required_argument, 0, 'f'},
{"certificate", required_argument, 0, 'C'},
***************
*** 309,313 ****
}
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS"
while (1) {
--- 322,326 ----
}
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"
while (1) {
***************
*** 421,433 ****
server_expect_yn = 1;
break;
! case 'R': /* regex */
! #ifdef HAVE_REGEX_H
! cflags = REG_ICASE;
! #else
usage ("check_http: call for regex which was not a compiled option\n");
! #endif
case 'r': /* regex */
- #ifdef HAVE_REGEX_H
- cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
strncpy (regexp, optarg, MAX_RE_SIZE - 1);
regexp[MAX_RE_SIZE - 1] = 0;
--- 434,450 ----
server_expect_yn = 1;
break;
! #ifndef HAVE_REGEX_H
! case 'l': /* linespan */
! case 'r': /* linespan */
! case 'R': /* linespan */
usage ("check_http: call for regex which was not a compiled option\n");
! break;
! #else
! case 'l': /* linespan */
! cflags &= ~REG_NEWLINE;
! break;
! case 'R': /* regex */
! cflags |= REG_ICASE;
case 'r': /* regex */
strncpy (regexp, optarg, MAX_RE_SIZE - 1);
regexp[MAX_RE_SIZE - 1] = 0;
***************
*** 438,445 ****
return ERROR;
}
- #else
- usage ("check_http: call for regex which was not a compiled option\n");
- #endif
break;
case 'v': /* verbose */
verbose = TRUE;
--- 455,460 ----
return ERROR;
}
break;
+ #endif
case 'v': /* verbose */
verbose = TRUE;
***************
*** 450,455 ****
c = optind;
! if (server_address == NULL && host_name == NULL) {
! server_address = strscpy (NULL, argv[c]);
host_name = strscpy (NULL, argv[c++]);
}
--- 465,469 ----
c = optind;
! if (server_address == NULL && host_name == NULL) { server_address = strscpy (NULL, argv[c]);
host_name = strscpy (NULL, argv[c++]);
}
***************
*** 1066,1070 ****
printf ("NOTE: One or both of -H and -I must be specified\n");
printf ("\nOptions:\n" LONGOPTIONS "\n", HTTP_EXPECT, HTTP_PORT,
! DEFAULT_SOCKET_TIMEOUT, SSLOPTIONS);
#ifdef HAVE_SSL
printf (SSLDESCRIPTION);
--- 1080,1084 ----
printf ("NOTE: One or both of -H and -I must be specified\n");
printf ("\nOptions:\n" LONGOPTIONS "\n", HTTP_EXPECT, HTTP_PORT,
! DEFAULT_SOCKET_TIMEOUT, SSLOPTIONS, REGOPTIONS);
#ifdef HAVE_SSL
printf (SSLDESCRIPTION);
More information about the Commits
mailing list