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) | |||
266 | 266 | ||
267 | while (1) { | 267 | while (1) { |
268 | #ifdef HAVE_GETOPT_H | 268 | #ifdef HAVE_GETOPT_H |
269 | c = getopt_long (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:", | 269 | c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:", |
270 | long_options, &option_index); | 270 | long_options, &option_index); |
271 | #else | 271 | #else |
272 | c = getopt (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:"); | 272 | c = getopt (argc, argv, "hVt:c:w:H:P:d:l:p:a:"); |
273 | #endif | 273 | #endif |
274 | if (c == EOF) | 274 | if (c == EOF) |
275 | break; | 275 | break; |
276 | 276 | ||
277 | switch (c) { | 277 | switch (c) { |
278 | case '?': /* usage */ | 278 | case '?': /* usage */ |
279 | usage2 ("Unknown argument", optarg); | 279 | usage3 ("Unknown argument", optopt); |
280 | case 'h': /* help */ | 280 | case 'h': /* help */ |
281 | print_help (); | 281 | print_help (); |
282 | exit (STATE_OK); | 282 | 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) | |||
187 | 187 | ||
188 | switch (c) { | 188 | switch (c) { |
189 | case '?': /* usage */ | 189 | case '?': /* usage */ |
190 | usage2 ("Unknown argument", optarg); | 190 | usage3 ("Unknown argument", optopt); |
191 | case 'h': /* help */ | 191 | case 'h': /* help */ |
192 | print_help (); | 192 | print_help (); |
193 | exit (STATE_OK); | 193 | 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) | |||
418 | while (1) { | 418 | while (1) { |
419 | #ifdef HAVE_GETOPT_H | 419 | #ifdef HAVE_GETOPT_H |
420 | c = | 420 | c = |
421 | getopt_long (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:", | 421 | getopt_long (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:", |
422 | long_options, &option_index); | 422 | long_options, &option_index); |
423 | #else | 423 | #else |
424 | c = getopt (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:"); | 424 | c = getopt (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:"); |
425 | #endif | 425 | #endif |
426 | 426 | ||
427 | if (c == -1 || c == EOF) | 427 | if (c == -1 || c == EOF) |
@@ -429,7 +429,7 @@ process_arguments (int argc, char **argv) | |||
429 | 429 | ||
430 | switch (c) { | 430 | switch (c) { |
431 | case '?': /* usage */ | 431 | case '?': /* usage */ |
432 | usage2 ("Unknown argument", optarg); | 432 | usage3 ("Unknown argument", optopt); |
433 | case 'h': /* help */ | 433 | case 'h': /* help */ |
434 | print_help (); | 434 | print_help (); |
435 | exit (STATE_OK); | 435 | 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) | |||
234 | 234 | ||
235 | while (1) { | 235 | while (1) { |
236 | #ifdef HAVE_GETOPT_H | 236 | #ifdef HAVE_GETOPT_H |
237 | c = getopt_long (argc, argv, "+?hVt:", | 237 | c = getopt_long (argc, argv, "hVt:", |
238 | long_options, &option_index); | 238 | long_options, &option_index); |
239 | #else | 239 | #else |
240 | c = getopt (argc, argv, "+?hVt:"); | 240 | c = getopt (argc, argv, "hVt:"); |
241 | #endif | 241 | #endif |
242 | if (c == -1 || c == EOF) | 242 | if (c == -1 || c == EOF) |
243 | break; | 243 | break; |
244 | 244 | ||
245 | switch (c) { | 245 | switch (c) { |
246 | case '?': /* help */ | 246 | case '?': /* help */ |
247 | usage2 ("Unknown argument", optarg); | 247 | usage3 ("Unknown argument", optopt); |
248 | case 'h': /* help */ | 248 | case 'h': /* help */ |
249 | print_help (); | 249 | print_help (); |
250 | exit (EXIT_SUCCESS); | 250 | 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); | |||
86 | exit(STATE_UNKNOWN);\ | 86 | exit(STATE_UNKNOWN);\ |
87 | } | 87 | } |
88 | 88 | ||
89 | #define usage3(msg,arg) {\ | ||
90 | printf("%s: %s - %c\n",PROGNAME,msg,arg);\ | ||
91 | print_usage();\ | ||
92 | exit(STATE_UNKNOWN);\ | ||
93 | } | ||
94 | |||
89 | #define state_text(a) \ | 95 | #define state_text(a) \ |
90 | (a)==0?"OK":\ | 96 | (a)==0?"OK":\ |
91 | (a)==1?"WARNING":\ | 97 | (a)==1?"WARNING":\ |