diff options
-rw-r--r-- | plugins/check_pgsql.c | 6 | ||||
-rw-r--r-- | plugins/check_ping.c | 2 | ||||
-rw-r--r-- | plugins/check_snmp.c | 6 | ||||
-rw-r--r-- | plugins/negate.c | 6 | ||||
-rw-r--r-- | plugins/utils.h.in | 6 |
5 files changed, 16 insertions, 10 deletions
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index a2fd90e0..98c504fa 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -266,17 +266,17 @@ process_arguments (int argc, char **argv) while (1) { #ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:", + c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:", long_options, &option_index); #else - c = getopt (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:"); + c = getopt (argc, argv, "hVt:c:w:H:P:d:l:p:a:"); #endif if (c == EOF) break; switch (c) { case '?': /* usage */ - usage2 ("Unknown argument", optarg); + usage3 ("Unknown argument", optopt); case 'h': /* help */ print_help (); exit (STATE_OK); diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 7ff7f284..74aa3b7c 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -187,7 +187,7 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage2 ("Unknown argument", optarg); + usage3 ("Unknown argument", optopt); case 'h': /* help */ print_help (); exit (STATE_OK); diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index de019bac..4e447a45 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -418,10 +418,10 @@ process_arguments (int argc, char **argv) while (1) { #ifdef HAVE_GETOPT_H c = - getopt_long (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:", + getopt_long (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:", long_options, &option_index); #else - c = getopt (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:"); + c = getopt (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:"); #endif if (c == -1 || c == EOF) @@ -429,7 +429,7 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage2 ("Unknown argument", optarg); + usage3 ("Unknown argument", optopt); case 'h': /* help */ print_help (); exit (STATE_OK); diff --git a/plugins/negate.c b/plugins/negate.c index a11558d5..c76f5ca0 100644 --- a/plugins/negate.c +++ b/plugins/negate.c @@ -234,17 +234,17 @@ process_arguments (int argc, char **argv) while (1) { #ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "+?hVt:", + c = getopt_long (argc, argv, "hVt:", long_options, &option_index); #else - c = getopt (argc, argv, "+?hVt:"); + c = getopt (argc, argv, "hVt:"); #endif if (c == -1 || c == EOF) break; switch (c) { case '?': /* help */ - usage2 ("Unknown argument", optarg); + usage3 ("Unknown argument", optopt); case 'h': /* help */ print_help (); exit (EXIT_SUCCESS); diff --git a/plugins/utils.h.in b/plugins/utils.h.in index 2b668f3c..96bf9b2f 100644 --- a/plugins/utils.h.in +++ b/plugins/utils.h.in @@ -86,6 +86,12 @@ int max_state(int, int); exit(STATE_UNKNOWN);\ } +#define usage3(msg,arg) {\ + printf("%s: %s - %c\n",PROGNAME,msg,arg);\ + print_usage();\ + exit(STATE_UNKNOWN);\ +} + #define state_text(a) \ (a)==0?"OK":\ (a)==1?"WARNING":\ |