summaryrefslogtreecommitdiffstats
path: root/web/attachments/39582-check_http_patch
blob: cb9f62452e5ba1ad0a57150ed88d628735752145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Index: plugins/check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.13
diff -c -r1.13 check_http.c
*** plugins/check_http.c	19 Dec 2002 19:20:25 -0000	1.13
--- plugins/check_http.c	13 Jan 2003 03:52:29 -0000
***************
*** 44,50 ****
  \(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
              [-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]"
  
  #define LONGOPTIONS "\
--- 44,50 ----
  \(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
              [-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]"
  
  #define LONGOPTIONS "\
***************
*** 75,80 ****
--- 75,82 ----
     Wrap output in HTML link (obsoleted by urlize)\n\
   -f, --onredirect=<ok|warning|critical|follow>\n\
     How to handle redirected pages\n%s\
+  -l, --linespan\n\
+     Allow regex to span newlines (must precede -r or -R)\n\
   -v, --verbose\n\
      Show details for command-line debugging (do not use with nagios server)\n\
   -h, --help\n\
***************
*** 286,291 ****
--- 288,294 ----
  		{"regex", required_argument, 0, 'r'},
  		{"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'},
  		{0, 0, 0, 0}
***************
*** 308,314 ****
  			strcpy (argv[c], "-n");
  	}
  
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS"
  
  	while (1) {
  #ifdef HAVE_GETOPT_H
--- 311,317 ----
  			strcpy (argv[c], "-n");
  	}
  
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:lu:f:C:nLS"
  
  	while (1) {
  #ifdef HAVE_GETOPT_H
***************
*** 420,434 ****
  			server_expect[MAX_INPUT_BUFFER - 1] = 0;
  			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;
  			errcode = regcomp (&preg, regexp, cflags);
--- 423,444 ----
  			server_expect[MAX_INPUT_BUFFER - 1] = 0;
  			server_expect_yn = 1;
  			break;
+ #ifndef HAVE_REGEX_H
+ 		case 'l': /* linespan */
  		case 'R': /* regex */
! 		case 'r': /* regex */
  			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 */
! 			/* this is not required here, as it's initialized
  			cflags |= REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
+ 			*/
  			strncpy (regexp, optarg, MAX_RE_SIZE - 1);
  			regexp[MAX_RE_SIZE - 1] = 0;
  			errcode = regcomp (&preg, regexp, cflags);
***************
*** 437,446 ****
  				printf ("Could Not Compile Regular Expression: %s", errbuf);
  				return ERROR;
  			}
- #else
- 			usage ("check_http: call for regex which was not a compiled option\n");
- #endif
  			break;
  		case 'v': /* verbose */
  			verbose = TRUE;
  			break;
--- 447,454 ----
  				printf ("Could Not Compile Regular Expression: %s", errbuf);
  				return ERROR;
  			}
  			break;
+ #endif
  		case 'v': /* verbose */
  			verbose = TRUE;
  			break;