[monitoring-plugins] added -R/-ereg/-eregi

Andreas Baumann git at monitoring-plugins.org
Fri Mar 17 16:40:12 CET 2017


 Module: monitoring-plugins
 Branch: feature_check_curl
 Commit: 5df81ae2bf550cfd3854da0c51f88e618fdbbbd0
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Fri Mar 17 16:37:10 2017 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=5df81ae

added -R/-ereg/-eregi

---

 plugins/check_curl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 96b5a5e..537268c 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -520,6 +520,8 @@ process_arguments (int argc, char **argv)
     {"authorization", required_argument, 0, 'a'},
     {"string", required_argument, 0, 's'},
     {"regex", required_argument, 0, 'r'},
+    {"ereg", required_argument, 0, 'r'},
+    {"eregi", required_argument, 0, 'R'},
     {"onredirect", required_argument, 0, 'f'},
     {"certificate", required_argument, 0, 'C'},
     {"client-cert", required_argument, 0, 'J'},
@@ -537,7 +539,7 @@ process_arguments (int argc, char **argv)
     return ERROR;
 
   while (1) {
-    c = getopt_long (argc, argv, "Vvht:c:w:A:k:H:j:I:a:p:s:r:u:f:C:J:K:S::NE", longopts, &option);
+    c = getopt_long (argc, argv, "Vvht:c:w:A:k:H:j:I:a:p:s:R:r:u:f:C:J:K:S::NE", longopts, &option);
     if (c == -1 || c == EOF || c == 1)
       break;
 
@@ -707,6 +709,8 @@ process_arguments (int argc, char **argv)
       strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1);
       string_expect[MAX_INPUT_BUFFER - 1] = 0;
       break;
+    case 'R': /* regex */
+      cflags |= REG_ICASE;
     case 'r': /* regex */
       strncpy (regexp, optarg, MAX_RE_SIZE - 1);
       regexp[MAX_RE_SIZE - 1] = 0;
@@ -841,6 +845,8 @@ print_help (void)
   printf ("    %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)"));
   printf (" %s\n", "-r, --regex, --ereg=STRING");
   printf ("    %s\n", _("Search page for regex STRING"));
+  printf (" %s\n", "-R, --eregi=STRING");
+  printf ("    %s\n", _("Search page for case-insensitive regex STRING"));
   printf (" %s\n", "-a, --authorization=AUTH_PAIR");
   printf ("    %s\n", _("Username:password on sites with basic authentication"));
   printf (" %s\n", "-A, --useragent=STRING");
@@ -919,7 +925,7 @@ print_usage (void)
   printf ("       [-J <client certificate file>] [-K <private key>] [--ca-cert <CA certificate file>]\n");
   printf ("       [-w <warn time>] [-c <critical time>] [-t <timeout>] [-E] [-a auth]\n");
   printf ("       [-f <ok|warning|critcal|follow>]\n");
-  printf ("       [-s string] [-r <regex>\n");
+  printf ("       [-s string] [-r <regex> | -R <case-insensitive regex>]\n");
   printf ("       [-N]\n");
   printf ("       [-A string] [-k string] [-S <version>] [-C]\n");
   printf ("       [-v verbose]\n", progname);



More information about the Commits mailing list