From 4e366f82dee33c2f9a2e781d77144b2cf76d7c51 Mon Sep 17 00:00:00 2001
From: Thomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Date: Sat, 8 Nov 2008 16:33:15 +0000
Subject: Fix long options parsing in check_disk, check_dns, check_mrtg and
 check_mrtgtraf (check_tcp was done in an earlier commit)

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2078 f882894a-f735-0410-b71e-b25c423dba1c

diff --git a/NEWS b/NEWS
index 670e476..7e8cc7c 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ This file documents the major additions and syntax changes between releases.
 	Extra-opts (C plugins) does not allow trailing comments anymore (like N::P)
 	Fixed dependency issue on libtap when ./configure --enable-libtap used. Warning: will install libtap
 	Fixed segfault in extra-opts under some circumstance when reading multiple sections
-	Fix long options parsing in check_tcp
+	Fix long options parsing in check_disk, check_dns, check_mrtg, check_mrtgtraf and check_tcp.
 	check_icmp now reports min and max round trip time perfdata (Steve Rader)
 	Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159)
 
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 7f5c009..2f8afa6 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -477,8 +477,8 @@ process_arguments (int argc, char **argv)
     {"iwarning", required_argument, 0, 'W'},
     /* Dang, -C is taken. We might want to reshuffle this. */
     {"icritical", required_argument, 0, 'K'},
-    {"kilobytes", required_argument, 0, 'k'},
-    {"megabytes", required_argument, 0, 'm'},
+    {"kilobytes", no_argument, 0, 'k'},
+    {"megabytes", no_argument, 0, 'm'},
     {"units", required_argument, 0, 'u'},
     {"path", required_argument, 0, 'p'},
     {"partition", required_argument, 0, 'p'},
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index c2d899f..19206c2 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -340,8 +340,8 @@ process_arguments (int argc, char **argv)
     {"reverse-server", required_argument, 0, 'r'},
     {"expected-address", required_argument, 0, 'a'},
     {"expect-authority", no_argument, 0, 'A'},
-    {"warning", no_argument, 0, 'w'},
-    {"critical", no_argument, 0, 'c'},
+    {"warning", required_argument, 0, 'w'},
+    {"critical", required_argument, 0, 'c'},
     {0, 0, 0, 0}
   };
 
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c
index 02f07c0..b0a7ef6 100644
--- a/plugins/check_ide_smart.c
+++ b/plugins/check_ide_smart.c
@@ -173,7 +173,8 @@ main (int argc, char *argv[])
 		{"auto-off", no_argument, 0, '0'}, 
 		{"nagios", no_argument, 0, 'n'}, 
 		{"help", no_argument, 0, 'h'}, 
-		{"version", no_argument, 0, 'V'}, {0, 0, 0, 0} 
+		{"version", no_argument, 0, 'V'},
+		{0, 0, 0, 0}
 	};
 
 	setlocale (LC_ALL, "");
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 80e5215..62b0cf0 100644
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
@@ -181,7 +181,7 @@ process_arguments (int argc, char **argv)
 		{"warning", required_argument, 0, 'w'},
 		{"label", required_argument, 0, 'l'},
 		{"units", required_argument, 0, 'u'},
-		{"verbose", no_argument, 0, 'v'},
+		{"variable", required_argument, 0, 'v'},
 		{"version", no_argument, 0, 'V'},
 		{"help", no_argument, 0, 'h'},
 		{0, 0, 0, 0}
@@ -334,7 +334,7 @@ print_help (void)
 
 	printf (" %s\n", "-F, --logfile=FILE");
   printf ("   %s\n", _("The MRTG log file containing the data you want to monitor"));
-  printf ("-e, --expires=MINUTES");
+  printf (" %s\n", "-e, --expires=MINUTES");
   printf ("   %s\n", _("Minutes before MRTG data is considered to be too old"));
   printf (" %s\n", "-a, --aggregation=AVG|MAX");
   printf ("   %s\n", _("Should we check average or maximum values?"));
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c
index b971616..1911d56 100644
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
@@ -223,13 +223,11 @@ process_arguments (int argc, char **argv)
 
 	int option = 0;
 	static struct option longopts[] = {
-		{"logfile", required_argument, 0, 'F'},
+		{"filename", required_argument, 0, 'F'},
 		{"expires", required_argument, 0, 'e'},
 		{"aggregation", required_argument, 0, 'a'},
-		{"variable", required_argument, 0, 'v'},
 		{"critical", required_argument, 0, 'c'},
 		{"warning", required_argument, 0, 'w'},
-		{"verbose", no_argument, 0, 'v'},
 		{"version", no_argument, 0, 'V'},
 		{"help", no_argument, 0, 'h'},
 		{0, 0, 0, 0}
@@ -385,6 +383,6 @@ void
 print_usage (void)
 {
 	printf (_("Usage"));
-  printf (" %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair>",progname);
-  printf ("-c <critical_pair> [-e expire_minutes] [-t timeout] [-v]\n");
+  printf (" %s -F <log_file> -a <AVG | MAX> -w <warning_pair>\n",progname);
+  printf ("-c <critical_pair> [-e expire_minutes]\n");
 }
diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c
index e887bca..a92b857 100644
--- a/plugins/check_mysql_query.c
+++ b/plugins/check_mysql_query.c
@@ -192,7 +192,7 @@ process_arguments (int argc, char **argv)
 		return ERROR;
 
 	while (1) {
-		c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:q:w:c:", longopts, &option);
+		c = getopt_long (argc, argv, "hvVP:p:u:d:H:s:q:w:c:", longopts, &option);
 
 		if (c == -1 || c == EOF)
 			break;
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index ef1b530..7d20b00 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -745,6 +745,6 @@ void print_help(void)
 void print_usage(void)
 {
   printf (_("Usage:"));
-	printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]",progname);
+	printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
   printf ("[-l params] [-d SHOWALL] [-t timeout]\n");
 }
-- 
cgit v0.10-9-g596f

