diff options
Diffstat (limited to 'plugins')
35 files changed, 234 insertions, 239 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 59e41786..5c505309 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
24 | 24 | ||
25 | #define PROGRAM check_by_ssh | 25 | const char *progname = "check_by_ssh"; |
26 | #define DESCRIPTION "Run checks on a remote system using ssh, wrapping the proper timeout around the ssh invocation." | 26 | #define DESCRIPTION "Run checks on a remote system using ssh, wrapping the proper timeout around the ssh invocation." |
27 | #define AUTHOR "Karl DeBisschop" | 27 | #define AUTHOR "Karl DeBisschop" |
28 | #define EMAIL "karl@debisschop.net" | 28 | #define EMAIL "karl@debisschop.net" |
@@ -34,11 +34,9 @@ | |||
34 | #include "utils.h" | 34 | #include "utils.h" |
35 | #include <time.h> | 35 | #include <time.h> |
36 | 36 | ||
37 | #define PROGNAME "check_by_ssh" | ||
38 | |||
39 | int process_arguments (int, char **); | 37 | int process_arguments (int, char **); |
40 | int validate_arguments (void); | 38 | int validate_arguments (void); |
41 | void print_help (char *command_name); | 39 | void print_help (const char *command_name); |
42 | void print_usage (void); | 40 | void print_usage (void); |
43 | 41 | ||
44 | 42 | ||
@@ -223,10 +221,10 @@ process_arguments (int argc, char **argv) | |||
223 | print_usage (); | 221 | print_usage (); |
224 | exit (STATE_UNKNOWN); | 222 | exit (STATE_UNKNOWN); |
225 | case 'V': /* version */ | 223 | case 'V': /* version */ |
226 | print_revision (PROGNAME, "$Revision$"); | 224 | print_revision (progname, "$Revision$"); |
227 | exit (STATE_OK); | 225 | exit (STATE_OK); |
228 | case 'h': /* help */ | 226 | case 'h': /* help */ |
229 | print_help (PROGNAME); | 227 | print_help (progname); |
230 | exit (STATE_OK); | 228 | exit (STATE_OK); |
231 | case 'v': /* help */ | 229 | case 'v': /* help */ |
232 | verbose = TRUE; | 230 | verbose = TRUE; |
@@ -286,7 +284,7 @@ process_arguments (int argc, char **argv) | |||
286 | c = optind; | 284 | c = optind; |
287 | if (hostname == NULL) { | 285 | if (hostname == NULL) { |
288 | if (!is_host (argv[c])) | 286 | if (!is_host (argv[c])) |
289 | terminate (STATE_UNKNOWN, "%s: Invalid host name %s\n", PROGNAME, argv[c]); | 287 | terminate (STATE_UNKNOWN, "%s: Invalid host name %s\n", progname, argv[c]); |
290 | hostname = argv[c++]; | 288 | hostname = argv[c++]; |
291 | } | 289 | } |
292 | 290 | ||
@@ -317,10 +315,10 @@ validate_arguments (void) | |||
317 | return ERROR; | 315 | return ERROR; |
318 | 316 | ||
319 | if (passive && commands != services) | 317 | if (passive && commands != services) |
320 | terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide a service name for each command.\n", PROGNAME); | 318 | terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide a service name for each command.\n", progname); |
321 | 319 | ||
322 | if (passive && host_shortname == NULL) | 320 | if (passive && host_shortname == NULL) |
323 | terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide the host short name from the nagios configs.\n", PROGNAME); | 321 | terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide the host short name from the nagios configs.\n", progname); |
324 | 322 | ||
325 | return OK; | 323 | return OK; |
326 | } | 324 | } |
@@ -330,7 +328,7 @@ validate_arguments (void) | |||
330 | 328 | ||
331 | 329 | ||
332 | void | 330 | void |
333 | print_help (char *cmd) | 331 | print_help (const char *cmd) |
334 | { | 332 | { |
335 | print_revision (cmd, "$Revision$"); | 333 | print_revision (cmd, "$Revision$"); |
336 | 334 | ||
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index e4f86321..5c6f1e12 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "utils.h" | 25 | #include "utils.h" |
26 | #include "popen.h" | 26 | #include "popen.h" |
27 | 27 | ||
28 | #define PROGNAME "check_dig" | 28 | const char *progname = "check_dig"; |
29 | #define REVISION "$Revision$" | 29 | #define REVISION "$Revision$" |
30 | #define COPYRIGHT "2000-2002" | 30 | #define COPYRIGHT "2000-2002" |
31 | #define AUTHOR "Karl DeBisschop" | 31 | #define AUTHOR "Karl DeBisschop" |
@@ -197,7 +197,7 @@ process_arguments (int argc, char **argv) | |||
197 | } | 197 | } |
198 | break; | 198 | break; |
199 | case 'V': /* version */ | 199 | case 'V': /* version */ |
200 | print_revision (PROGNAME, "$Revision$"); | 200 | print_revision (progname, "$Revision$"); |
201 | exit (STATE_OK); | 201 | exit (STATE_OK); |
202 | case 'h': /* help */ | 202 | case 'h': /* help */ |
203 | print_help (); | 203 | print_help (); |
@@ -240,7 +240,7 @@ validate_arguments (void) | |||
240 | void | 240 | void |
241 | print_help (void) | 241 | print_help (void) |
242 | { | 242 | { |
243 | print_revision (PROGNAME, "$Revision$"); | 243 | print_revision (progname, "$Revision$"); |
244 | printf | 244 | printf |
245 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 245 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
246 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 246 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
@@ -272,5 +272,5 @@ print_usage (void) | |||
272 | printf | 272 | printf |
273 | ("Usage: %s -H host -l lookup [-t timeout] [-v]\n" | 273 | ("Usage: %s -H host -l lookup [-t timeout] [-v]\n" |
274 | " %s --help\n" | 274 | " %s --help\n" |
275 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 275 | " %s --version\n", progname, progname, progname); |
276 | } | 276 | } |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 55343059..3c1cfef9 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -45,7 +45,7 @@ int check_disk (int usp, int free_disk); | |||
45 | void print_help (void); | 45 | void print_help (void); |
46 | void print_usage (void); | 46 | void print_usage (void); |
47 | 47 | ||
48 | const char *PROGNAME = "check_disk"; | 48 | const char *progname = "check_disk"; |
49 | 49 | ||
50 | int w_df = -1; | 50 | int w_df = -1; |
51 | int c_df = -1; | 51 | int c_df = -1; |
@@ -252,7 +252,7 @@ process_arguments (int argc, char **argv) | |||
252 | exclude_device = optarg; | 252 | exclude_device = optarg; |
253 | break; | 253 | break; |
254 | case 'V': /* version */ | 254 | case 'V': /* version */ |
255 | print_revision (PROGNAME, REVISION); | 255 | print_revision (progname, REVISION); |
256 | exit (STATE_OK); | 256 | exit (STATE_OK); |
257 | case 'h': /* help */ | 257 | case 'h': /* help */ |
258 | print_help (); | 258 | print_help (); |
@@ -323,7 +323,7 @@ check_disk (usp, free_disk) | |||
323 | void | 323 | void |
324 | print_help (void) | 324 | print_help (void) |
325 | { | 325 | { |
326 | print_revision (PROGNAME, REVISION); | 326 | print_revision (progname, REVISION); |
327 | printf | 327 | printf |
328 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | 328 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" |
329 | "This plugin will check the percent of used disk space on a mounted\n" | 329 | "This plugin will check the percent of used disk space on a mounted\n" |
@@ -362,5 +362,5 @@ print_usage (void) | |||
362 | printf | 362 | printf |
363 | ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n" | 363 | ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n" |
364 | " %s (-h|--help)\n" | 364 | " %s (-h|--help)\n" |
365 | " %s (-V|--version)\n", PROGNAME, PROGNAME, PROGNAME); | 365 | " %s (-V|--version)\n", progname, progname, progname); |
366 | } | 366 | } |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 714ecab0..3462701a 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include "popen.h" | 48 | #include "popen.h" |
49 | #include "utils.h" | 49 | #include "utils.h" |
50 | 50 | ||
51 | #define PROGNAME "check_dns" | 51 | const char *progname = "check_dns"; |
52 | #define REVISION "$Revision$" | 52 | #define REVISION "$Revision$" |
53 | #define COPYRIGHT "2000-2002" | 53 | #define COPYRIGHT "2000-2002" |
54 | 54 | ||
@@ -292,14 +292,14 @@ process_arguments (int argc, char **argv) | |||
292 | 292 | ||
293 | switch (c) { | 293 | switch (c) { |
294 | case '?': /* args not parsable */ | 294 | case '?': /* args not parsable */ |
295 | printf ("%s: Unknown argument: %s\n\n", PROGNAME, optarg); | 295 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
296 | print_usage (); | 296 | print_usage (); |
297 | exit (STATE_UNKNOWN); | 297 | exit (STATE_UNKNOWN); |
298 | case 'h': /* help */ | 298 | case 'h': /* help */ |
299 | print_help (); | 299 | print_help (); |
300 | exit (STATE_OK); | 300 | exit (STATE_OK); |
301 | case 'V': /* version */ | 301 | case 'V': /* version */ |
302 | print_revision (PROGNAME, REVISION); | 302 | print_revision (progname, REVISION); |
303 | exit (STATE_OK); | 303 | exit (STATE_OK); |
304 | case 'v': /* version */ | 304 | case 'v': /* version */ |
305 | verbose = TRUE; | 305 | verbose = TRUE; |
@@ -388,13 +388,13 @@ void | |||
388 | print_usage (void) | 388 | print_usage (void) |
389 | { | 389 | { |
390 | printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" " %s --help\n" | 390 | printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" " %s --help\n" |
391 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 391 | " %s --version\n", progname, progname, progname); |
392 | } | 392 | } |
393 | 393 | ||
394 | void | 394 | void |
395 | print_help (void) | 395 | print_help (void) |
396 | { | 396 | { |
397 | print_revision (PROGNAME, REVISION); | 397 | print_revision (progname, REVISION); |
398 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"); | 398 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"); |
399 | print_usage (); | 399 | print_usage (); |
400 | printf | 400 | printf |
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index c2a5b7eb..ca37e98e 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c | |||
@@ -37,8 +37,10 @@ | |||
37 | #include "common.h" | 37 | #include "common.h" |
38 | #include "utils.h" | 38 | #include "utils.h" |
39 | 39 | ||
40 | void print_help (char *); | 40 | const char *progname = "check_dummy"; |
41 | void print_usage (char *); | 41 | |
42 | void print_help (const char *); | ||
43 | void print_usage (const char *); | ||
42 | 44 | ||
43 | int | 45 | int |
44 | main (int argc, char **argv) | 46 | main (int argc, char **argv) |
@@ -82,7 +84,7 @@ main (int argc, char **argv) | |||
82 | } | 84 | } |
83 | 85 | ||
84 | void | 86 | void |
85 | print_help (char *cmd) | 87 | print_help (const char *cmd) |
86 | { | 88 | { |
87 | print_revision (cmd, "$Revision$"); | 89 | print_revision (cmd, "$Revision$"); |
88 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n" | 90 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n" |
@@ -94,7 +96,7 @@ print_help (char *cmd) | |||
94 | } | 96 | } |
95 | 97 | ||
96 | void | 98 | void |
97 | print_usage (char *cmd) | 99 | print_usage (const char *cmd) |
98 | { | 100 | { |
99 | printf ("Usage: %s <integer state>\n", cmd); | 101 | printf ("Usage: %s <integer state>\n", cmd); |
100 | } | 102 | } |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index da11e678..8887afe8 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "popen.h" | 32 | #include "popen.h" |
33 | #include "utils.h" | 33 | #include "utils.h" |
34 | 34 | ||
35 | #define PROGNAME "check_fping" | 35 | const char *progname = "check_fping"; |
36 | #define PACKET_COUNT 1 | 36 | #define PACKET_COUNT 1 |
37 | #define PACKET_SIZE 56 | 37 | #define PACKET_SIZE 56 |
38 | #define UNKNOWN_PACKET_LOSS 200 /* 200% */ | 38 | #define UNKNOWN_PACKET_LOSS 200 /* 200% */ |
@@ -243,14 +243,14 @@ process_arguments (int argc, char **argv) | |||
243 | 243 | ||
244 | switch (c) { | 244 | switch (c) { |
245 | case '?': /* print short usage statement if args not parsable */ | 245 | case '?': /* print short usage statement if args not parsable */ |
246 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 246 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
247 | print_usage (); | 247 | print_usage (); |
248 | exit (STATE_UNKNOWN); | 248 | exit (STATE_UNKNOWN); |
249 | case 'h': /* help */ | 249 | case 'h': /* help */ |
250 | print_help (); | 250 | print_help (); |
251 | exit (STATE_OK); | 251 | exit (STATE_OK); |
252 | case 'V': /* version */ | 252 | case 'V': /* version */ |
253 | print_revision (my_basename (argv[0]), "$Revision$"); | 253 | print_revision (progname, "$Revision$"); |
254 | exit (STATE_OK); | 254 | exit (STATE_OK); |
255 | case 'v': /* verbose mode */ | 255 | case 'v': /* verbose mode */ |
256 | verbose = TRUE; | 256 | verbose = TRUE; |
@@ -325,12 +325,12 @@ get_threshold (char *arg, char *rv[2]) | |||
325 | arg1[strcspn (arg1, ",:")] = 0; | 325 | arg1[strcspn (arg1, ",:")] = 0; |
326 | if (strstr (arg1, "%") && strstr (arg2, "%")) | 326 | if (strstr (arg1, "%") && strstr (arg2, "%")) |
327 | terminate (STATE_UNKNOWN, | 327 | terminate (STATE_UNKNOWN, |
328 | "%s: Only one threshold may be packet loss (%s)\n", PROGNAME, | 328 | "%s: Only one threshold may be packet loss (%s)\n", progname, |
329 | arg); | 329 | arg); |
330 | if (!strstr (arg1, "%") && !strstr (arg2, "%")) | 330 | if (!strstr (arg1, "%") && !strstr (arg2, "%")) |
331 | terminate (STATE_UNKNOWN, | 331 | terminate (STATE_UNKNOWN, |
332 | "%s: Only one threshold must be packet loss (%s)\n", | 332 | "%s: Only one threshold must be packet loss (%s)\n", |
333 | PROGNAME, arg); | 333 | progname, arg); |
334 | } | 334 | } |
335 | 335 | ||
336 | if (arg2 && strstr (arg2, "%")) { | 336 | if (arg2 && strstr (arg2, "%")) { |
@@ -358,7 +358,7 @@ get_threshold (char *arg, char *rv[2]) | |||
358 | void | 358 | void |
359 | print_usage (void) | 359 | print_usage (void) |
360 | { | 360 | { |
361 | printf ("Usage: %s <host_address>\n", PROGNAME); | 361 | printf ("Usage: %s <host_address>\n", progname); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
@@ -369,7 +369,7 @@ void | |||
369 | print_help (void) | 369 | print_help (void) |
370 | { | 370 | { |
371 | 371 | ||
372 | print_revision (PROGNAME, "$Revision$"); | 372 | print_revision (progname, "$Revision$"); |
373 | 373 | ||
374 | printf | 374 | printf |
375 | ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n" | 375 | ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n" |
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 42b4bb54..a262fc23 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -65,7 +65,7 @@ | |||
65 | #include "popen.h" | 65 | #include "popen.h" |
66 | #include "utils.h" | 66 | #include "utils.h" |
67 | 67 | ||
68 | #define PROGNAME "check_hpjd" | 68 | const char *progname = "check_hpjd" |
69 | #define REVISION "$Revision$" | 69 | #define REVISION "$Revision$" |
70 | #define COPYRIGHT "2000-2002" | 70 | #define COPYRIGHT "2000-2002" |
71 | 71 | ||
@@ -438,7 +438,7 @@ process_arguments (int argc, char **argv) | |||
438 | community = optarg; | 438 | community = optarg; |
439 | break; | 439 | break; |
440 | case 'V': /* version */ | 440 | case 'V': /* version */ |
441 | print_revision (PROGNAME, REVISION); | 441 | print_revision (progname, REVISION); |
442 | exit (STATE_OK); | 442 | exit (STATE_OK); |
443 | case 'h': /* help */ | 443 | case 'h': /* help */ |
444 | print_help (); | 444 | print_help (); |
@@ -482,7 +482,7 @@ validate_arguments (void) | |||
482 | void | 482 | void |
483 | print_help (void) | 483 | print_help (void) |
484 | { | 484 | { |
485 | print_revision (PROGNAME, REVISION); | 485 | print_revision (progname, REVISION); |
486 | printf | 486 | printf |
487 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | 487 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" |
488 | "This plugin tests the STATUS of an HP printer with a JetDirect card.\n" | 488 | "This plugin tests the STATUS of an HP printer with a JetDirect card.\n" |
@@ -510,7 +510,7 @@ print_usage (void) | |||
510 | printf | 510 | printf |
511 | ("Usage: %s -H host [-C community]\n" | 511 | ("Usage: %s -H host [-C community]\n" |
512 | " %s --help\n" | 512 | " %s --help\n" |
513 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 513 | " %s --version\n", progname, progname, progname); |
514 | } | 514 | } |
515 | 515 | ||
516 | 516 | ||
diff --git a/plugins/check_http.c b/plugins/check_http.c index bbc76dae..de7a2db7 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_http" | 26 | const char *progname = "check_http"; |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "1999-2001" | 28 | #define COPYRIGHT "1999-2001" |
29 | #define AUTHORS "Ethan Galstad/Karl DeBisschop" | 29 | #define AUTHORS "Ethan Galstad/Karl DeBisschop" |
@@ -328,7 +328,7 @@ process_arguments (int argc, char **argv) | |||
328 | exit (STATE_OK); | 328 | exit (STATE_OK); |
329 | break; | 329 | break; |
330 | case 'V': /* version */ | 330 | case 'V': /* version */ |
331 | print_revision (PROGNAME, REVISION); | 331 | print_revision (progname, REVISION); |
332 | exit (STATE_OK); | 332 | exit (STATE_OK); |
333 | break; | 333 | break; |
334 | case 't': /* timeout period */ | 334 | case 't': /* timeout period */ |
@@ -1058,7 +1058,7 @@ my_close (void) | |||
1058 | void | 1058 | void |
1059 | print_help (void) | 1059 | print_help (void) |
1060 | { | 1060 | { |
1061 | print_revision (PROGNAME, REVISION); | 1061 | print_revision (progname, REVISION); |
1062 | printf | 1062 | printf |
1063 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 1063 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
1064 | COPYRIGHT, AUTHORS, EMAIL, SUMMARY); | 1064 | COPYRIGHT, AUTHORS, EMAIL, SUMMARY); |
@@ -1083,5 +1083,5 @@ print_usage (void) | |||
1083 | " %s -h for detailed help\n" | 1083 | " %s -h for detailed help\n" |
1084 | " %s -V for version information\n", | 1084 | " %s -V for version information\n", |
1085 | #endif | 1085 | #endif |
1086 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 1086 | progname, OPTIONS, progname, progname); |
1087 | } | 1087 | } |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 213dc4a8..6491e5ba 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | *****************************************************************************/ | 21 | *****************************************************************************/ |
22 | 22 | ||
23 | #define PROGNAME "check_ldap" | 23 | const char *progname = "check_ldap"; |
24 | #define REVISION "$Revision$" | 24 | #define REVISION "$Revision$" |
25 | 25 | ||
26 | #include "config.h" | 26 | #include "config.h" |
@@ -35,8 +35,8 @@ | |||
35 | 35 | ||
36 | int process_arguments (int, char **); | 36 | int process_arguments (int, char **); |
37 | int validate_arguments (void); | 37 | int validate_arguments (void); |
38 | static void print_help (void); | 38 | void print_help (void); |
39 | static void print_usage (void); | 39 | void print_usage (void); |
40 | 40 | ||
41 | char ld_defattr[] = "(objectclass=*)"; | 41 | char ld_defattr[] = "(objectclass=*)"; |
42 | char *ld_attr = ld_defattr; | 42 | char *ld_attr = ld_defattr; |
@@ -165,7 +165,7 @@ process_arguments (int argc, char **argv) | |||
165 | print_help (); | 165 | print_help (); |
166 | exit (STATE_OK); | 166 | exit (STATE_OK); |
167 | case 'V': /* version */ | 167 | case 'V': /* version */ |
168 | print_revision (PROGNAME, REVISION); | 168 | print_revision (progname, REVISION); |
169 | exit (STATE_OK); | 169 | exit (STATE_OK); |
170 | case 't': /* timeout period */ | 170 | case 't': /* timeout period */ |
171 | if (!is_intnonneg (optarg)) | 171 | if (!is_intnonneg (optarg)) |
@@ -225,10 +225,10 @@ validate_arguments () | |||
225 | 225 | ||
226 | 226 | ||
227 | /* function print_help */ | 227 | /* function print_help */ |
228 | static void | 228 | void |
229 | print_help () | 229 | print_help () |
230 | { | 230 | { |
231 | print_revision (PROGNAME, REVISION); | 231 | print_revision (progname, REVISION); |
232 | printf | 232 | printf |
233 | ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n" | 233 | ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n" |
234 | "License: GPL\n" "\n"); | 234 | "License: GPL\n" "\n"); |
@@ -248,11 +248,11 @@ print_help () | |||
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | static void | 251 | void |
252 | print_usage () | 252 | print_usage () |
253 | { | 253 | { |
254 | printf | 254 | printf |
255 | ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | 255 | ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" |
256 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | 256 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" |
257 | "(Note: all times are in seconds.)\n", PROGNAME); | 257 | "(Note: all times are in seconds.)\n", progname); |
258 | } | 258 | } |
diff --git a/plugins/check_load.c b/plugins/check_load.c index 5caffbe8..896e356b 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define PROGNAME "check_load" | 47 | const char *progname = "check_load"; |
48 | 48 | ||
49 | int process_arguments (int argc, char **argv); | 49 | int process_arguments (int argc, char **argv); |
50 | int validate_arguments (void); | 50 | int validate_arguments (void); |
@@ -212,7 +212,7 @@ process_arguments (int argc, char **argv) | |||
212 | usage ("Critical threshold must be float or float triplet!\n"); | 212 | usage ("Critical threshold must be float or float triplet!\n"); |
213 | break; | 213 | break; |
214 | case 'V': /* version */ | 214 | case 'V': /* version */ |
215 | print_revision (my_basename (argv[0]), "$Revision$"); | 215 | print_revision (progname, "$Revision$"); |
216 | exit (STATE_OK); | 216 | exit (STATE_OK); |
217 | case 'h': /* help */ | 217 | case 'h': /* help */ |
218 | print_help (); | 218 | print_help (); |
@@ -303,7 +303,7 @@ print_usage (void) | |||
303 | void | 303 | void |
304 | print_help (void) | 304 | print_help (void) |
305 | { | 305 | { |
306 | print_revision (PROGNAME, "$Revision$"); | 306 | print_revision (progname, "$Revision$"); |
307 | printf | 307 | printf |
308 | ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n" | 308 | ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n" |
309 | "Copyright (c) 2000 Karl DeBisschop\n\n" | 309 | "Copyright (c) 2000 Karl DeBisschop\n\n" |
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 80c9b008..e26e2e66 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_mrtg" | 26 | const char *progname = "check_mrtg"; |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | 28 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" |
29 | 29 | ||
@@ -287,7 +287,7 @@ process_arguments (int argc, char **argv) | |||
287 | units_label = optarg; | 287 | units_label = optarg; |
288 | break; | 288 | break; |
289 | case 'V': /* version */ | 289 | case 'V': /* version */ |
290 | print_revision (PROGNAME, REVISION); | 290 | print_revision (progname, REVISION); |
291 | exit (STATE_OK); | 291 | exit (STATE_OK); |
292 | case 'h': /* help */ | 292 | case 'h': /* help */ |
293 | print_help (); | 293 | print_help (); |
@@ -308,7 +308,7 @@ process_arguments (int argc, char **argv) | |||
308 | else | 308 | else |
309 | terminate (STATE_UNKNOWN, | 309 | terminate (STATE_UNKNOWN, |
310 | "%s is not a valid expiration time\nUse '%s -h' for additional help\n", | 310 | "%s is not a valid expiration time\nUse '%s -h' for additional help\n", |
311 | argv[c], PROGNAME); | 311 | argv[c], progname); |
312 | } | 312 | } |
313 | 313 | ||
314 | if (argc > c && strcmp (argv[c], "MAX") == 0) { | 314 | if (argc > c && strcmp (argv[c], "MAX") == 0) { |
@@ -359,7 +359,7 @@ validate_arguments (void) | |||
359 | void | 359 | void |
360 | print_help (void) | 360 | print_help (void) |
361 | { | 361 | { |
362 | print_revision (PROGNAME, REVISION); | 362 | print_revision (progname, REVISION); |
363 | printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY); | 363 | printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY); |
364 | print_usage (); | 364 | print_usage (); |
365 | printf ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n"); | 365 | printf ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n"); |
@@ -377,5 +377,5 @@ print_usage (void) | |||
377 | " %s -h for detailed help\n" | 377 | " %s -h for detailed help\n" |
378 | " %s -V for version information\n", | 378 | " %s -V for version information\n", |
379 | #endif | 379 | #endif |
380 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 380 | progname, OPTIONS, progname, progname); |
381 | } | 381 | } |
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index d33ebd9c..05830026 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include "common.h" | 52 | #include "common.h" |
53 | #include "utils.h" | 53 | #include "utils.h" |
54 | 54 | ||
55 | #define PROGNAME "check_mrtgtraf" | 55 | const char *progname = "check_mrtgtraf"; |
56 | 56 | ||
57 | int process_arguments (int, char **); | 57 | int process_arguments (int, char **); |
58 | int validate_arguments (void); | 58 | int validate_arguments (void); |
@@ -292,7 +292,7 @@ process_arguments (int argc, char **argv) | |||
292 | &outgoing_warning_threshold); | 292 | &outgoing_warning_threshold); |
293 | break; | 293 | break; |
294 | case 'V': /* version */ | 294 | case 'V': /* version */ |
295 | print_revision (PROGNAME, "$Revision$"); | 295 | print_revision (progname, "$Revision$"); |
296 | exit (STATE_OK); | 296 | exit (STATE_OK); |
297 | case 'h': /* help */ | 297 | case 'h': /* help */ |
298 | print_help (); | 298 | print_help (); |
@@ -356,7 +356,7 @@ validate_arguments (void) | |||
356 | void | 356 | void |
357 | print_help (void) | 357 | print_help (void) |
358 | { | 358 | { |
359 | print_revision (PROGNAME, "$Revision$"); | 359 | print_revision (progname, "$Revision$"); |
360 | printf | 360 | printf |
361 | ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n" | 361 | ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n" |
362 | "This plugin tests the UPS service on the specified host.\n\n"); | 362 | "This plugin tests the UPS service on the specified host.\n\n"); |
@@ -390,5 +390,5 @@ print_usage (void) | |||
390 | ("Usage: %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n" | 390 | ("Usage: %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n" |
391 | " [-e expire_minutes] [-t timeout] [-v]\n" | 391 | " [-e expire_minutes] [-t timeout] [-v]\n" |
392 | " %s --help\n" | 392 | " %s --help\n" |
393 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 393 | " %s --version\n", progname, progname, progname); |
394 | } | 394 | } |
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index a4a2ed1d..df2ed002 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * This plugin is for testing a mysql server. | 14 | * This plugin is for testing a mysql server. |
15 | ******************************************************************************/ | 15 | ******************************************************************************/ |
16 | 16 | ||
17 | #define PROGNAME "check_mysql" | 17 | const char *progname = "check_mysql" |
18 | #define REVISION "$Revision$" | 18 | #define REVISION "$Revision$" |
19 | #define COPYRIGHT "1999-2002" | 19 | #define COPYRIGHT "1999-2002" |
20 | 20 | ||
@@ -178,7 +178,7 @@ process_arguments (int argc, char **argv) | |||
178 | db_port = atoi (optarg); | 178 | db_port = atoi (optarg); |
179 | break; | 179 | break; |
180 | case 'V': /* version */ | 180 | case 'V': /* version */ |
181 | print_revision (PROGNAME, REVISION); | 181 | print_revision (progname, REVISION); |
182 | exit (STATE_OK); | 182 | exit (STATE_OK); |
183 | case 'h': /* help */ | 183 | case 'h': /* help */ |
184 | print_help (); | 184 | print_help (); |
@@ -230,7 +230,7 @@ validate_arguments (void) | |||
230 | void | 230 | void |
231 | print_help (void) | 231 | print_help (void) |
232 | { | 232 | { |
233 | print_revision (PROGNAME, REVISION); | 233 | print_revision (progname, REVISION); |
234 | printf | 234 | printf |
235 | ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n" | 235 | ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n" |
236 | "This plugin is for testing a mysql server.\n"); | 236 | "This plugin is for testing a mysql server.\n"); |
@@ -267,5 +267,5 @@ print_usage (void) | |||
267 | printf | 267 | printf |
268 | ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n" | 268 | ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n" |
269 | " %s --help\n" | 269 | " %s --help\n" |
270 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 270 | " %s --version\n", progname, progname, progname); |
271 | } | 271 | } |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index d19445a5..5c4cd4a3 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "popen.h" | 30 | #include "popen.h" |
31 | #include "utils.h" | 31 | #include "utils.h" |
32 | 32 | ||
33 | const char *PROGNAME = "check_nagios"; | 33 | const char *progname = "check_nagios"; |
34 | 34 | ||
35 | int process_arguments (int, char **); | 35 | int process_arguments (int, char **); |
36 | void print_usage (void); | 36 | void print_usage (void); |
@@ -166,7 +166,7 @@ process_arguments (int argc, char **argv) | |||
166 | else | 166 | else |
167 | terminate (STATE_UNKNOWN, | 167 | terminate (STATE_UNKNOWN, |
168 | "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n", | 168 | "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n", |
169 | PROGNAME); | 169 | progname); |
170 | process_string = argv[3]; | 170 | process_string = argv[3]; |
171 | return OK; | 171 | return OK; |
172 | } | 172 | } |
@@ -183,14 +183,14 @@ process_arguments (int argc, char **argv) | |||
183 | 183 | ||
184 | switch (c) { | 184 | switch (c) { |
185 | case '?': /* print short usage statement if args not parsable */ | 185 | case '?': /* print short usage statement if args not parsable */ |
186 | printf ("%s: Unknown argument: %c\n\n", PROGNAME, optopt); | 186 | printf ("%s: Unknown argument: %c\n\n", progname, optopt); |
187 | print_usage (); | 187 | print_usage (); |
188 | exit (STATE_UNKNOWN); | 188 | exit (STATE_UNKNOWN); |
189 | case 'h': /* help */ | 189 | case 'h': /* help */ |
190 | print_help (); | 190 | print_help (); |
191 | exit (STATE_OK); | 191 | exit (STATE_OK); |
192 | case 'V': /* version */ | 192 | case 'V': /* version */ |
193 | print_revision (PROGNAME, "$Revision$"); | 193 | print_revision (progname, "$Revision$"); |
194 | exit (STATE_OK); | 194 | exit (STATE_OK); |
195 | case 'F': /* hostname */ | 195 | case 'F': /* hostname */ |
196 | status_log = optarg; | 196 | status_log = optarg; |
@@ -204,7 +204,7 @@ process_arguments (int argc, char **argv) | |||
204 | else | 204 | else |
205 | terminate (STATE_UNKNOWN, | 205 | terminate (STATE_UNKNOWN, |
206 | "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n", | 206 | "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n", |
207 | PROGNAME); | 207 | progname); |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | } | 210 | } |
@@ -213,11 +213,11 @@ process_arguments (int argc, char **argv) | |||
213 | if (status_log == NULL) | 213 | if (status_log == NULL) |
214 | terminate (STATE_UNKNOWN, | 214 | terminate (STATE_UNKNOWN, |
215 | "You must provide the status_log\nType '%s -h' for additional help\n", | 215 | "You must provide the status_log\nType '%s -h' for additional help\n", |
216 | PROGNAME); | 216 | progname); |
217 | else if (process_string == NULL) | 217 | else if (process_string == NULL) |
218 | terminate (STATE_UNKNOWN, | 218 | terminate (STATE_UNKNOWN, |
219 | "You must provide a process string\nType '%s -h' for additional help\n", | 219 | "You must provide a process string\nType '%s -h' for additional help\n", |
220 | PROGNAME); | 220 | progname); |
221 | 221 | ||
222 | return OK; | 222 | return OK; |
223 | } | 223 | } |
@@ -231,7 +231,7 @@ print_usage (void) | |||
231 | { | 231 | { |
232 | printf | 232 | printf |
233 | ("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n", | 233 | ("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n", |
234 | PROGNAME); | 234 | progname); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
@@ -241,7 +241,7 @@ print_usage (void) | |||
241 | void | 241 | void |
242 | print_help (void) | 242 | print_help (void) |
243 | { | 243 | { |
244 | print_revision (PROGNAME, "$Revision$"); | 244 | print_revision (progname, "$Revision$"); |
245 | printf | 245 | printf |
246 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | 246 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" |
247 | "This plugin attempts to check the status of the Nagios process on the local\n" | 247 | "This plugin attempts to check the status of the Nagios process on the local\n" |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 53deef87..2f7ecc10 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_nwstat" | 26 | const char *progname = "check_nwstat"; |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" | 28 | #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad" |
29 | 29 | ||
@@ -128,8 +128,6 @@ int check_netware_version=FALSE; | |||
128 | unsigned long vars_to_check=CHECK_NONE; | 128 | unsigned long vars_to_check=CHECK_NONE; |
129 | int sap_number=-1; | 129 | int sap_number=-1; |
130 | 130 | ||
131 | #define PROGNAME "check_nwstat" | ||
132 | |||
133 | int process_arguments(int, char **); | 131 | int process_arguments(int, char **); |
134 | void print_usage(void); | 132 | void print_usage(void); |
135 | void print_help(void); | 133 | void print_help(void); |
@@ -674,14 +672,14 @@ int process_arguments(int argc, char **argv){ | |||
674 | switch (c) | 672 | switch (c) |
675 | { | 673 | { |
676 | case '?': /* print short usage statement if args not parsable */ | 674 | case '?': /* print short usage statement if args not parsable */ |
677 | printf("%s: Unknown argument: %s\n\n",my_basename(argv[0]),optarg); | 675 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
678 | print_usage(); | 676 | print_usage(); |
679 | exit(STATE_UNKNOWN); | 677 | exit(STATE_UNKNOWN); |
680 | case 'h': /* help */ | 678 | case 'h': /* help */ |
681 | print_help(); | 679 | print_help(); |
682 | exit(STATE_OK); | 680 | exit(STATE_OK); |
683 | case 'V': /* version */ | 681 | case 'V': /* version */ |
684 | print_revision(my_basename(argv[0]),"$Revision$"); | 682 | print_revision(progname,"$Revision$"); |
685 | exit(STATE_OK); | 683 | exit(STATE_OK); |
686 | case 'H': /* hostname */ | 684 | case 'H': /* hostname */ |
687 | server_address=optarg; | 685 | server_address=optarg; |
@@ -693,7 +691,7 @@ int process_arguments(int argc, char **argv){ | |||
693 | if (is_intnonneg(optarg)) | 691 | if (is_intnonneg(optarg)) |
694 | server_port=atoi(optarg); | 692 | server_port=atoi(optarg); |
695 | else | 693 | else |
696 | terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",PROGNAME); | 694 | terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname); |
697 | break; | 695 | break; |
698 | case 'v': | 696 | case 'v': |
699 | if(strlen(optarg)<3) | 697 | if(strlen(optarg)<3) |
@@ -806,12 +804,12 @@ void print_usage(void) | |||
806 | " %s -h for detailed help\n" | 804 | " %s -h for detailed help\n" |
807 | " %s -V for version information\n", | 805 | " %s -V for version information\n", |
808 | #endif | 806 | #endif |
809 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 807 | progname, OPTIONS, progname, progname); |
810 | } | 808 | } |
811 | 809 | ||
812 | void print_help(void) | 810 | void print_help(void) |
813 | { | 811 | { |
814 | print_revision (PROGNAME, REVISION); | 812 | print_revision (progname, REVISION); |
815 | printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY); | 813 | printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY); |
816 | print_usage(); | 814 | print_usage(); |
817 | printf | 815 | printf |
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 305a8242..2ff37a48 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #define PORT 2000 | 59 | #define PORT 2000 |
60 | 60 | ||
61 | #define PROGNAME "check_overcr" | 61 | const char *progname = "check_overcr"; |
62 | 62 | ||
63 | char *server_address = NULL; | 63 | char *server_address = NULL; |
64 | int server_port = PORT; | 64 | int server_port = PORT; |
@@ -367,14 +367,14 @@ process_arguments (int argc, char **argv) | |||
367 | 367 | ||
368 | switch (c) { | 368 | switch (c) { |
369 | case '?': /* print short usage statement if args not parsable */ | 369 | case '?': /* print short usage statement if args not parsable */ |
370 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 370 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
371 | print_usage (); | 371 | print_usage (); |
372 | exit (STATE_UNKNOWN); | 372 | exit (STATE_UNKNOWN); |
373 | case 'h': /* help */ | 373 | case 'h': /* help */ |
374 | print_help (); | 374 | print_help (); |
375 | exit (STATE_OK); | 375 | exit (STATE_OK); |
376 | case 'V': /* version */ | 376 | case 'V': /* version */ |
377 | print_revision (my_basename (argv[0]), "$Revision$"); | 377 | print_revision (progname, "$Revision$"); |
378 | exit (STATE_OK); | 378 | exit (STATE_OK); |
379 | case 'H': /* hostname */ | 379 | case 'H': /* hostname */ |
380 | server_address = optarg; | 380 | server_address = optarg; |
@@ -385,7 +385,7 @@ process_arguments (int argc, char **argv) | |||
385 | else | 385 | else |
386 | terminate (STATE_UNKNOWN, | 386 | terminate (STATE_UNKNOWN, |
387 | "Server port an integer (seconds)\nType '%s -h' for additional help\n", | 387 | "Server port an integer (seconds)\nType '%s -h' for additional help\n", |
388 | PROGNAME); | 388 | progname); |
389 | break; | 389 | break; |
390 | case 'v': /* variable */ | 390 | case 'v': /* variable */ |
391 | if (strcmp (optarg, "LOAD1") == 0) | 391 | if (strcmp (optarg, "LOAD1") == 0) |
@@ -438,7 +438,7 @@ print_usage (void) | |||
438 | { | 438 | { |
439 | printf | 439 | printf |
440 | ("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n", | 440 | ("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n", |
441 | PROGNAME); | 441 | progname); |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
@@ -448,7 +448,7 @@ print_usage (void) | |||
448 | void | 448 | void |
449 | print_help (void) | 449 | print_help (void) |
450 | { | 450 | { |
451 | print_revision (PROGNAME, "$Revision$"); | 451 | print_revision (progname, "$Revision$"); |
452 | printf | 452 | printf |
453 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | 453 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" |
454 | "This plugin attempts to contact the Over-CR collector daemon running on the\n" | 454 | "This plugin attempts to contact the Over-CR collector daemon running on the\n" |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 98c504fa..4c8662ba 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_pgsql" | 26 | const char *progname = "check_pgsql" |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "1999-2001" | 28 | #define COPYRIGHT "1999-2001" |
29 | #define AUTHOR "Karl DeBisschop" | 29 | #define AUTHOR "Karl DeBisschop" |
@@ -122,7 +122,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
122 | <manvolnum>5<manvolnum> | 122 | <manvolnum>5<manvolnum> |
123 | </refmeta> | 123 | </refmeta> |
124 | <refnamdiv> | 124 | <refnamdiv> |
125 | <refname>&PROGNAME;</refname> | 125 | <refname>&progname;</refname> |
126 | <refpurpose>&SUMMARY;</refpurpose> | 126 | <refpurpose>&SUMMARY;</refpurpose> |
127 | </refnamdiv> | 127 | </refnamdiv> |
128 | </refentry> | 128 | </refentry> |
@@ -218,7 +218,7 @@ main (int argc, char **argv) | |||
218 | void | 218 | void |
219 | print_help (void) | 219 | print_help (void) |
220 | { | 220 | { |
221 | print_revision (PROGNAME, REVISION); | 221 | print_revision (progname, REVISION); |
222 | printf | 222 | printf |
223 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 223 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
224 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 224 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
@@ -235,7 +235,7 @@ print_usage (void) | |||
235 | printf ("Usage:\n" " %s %s\n" | 235 | printf ("Usage:\n" " %s %s\n" |
236 | " %s (-h | --help) for detailed help\n" | 236 | " %s (-h | --help) for detailed help\n" |
237 | " %s (-V | --version) for version information\n", | 237 | " %s (-V | --version) for version information\n", |
238 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 238 | progname, OPTIONS, progname, progname); |
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
@@ -281,7 +281,7 @@ process_arguments (int argc, char **argv) | |||
281 | print_help (); | 281 | print_help (); |
282 | exit (STATE_OK); | 282 | exit (STATE_OK); |
283 | case 'V': /* version */ | 283 | case 'V': /* version */ |
284 | print_revision (PROGNAME, REVISION); | 284 | print_revision (progname, REVISION); |
285 | exit (STATE_OK); | 285 | exit (STATE_OK); |
286 | case 't': /* timeout period */ | 286 | case 't': /* timeout period */ |
287 | if (!is_integer (optarg)) | 287 | if (!is_integer (optarg)) |
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 3602122c..0c0f2e44 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | *****************************************************************************/ | 11 | *****************************************************************************/ |
12 | 12 | ||
13 | #define PROGNAME "check_ping" | 13 | const char *progname = "check_ping"; |
14 | #define REVISION "$Revision$" | 14 | #define REVISION "$Revision$" |
15 | #define COPYRIGHT "1999-2001" | 15 | #define COPYRIGHT "1999-2001" |
16 | #define AUTHOR "Ethan Galstad/Karl DeBisschop" | 16 | #define AUTHOR "Ethan Galstad/Karl DeBisschop" |
@@ -189,7 +189,7 @@ process_arguments (int argc, char **argv) | |||
189 | print_help (); | 189 | print_help (); |
190 | exit (STATE_OK); | 190 | exit (STATE_OK); |
191 | case 'V': /* version */ | 191 | case 'V': /* version */ |
192 | print_revision (PROGNAME, REVISION); | 192 | print_revision (progname, REVISION); |
193 | exit (STATE_OK); | 193 | exit (STATE_OK); |
194 | case 't': /* timeout period */ | 194 | case 't': /* timeout period */ |
195 | timeout_interval = atoi (optarg); | 195 | timeout_interval = atoi (optarg); |
@@ -482,13 +482,13 @@ print_usage (void) | |||
482 | " %s -h for detailed help\n" | 482 | " %s -h for detailed help\n" |
483 | " %s -V for version information\n", | 483 | " %s -V for version information\n", |
484 | #endif | 484 | #endif |
485 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 485 | progname, OPTIONS, progname, progname); |
486 | } | 486 | } |
487 | 487 | ||
488 | void | 488 | void |
489 | print_help (void) | 489 | print_help (void) |
490 | { | 490 | { |
491 | print_revision (PROGNAME, REVISION); | 491 | print_revision (progname, REVISION); |
492 | printf | 492 | printf |
493 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 493 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
494 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 494 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 967b4de7..3849c776 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * | 34 | * |
35 | ******************************************************************************/ | 35 | ******************************************************************************/ |
36 | 36 | ||
37 | #define PROGNAME "check_snmp" | 37 | const char *progname = "check_snmp"; |
38 | #define REVISION "$Revision$" | 38 | #define REVISION "$Revision$" |
39 | #define COPYRIGHT "1999-2002" | 39 | #define COPYRIGHT "1999-2002" |
40 | #define AUTHOR "Ethan Galstad" | 40 | #define AUTHOR "Ethan Galstad" |
@@ -298,12 +298,12 @@ process_arguments (int argc, char **argv) | |||
298 | print_help (); | 298 | print_help (); |
299 | exit (STATE_OK); | 299 | exit (STATE_OK); |
300 | case 'V': /* version */ | 300 | case 'V': /* version */ |
301 | print_revision (PROGNAME, REVISION); | 301 | print_revision (progname, REVISION); |
302 | exit (STATE_OK); | 302 | exit (STATE_OK); |
303 | case 't': /* timeout period */ | 303 | case 't': /* timeout period */ |
304 | if (!is_integer (optarg)) { | 304 | if (!is_integer (optarg)) { |
305 | printf ("%s: Timeout Interval must be an integer!\n\n", | 305 | printf ("%s: Timeout Interval must be an integer!\n\n", |
306 | my_basename (argv[0])); | 306 | progname); |
307 | print_usage (); | 307 | print_usage (); |
308 | exit (STATE_UNKNOWN); | 308 | exit (STATE_UNKNOWN); |
309 | } | 309 | } |
@@ -325,7 +325,7 @@ process_arguments (int argc, char **argv) | |||
325 | } | 325 | } |
326 | else { | 326 | else { |
327 | printf ("%s: Critical Process Count must be an integer!\n\n", | 327 | printf ("%s: Critical Process Count must be an integer!\n\n", |
328 | my_basename (argv[0])); | 328 | progname); |
329 | print_usage (); | 329 | print_usage (); |
330 | exit (STATE_UNKNOWN); | 330 | exit (STATE_UNKNOWN); |
331 | } | 331 | } |
@@ -345,7 +345,7 @@ process_arguments (int argc, char **argv) | |||
345 | } | 345 | } |
346 | else { | 346 | else { |
347 | printf ("%s: Warning Process Count must be an integer!\n\n", | 347 | printf ("%s: Warning Process Count must be an integer!\n\n", |
348 | my_basename (argv[0])); | 348 | progname); |
349 | print_usage (); | 349 | print_usage (); |
350 | exit (STATE_UNKNOWN); | 350 | exit (STATE_UNKNOWN); |
351 | } | 351 | } |
@@ -356,7 +356,7 @@ process_arguments (int argc, char **argv) | |||
356 | break; | 356 | break; |
357 | } | 357 | } |
358 | printf ("%s: Parent Process ID must be an integer!\n\n", | 358 | printf ("%s: Parent Process ID must be an integer!\n\n", |
359 | my_basename (argv[0])); | 359 | progname); |
360 | print_usage (); | 360 | print_usage (); |
361 | exit (STATE_UNKNOWN); | 361 | exit (STATE_UNKNOWN); |
362 | case 's': /* status */ | 362 | case 's': /* status */ |
@@ -462,7 +462,7 @@ if (wmax >= 0 && wmin == -1) | |||
462 | void | 462 | void |
463 | print_help (void) | 463 | print_help (void) |
464 | { | 464 | { |
465 | print_revision (PROGNAME, REVISION); | 465 | print_revision (progname, REVISION); |
466 | printf | 466 | printf |
467 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 467 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
468 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 468 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index c346dc77..0762896b 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_radius" | 26 | const char *progname = "check_radius" |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "1999-2001" | 28 | #define COPYRIGHT "1999-2001" |
29 | #define AUTHORS "Robert August Vincent II/Karl DeBisschop" | 29 | #define AUTHORS "Robert August Vincent II/Karl DeBisschop" |
@@ -112,7 +112,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
112 | <manvolnum>5<manvolnum> | 112 | <manvolnum>5<manvolnum> |
113 | </refmeta> | 113 | </refmeta> |
114 | <refnamdiv> | 114 | <refnamdiv> |
115 | <refname>&PROGNAME;</refname> | 115 | <refname>&progname;</refname> |
116 | <refpurpose>&SUMMARY;</refpurpose> | 116 | <refpurpose>&SUMMARY;</refpurpose> |
117 | </refnamdiv> | 117 | </refnamdiv> |
118 | </refentry> | 118 | </refentry> |
@@ -264,14 +264,14 @@ process_arguments (int argc, char **argv) | |||
264 | 264 | ||
265 | switch (c) { | 265 | switch (c) { |
266 | case '?': /* print short usage statement if args not parsable */ | 266 | case '?': /* print short usage statement if args not parsable */ |
267 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 267 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
268 | print_usage (); | 268 | print_usage (); |
269 | exit (STATE_UNKNOWN); | 269 | exit (STATE_UNKNOWN); |
270 | case 'h': /* help */ | 270 | case 'h': /* help */ |
271 | print_help (); | 271 | print_help (); |
272 | exit (OK); | 272 | exit (OK); |
273 | case 'V': /* version */ | 273 | case 'V': /* version */ |
274 | print_revision (my_basename (argv[0]), "$Revision$"); | 274 | print_revision (progname, "$Revision$"); |
275 | exit (OK); | 275 | exit (OK); |
276 | case 'v': /* verbose mode */ | 276 | case 'v': /* verbose mode */ |
277 | verbose = TRUE; | 277 | verbose = TRUE; |
@@ -324,7 +324,7 @@ process_arguments (int argc, char **argv) | |||
324 | void | 324 | void |
325 | print_help (void) | 325 | print_help (void) |
326 | { | 326 | { |
327 | print_revision (PROGNAME, REVISION); | 327 | print_revision (progname, REVISION); |
328 | printf | 328 | printf |
329 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 329 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
330 | COPYRIGHT, AUTHORS, EMAIL, SUMMARY); | 330 | COPYRIGHT, AUTHORS, EMAIL, SUMMARY); |
@@ -347,5 +347,5 @@ print_usage (void) | |||
347 | " %s -h for detailed help\n" | 347 | " %s -h for detailed help\n" |
348 | " %s -V for version information\n", | 348 | " %s -V for version information\n", |
349 | #endif | 349 | #endif |
350 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 350 | progname, OPTIONS, progname, progname); |
351 | } | 351 | } |
diff --git a/plugins/check_real.c b/plugins/check_real.c index c553352c..a9109373 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include "netutils.h" | 48 | #include "netutils.h" |
49 | #include "utils.h" | 49 | #include "utils.h" |
50 | 50 | ||
51 | #define PROGNAME "check_real" | 51 | const char *progname = "check_real"; |
52 | 52 | ||
53 | #define PORT 554 | 53 | #define PORT 554 |
54 | #define EXPECT "RTSP/1." | 54 | #define EXPECT "RTSP/1." |
@@ -370,7 +370,7 @@ process_arguments (int argc, char **argv) | |||
370 | } | 370 | } |
371 | break; | 371 | break; |
372 | case 'V': /* version */ | 372 | case 'V': /* version */ |
373 | print_revision (PROGNAME, "$Revision$"); | 373 | print_revision (progname, "$Revision$"); |
374 | exit (STATE_OK); | 374 | exit (STATE_OK); |
375 | case 'h': /* help */ | 375 | case 'h': /* help */ |
376 | print_help (); | 376 | print_help (); |
@@ -410,7 +410,7 @@ validate_arguments (void) | |||
410 | void | 410 | void |
411 | print_help (void) | 411 | print_help (void) |
412 | { | 412 | { |
413 | print_revision (PROGNAME, "$Revision$"); | 413 | print_revision (progname, "$Revision$"); |
414 | printf | 414 | printf |
415 | ("Copyright (c) 2000 Pedro Leite (leite@cic.ua.pt)/Karl DeBisschop\n\n" | 415 | ("Copyright (c) 2000 Pedro Leite (leite@cic.ua.pt)/Karl DeBisschop\n\n" |
416 | "This plugin tests the REAL service on the specified host.\n\n"); | 416 | "This plugin tests the REAL service on the specified host.\n\n"); |
@@ -454,7 +454,7 @@ print_usage (void) | |||
454 | ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n" | 454 | ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n" |
455 | " [-t timeout] [-v]\n" | 455 | " [-t timeout] [-v]\n" |
456 | " %s --help\n" | 456 | " %s --help\n" |
457 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 457 | " %s --version\n", progname, progname, progname); |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 6f174299..d8b90597 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "netutils.h" | 39 | #include "netutils.h" |
40 | #include "utils.h" | 40 | #include "utils.h" |
41 | 41 | ||
42 | #define PROGNAME "check_smtp" | 42 | const char *progname = "check_smtp"; |
43 | 43 | ||
44 | #define SMTP_PORT 25 | 44 | #define SMTP_PORT 25 |
45 | #define SMTP_EXPECT "220" | 45 | #define SMTP_EXPECT "220" |
@@ -294,7 +294,7 @@ process_arguments (int argc, char **argv) | |||
294 | } | 294 | } |
295 | break; | 295 | break; |
296 | case 'V': /* version */ | 296 | case 'V': /* version */ |
297 | print_revision (PROGNAME, "$Revision$"); | 297 | print_revision (progname, "$Revision$"); |
298 | exit (STATE_OK); | 298 | exit (STATE_OK); |
299 | case 'h': /* help */ | 299 | case 'h': /* help */ |
300 | print_help (); | 300 | print_help (); |
@@ -340,7 +340,7 @@ validate_arguments (void) | |||
340 | void | 340 | void |
341 | print_help (void) | 341 | print_help (void) |
342 | { | 342 | { |
343 | print_revision (PROGNAME, "$Revision$"); | 343 | print_revision (progname, "$Revision$"); |
344 | printf | 344 | printf |
345 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" | 345 | ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n" |
346 | "This plugin test the SMTP service on the specified host.\n\n"); | 346 | "This plugin test the SMTP service on the specified host.\n\n"); |
@@ -381,5 +381,5 @@ print_usage (void) | |||
381 | printf | 381 | printf |
382 | ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n" | 382 | ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n" |
383 | " %s --help\n" | 383 | " %s --help\n" |
384 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 384 | " %s --version\n", progname, progname, progname); |
385 | } | 385 | } |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index cb13bc9a..b0059845 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "check_snmp" | 26 | const char *progname = "check_snmp"; |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "1999-2002" | 28 | #define COPYRIGHT "1999-2002" |
29 | #define AUTHOR "Ethan Galstad" | 29 | #define AUTHOR "Ethan Galstad" |
@@ -475,7 +475,7 @@ process_arguments (int argc, char **argv) | |||
475 | print_help (); | 475 | print_help (); |
476 | exit (STATE_OK); | 476 | exit (STATE_OK); |
477 | case 'V': /* version */ | 477 | case 'V': /* version */ |
478 | print_revision (PROGNAME, REVISION); | 478 | print_revision (progname, REVISION); |
479 | exit (STATE_OK); | 479 | exit (STATE_OK); |
480 | case 'v': /* verbose */ | 480 | case 'v': /* verbose */ |
481 | verbose = TRUE; | 481 | verbose = TRUE; |
@@ -753,10 +753,9 @@ validate_arguments () | |||
753 | void | 753 | void |
754 | print_help (void) | 754 | print_help (void) |
755 | { | 755 | { |
756 | print_revision (PROGNAME, REVISION); | 756 | print_revision (progname, REVISION); |
757 | printf | 757 | printf |
758 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 758 | ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
759 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | ||
760 | print_usage (); | 759 | print_usage (); |
761 | printf | 760 | printf |
762 | ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n" NOTES "\n", | 761 | ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n" NOTES "\n", |
@@ -771,7 +770,7 @@ print_usage (void) | |||
771 | ("Usage:\n" " %s %s\n" | 770 | ("Usage:\n" " %s %s\n" |
772 | " %s (-h | --help) for detailed help\n" | 771 | " %s (-h | --help) for detailed help\n" |
773 | " %s (-V | --version) for version information\n", | 772 | " %s (-V | --version) for version information\n", |
774 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 773 | progname, OPTIONS, progname, progname); |
775 | } | 774 | } |
776 | 775 | ||
777 | 776 | ||
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 4637bcee..faaead6a 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include "netutils.h" | 15 | #include "netutils.h" |
16 | #include "utils.h" | 16 | #include "utils.h" |
17 | 17 | ||
18 | #define PROGNAME "check_ssh" | 18 | const char *progname = "check_ssh"; |
19 | #define REVISION "$Revision$" | 19 | #define REVISION "$Revision$" |
20 | 20 | ||
21 | #ifndef MSG_DONTWAIT | 21 | #ifndef MSG_DONTWAIT |
@@ -95,7 +95,7 @@ process_arguments (int argc, char **argv) | |||
95 | case '?': /* help */ | 95 | case '?': /* help */ |
96 | usage (""); | 96 | usage (""); |
97 | case 'V': /* version */ | 97 | case 'V': /* version */ |
98 | print_revision (PROGNAME, REVISION); | 98 | print_revision (progname, REVISION); |
99 | exit (STATE_OK); | 99 | exit (STATE_OK); |
100 | case 'h': /* help */ | 100 | case 'h': /* help */ |
101 | print_help (); | 101 | print_help (); |
@@ -238,7 +238,7 @@ ssh_connect (char *haddr, short hport) | |||
238 | void | 238 | void |
239 | print_help (void) | 239 | print_help (void) |
240 | { | 240 | { |
241 | print_revision (PROGNAME, REVISION); | 241 | print_revision (progname, REVISION); |
242 | printf ("Copyright (c) 1999 Remi Paulmier (remi@sinfomic.fr)\n\n"); | 242 | printf ("Copyright (c) 1999 Remi Paulmier (remi@sinfomic.fr)\n\n"); |
243 | print_usage (); | 243 | print_usage (); |
244 | printf ("by default, port is %d\n", SSH_DFL_PORT); | 244 | printf ("by default, port is %d\n", SSH_DFL_PORT); |
@@ -251,7 +251,7 @@ print_usage (void) | |||
251 | ("Usage:\n" | 251 | ("Usage:\n" |
252 | " %s -t [timeout] -p [port] <host>\n" | 252 | " %s -t [timeout] -p [port] <host>\n" |
253 | " %s -V prints version info\n" | 253 | " %s -V prints version info\n" |
254 | " %s -h prints more detailed help\n", PROGNAME, PROGNAME, PROGNAME); | 254 | " %s -h prints more detailed help\n", progname, progname, progname); |
255 | } | 255 | } |
256 | 256 | ||
257 | /* end of check_ssh.c */ | 257 | /* end of check_ssh.c */ |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 968779dc..b213c964 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "popen.h" | 29 | #include "popen.h" |
30 | #include "utils.h" | 30 | #include "utils.h" |
31 | 31 | ||
32 | #define PROGNAME "check_swap" | 32 | const char *progname = "check_swap"; |
33 | #define REVISION "$Revision$" | 33 | #define REVISION "$Revision$" |
34 | #define COPYRIGHT "2000-2002" | 34 | #define COPYRIGHT "2000-2002" |
35 | #define AUTHOR "Karl DeBisschop" | 35 | #define AUTHOR "Karl DeBisschop" |
@@ -267,7 +267,7 @@ process_arguments (int argc, char **argv) | |||
267 | verbose = TRUE; | 267 | verbose = TRUE; |
268 | break; | 268 | break; |
269 | case 'V': /* version */ | 269 | case 'V': /* version */ |
270 | print_revision (my_basename (argv[0]), "$Revision$"); | 270 | print_revision (progname, "$Revision$"); |
271 | exit (STATE_OK); | 271 | exit (STATE_OK); |
272 | case 'h': /* help */ | 272 | case 'h': /* help */ |
273 | print_help (); | 273 | print_help (); |
@@ -336,7 +336,7 @@ print_usage (void) | |||
336 | " %s [-a] -w <bytes_free> -c <bytes_free>\n" | 336 | " %s [-a] -w <bytes_free> -c <bytes_free>\n" |
337 | " %s (-h | --help) for detailed help\n" | 337 | " %s (-h | --help) for detailed help\n" |
338 | " %s (-V | --version) for version information\n", | 338 | " %s (-V | --version) for version information\n", |
339 | PROGNAME, PROGNAME, PROGNAME, PROGNAME); | 339 | progname, progname, progname, progname); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
@@ -346,7 +346,7 @@ print_usage (void) | |||
346 | void | 346 | void |
347 | print_help (void) | 347 | print_help (void) |
348 | { | 348 | { |
349 | print_revision (PROGNAME, REVISION); | 349 | print_revision (progname, REVISION); |
350 | printf | 350 | printf |
351 | ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 351 | ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
352 | print_usage (); | 352 | print_usage (); |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 32d38b42..43580b6c 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
24 | 24 | ||
25 | #define PROGRAM check_tcp | 25 | /* const char *progname = "check_tcp"; */ |
26 | #define REVISION "$Revision$" | 26 | #define REVISION "$Revision$" |
27 | #define DESCRIPTION "Check a TCP port" | 27 | #define DESCRIPTION "Check a TCP port" |
28 | #define AUTHOR "Ethan Galstad" | 28 | #define AUTHOR "Ethan Galstad" |
@@ -65,7 +65,7 @@ int process_arguments (int, char **); | |||
65 | void print_usage (void); | 65 | void print_usage (void); |
66 | void print_help (void); | 66 | void print_help (void); |
67 | 67 | ||
68 | char *PROGNAME = NULL; | 68 | char *progname = NULL; |
69 | char *SERVICE = NULL; | 69 | char *SERVICE = NULL; |
70 | char *SEND = NULL; | 70 | char *SEND = NULL; |
71 | char *EXPECT = NULL; | 71 | char *EXPECT = NULL; |
@@ -103,7 +103,7 @@ main (int argc, char **argv) | |||
103 | struct timeval tv; | 103 | struct timeval tv; |
104 | 104 | ||
105 | if (strstr (argv[0], "check_udp")) { | 105 | if (strstr (argv[0], "check_udp")) { |
106 | asprintf (&PROGNAME, "check_udp"); | 106 | asprintf (&progname, "check_udp"); |
107 | asprintf (&SERVICE, "UDP"); | 107 | asprintf (&SERVICE, "UDP"); |
108 | SEND = NULL; | 108 | SEND = NULL; |
109 | EXPECT = NULL; | 109 | EXPECT = NULL; |
@@ -112,7 +112,7 @@ main (int argc, char **argv) | |||
112 | PORT = 0; | 112 | PORT = 0; |
113 | } | 113 | } |
114 | else if (strstr (argv[0], "check_tcp")) { | 114 | else if (strstr (argv[0], "check_tcp")) { |
115 | asprintf (&PROGNAME, "check_tcp"); | 115 | asprintf (&progname, "check_tcp"); |
116 | asprintf (&SERVICE, "TCP"); | 116 | asprintf (&SERVICE, "TCP"); |
117 | SEND = NULL; | 117 | SEND = NULL; |
118 | EXPECT = NULL; | 118 | EXPECT = NULL; |
@@ -121,7 +121,7 @@ main (int argc, char **argv) | |||
121 | PORT = 0; | 121 | PORT = 0; |
122 | } | 122 | } |
123 | else if (strstr (argv[0], "check_ftp")) { | 123 | else if (strstr (argv[0], "check_ftp")) { |
124 | asprintf (&PROGNAME, "check_ftp"); | 124 | asprintf (&progname, "check_ftp"); |
125 | asprintf (&SERVICE, "FTP"); | 125 | asprintf (&SERVICE, "FTP"); |
126 | SEND = NULL; | 126 | SEND = NULL; |
127 | asprintf (&EXPECT, "220"); | 127 | asprintf (&EXPECT, "220"); |
@@ -130,7 +130,7 @@ main (int argc, char **argv) | |||
130 | PORT = 21; | 130 | PORT = 21; |
131 | } | 131 | } |
132 | else if (strstr (argv[0], "check_smtp")) { | 132 | else if (strstr (argv[0], "check_smtp")) { |
133 | asprintf (&PROGNAME, "check_smtp"); | 133 | asprintf (&progname, "check_smtp"); |
134 | asprintf (&SERVICE, "SMTP"); | 134 | asprintf (&SERVICE, "SMTP"); |
135 | SEND = NULL; | 135 | SEND = NULL; |
136 | asprintf (&EXPECT, "220"); | 136 | asprintf (&EXPECT, "220"); |
@@ -139,7 +139,7 @@ main (int argc, char **argv) | |||
139 | PORT = 25; | 139 | PORT = 25; |
140 | } | 140 | } |
141 | else if (strstr (argv[0], "check_pop")) { | 141 | else if (strstr (argv[0], "check_pop")) { |
142 | asprintf (&PROGNAME, "check_pop"); | 142 | asprintf (&progname, "check_pop"); |
143 | asprintf (&SERVICE, "POP"); | 143 | asprintf (&SERVICE, "POP"); |
144 | SEND = NULL; | 144 | SEND = NULL; |
145 | asprintf (&EXPECT, "+OK"); | 145 | asprintf (&EXPECT, "+OK"); |
@@ -148,7 +148,7 @@ main (int argc, char **argv) | |||
148 | PORT = 110; | 148 | PORT = 110; |
149 | } | 149 | } |
150 | else if (strstr (argv[0], "check_imap")) { | 150 | else if (strstr (argv[0], "check_imap")) { |
151 | asprintf (&PROGNAME, "check_imap"); | 151 | asprintf (&progname, "check_imap"); |
152 | asprintf (&SERVICE, "IMAP"); | 152 | asprintf (&SERVICE, "IMAP"); |
153 | SEND = NULL; | 153 | SEND = NULL; |
154 | asprintf (&EXPECT, "* OK"); | 154 | asprintf (&EXPECT, "* OK"); |
@@ -158,7 +158,7 @@ main (int argc, char **argv) | |||
158 | } | 158 | } |
159 | #ifdef HAVE_SSL | 159 | #ifdef HAVE_SSL |
160 | else if (strstr(argv[0],"check_simap")) { | 160 | else if (strstr(argv[0],"check_simap")) { |
161 | asprintf (&PROGNAME, "check_simap"); | 161 | asprintf (&progname, "check_simap"); |
162 | asprintf (&SERVICE, "SIMAP"); | 162 | asprintf (&SERVICE, "SIMAP"); |
163 | SEND=NULL; | 163 | SEND=NULL; |
164 | asprintf (&EXPECT, "* OK"); | 164 | asprintf (&EXPECT, "* OK"); |
@@ -168,7 +168,7 @@ main (int argc, char **argv) | |||
168 | PORT=993; | 168 | PORT=993; |
169 | } | 169 | } |
170 | else if (strstr(argv[0],"check_spop")) { | 170 | else if (strstr(argv[0],"check_spop")) { |
171 | asprintf (&PROGNAME, "check_spop"); | 171 | asprintf (&progname, "check_spop"); |
172 | asprintf (&SERVICE, "SPOP"); | 172 | asprintf (&SERVICE, "SPOP"); |
173 | SEND=NULL; | 173 | SEND=NULL; |
174 | asprintf (&EXPECT, "+OK"); | 174 | asprintf (&EXPECT, "+OK"); |
@@ -179,7 +179,7 @@ main (int argc, char **argv) | |||
179 | } | 179 | } |
180 | #endif | 180 | #endif |
181 | else if (strstr (argv[0], "check_nntp")) { | 181 | else if (strstr (argv[0], "check_nntp")) { |
182 | asprintf (&PROGNAME, "check_nntp"); | 182 | asprintf (&progname, "check_nntp"); |
183 | asprintf (&SERVICE, "NNTP"); | 183 | asprintf (&SERVICE, "NNTP"); |
184 | SEND = NULL; | 184 | SEND = NULL; |
185 | EXPECT = NULL; | 185 | EXPECT = NULL; |
@@ -387,21 +387,21 @@ process_arguments (int argc, char **argv) | |||
387 | 387 | ||
388 | switch (c) { | 388 | switch (c) { |
389 | case '?': /* print short usage statement if args not parsable */ | 389 | case '?': /* print short usage statement if args not parsable */ |
390 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 390 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
391 | print_usage (); | 391 | print_usage (); |
392 | exit (STATE_UNKNOWN); | 392 | exit (STATE_UNKNOWN); |
393 | case 'h': /* help */ | 393 | case 'h': /* help */ |
394 | print_help (); | 394 | print_help (); |
395 | exit (STATE_OK); | 395 | exit (STATE_OK); |
396 | case 'V': /* version */ | 396 | case 'V': /* version */ |
397 | print_revision (PROGNAME, "$Revision$"); | 397 | print_revision (progname, "$Revision$"); |
398 | exit (STATE_OK); | 398 | exit (STATE_OK); |
399 | case 'v': /* verbose mode */ | 399 | case 'v': /* verbose mode */ |
400 | verbose = TRUE; | 400 | verbose = TRUE; |
401 | break; | 401 | break; |
402 | case 'H': /* hostname */ | 402 | case 'H': /* hostname */ |
403 | if (is_host (optarg) == FALSE) | 403 | if (is_host (optarg) == FALSE) |
404 | usage ("Invalid host name/address\n"); | 404 | usage2 ("invalid host name or address", optarg); |
405 | server_address = optarg; | 405 | server_address = optarg; |
406 | break; | 406 | break; |
407 | case 'c': /* critical */ | 407 | case 'c': /* critical */ |
@@ -479,7 +479,7 @@ print_usage (void) | |||
479 | { | 479 | { |
480 | printf | 480 | printf |
481 | ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n" | 481 | ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n" |
482 | " [-e expect] [-W wait] [-t to_sec] [-v]\n", PROGNAME); | 482 | " [-e expect] [-W wait] [-t to_sec] [-v]\n", progname); |
483 | } | 483 | } |
484 | 484 | ||
485 | 485 | ||
@@ -489,7 +489,7 @@ print_usage (void) | |||
489 | void | 489 | void |
490 | print_help (void) | 490 | print_help (void) |
491 | { | 491 | { |
492 | print_revision (PROGNAME, "$Revision$"); | 492 | print_revision (progname, "$Revision$"); |
493 | printf | 493 | printf |
494 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" | 494 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" |
495 | "This plugin tests %s connections with the specified host.\n\n", | 495 | "This plugin tests %s connections with the specified host.\n\n", |
diff --git a/plugins/check_time.c b/plugins/check_time.c index c7405f61..e4bd26d7 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "netutils.h" | 39 | #include "netutils.h" |
40 | #include "utils.h" | 40 | #include "utils.h" |
41 | 41 | ||
42 | #define PROGNAME "check_time" | 42 | const char *progname = "check_time"; |
43 | #define REVISION "$Revision$" | 43 | #define REVISION "$Revision$" |
44 | #define COPYRIGHT "1999-2002" | 44 | #define COPYRIGHT "1999-2002" |
45 | #define AUTHOR "Ethan Galstad" | 45 | #define AUTHOR "Ethan Galstad" |
@@ -209,7 +209,7 @@ process_arguments (int argc, char **argv) | |||
209 | print_help (); | 209 | print_help (); |
210 | exit (STATE_OK); | 210 | exit (STATE_OK); |
211 | case 'V': /* version */ | 211 | case 'V': /* version */ |
212 | print_revision (PROGNAME, REVISION); | 212 | print_revision (progname, REVISION); |
213 | exit (STATE_OK); | 213 | exit (STATE_OK); |
214 | case 'H': /* hostname */ | 214 | case 'H': /* hostname */ |
215 | if (is_host (optarg) == FALSE) | 215 | if (is_host (optarg) == FALSE) |
@@ -306,7 +306,7 @@ print_usage (void) | |||
306 | " [-W connect_time] [-C connect_time] [-t timeout]\n" | 306 | " [-W connect_time] [-C connect_time] [-t timeout]\n" |
307 | " %s (-h | --help) for detailed help\n" | 307 | " %s (-h | --help) for detailed help\n" |
308 | " %s (-V | --version) for version information\n", | 308 | " %s (-V | --version) for version information\n", |
309 | PROGNAME, PROGNAME, PROGNAME); | 309 | progname, progname, progname); |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
@@ -316,7 +316,7 @@ print_usage (void) | |||
316 | void | 316 | void |
317 | print_help (void) | 317 | print_help (void) |
318 | { | 318 | { |
319 | print_revision (PROGNAME, REVISION); | 319 | print_revision (progname, REVISION); |
320 | printf | 320 | printf |
321 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 321 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
322 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 322 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
diff --git a/plugins/check_udp.c b/plugins/check_udp.c index f6b528dc..8626f8c4 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "netutils.h" | 41 | #include "netutils.h" |
42 | #include "utils.h" | 42 | #include "utils.h" |
43 | 43 | ||
44 | #define PROGNAME "check_udp" | 44 | const char *progname = "check_udp"; |
45 | 45 | ||
46 | int warning_time = 0; | 46 | int warning_time = 0; |
47 | int check_warning_time = FALSE; | 47 | int check_warning_time = FALSE; |
@@ -163,14 +163,14 @@ process_arguments (int argc, char **argv) | |||
163 | 163 | ||
164 | switch (c) { | 164 | switch (c) { |
165 | case '?': /* print short usage statement if args not parsable */ | 165 | case '?': /* print short usage statement if args not parsable */ |
166 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 166 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
167 | print_usage (); | 167 | print_usage (); |
168 | exit (STATE_UNKNOWN); | 168 | exit (STATE_UNKNOWN); |
169 | case 'h': /* help */ | 169 | case 'h': /* help */ |
170 | print_help (); | 170 | print_help (); |
171 | exit (STATE_OK); | 171 | exit (STATE_OK); |
172 | case 'V': /* version */ | 172 | case 'V': /* version */ |
173 | print_revision (my_basename (argv[0]), "$Revision$"); | 173 | print_revision (progname, "$Revision$"); |
174 | exit (STATE_OK); | 174 | exit (STATE_OK); |
175 | case 'v': /* verbose mode */ | 175 | case 'v': /* verbose mode */ |
176 | verbose = TRUE; | 176 | verbose = TRUE; |
@@ -233,7 +233,7 @@ print_usage (void) | |||
233 | { | 233 | { |
234 | printf | 234 | printf |
235 | ("Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n" | 235 | ("Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n" |
236 | " [-e expect] [-s send] [-t to_sec] [-v]\n", PROGNAME); | 236 | " [-e expect] [-s send] [-t to_sec] [-v]\n", progname); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
@@ -243,7 +243,7 @@ print_usage (void) | |||
243 | void | 243 | void |
244 | print_help (void) | 244 | print_help (void) |
245 | { | 245 | { |
246 | print_revision (PROGNAME, "$Revision$"); | 246 | print_revision (progname, "$Revision$"); |
247 | printf | 247 | printf |
248 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" | 248 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" |
249 | "This plugin tests an UDP connection with the specified host.\n\n"); | 249 | "This plugin tests an UDP connection with the specified host.\n\n"); |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 470e3be7..4c903226 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include "netutils.h" | 56 | #include "netutils.h" |
57 | #include "utils.h" | 57 | #include "utils.h" |
58 | 58 | ||
59 | #define PROGNAME "check_ups" | 59 | const char *progname = "check_ups"; |
60 | #define REVISION "$Revision$" | 60 | #define REVISION "$Revision$" |
61 | #define COPYRIGHT "1999-2002" | 61 | #define COPYRIGHT "1999-2002" |
62 | #define AUTHOR "Ethan Galstad" | 62 | #define AUTHOR "Ethan Galstad" |
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | #define CHECK_NONE 0 | 65 | #define CHECK_NONE 0 |
66 | 66 | ||
67 | #define PORT 3305 | 67 | #define PORT 3493 |
68 | 68 | ||
69 | #define UPS_NONE 0 /* no supported options */ | 69 | #define UPS_NONE 0 /* no supported options */ |
70 | #define UPS_UTILITY 1 /* supports utility line voltage */ | 70 | #define UPS_UTILITY 1 /* supports utility line voltage */ |
@@ -535,7 +535,7 @@ process_arguments (int argc, char **argv) | |||
535 | } | 535 | } |
536 | break; | 536 | break; |
537 | case 'V': /* version */ | 537 | case 'V': /* version */ |
538 | print_revision (PROGNAME, "$Revision$"); | 538 | print_revision (progname, "$Revision$"); |
539 | exit (STATE_OK); | 539 | exit (STATE_OK); |
540 | case 'h': /* help */ | 540 | case 'h': /* help */ |
541 | print_help (); | 541 | print_help (); |
@@ -571,7 +571,7 @@ validate_arguments (void) | |||
571 | void | 571 | void |
572 | print_help (void) | 572 | print_help (void) |
573 | { | 573 | { |
574 | print_revision (PROGNAME, "$Revision$"); | 574 | print_revision (progname, "$Revision$"); |
575 | printf | 575 | printf |
576 | ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n" | 576 | ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n" |
577 | "This plugin tests the UPS service on the specified host.\n" | 577 | "This plugin tests the UPS service on the specified host.\n" |
@@ -611,5 +611,5 @@ print_usage (void) | |||
611 | ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n" | 611 | ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n" |
612 | " [-t timeout] [-v]\n" | 612 | " [-t timeout] [-v]\n" |
613 | " %s --help\n" | 613 | " %s --help\n" |
614 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | 614 | " %s --version\n", progname, progname, progname); |
615 | } | 615 | } |
diff --git a/plugins/check_users.c b/plugins/check_users.c index e39e0d2b..565d9e70 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include "popen.h" | 48 | #include "popen.h" |
49 | #include "utils.h" | 49 | #include "utils.h" |
50 | 50 | ||
51 | #define PROGNAME "check_users" | 51 | const char *progname = "check_users"; |
52 | #define REVISION "$Revision$" | 52 | #define REVISION "$Revision$" |
53 | #define COPYRIGHT "1999-2002" | 53 | #define COPYRIGHT "1999-2002" |
54 | #define AUTHOR "Ethan Galstad" | 54 | #define AUTHOR "Ethan Galstad" |
@@ -162,14 +162,14 @@ process_arguments (int argc, char **argv) | |||
162 | 162 | ||
163 | switch (c) { | 163 | switch (c) { |
164 | case '?': /* print short usage statement if args not parsable */ | 164 | case '?': /* print short usage statement if args not parsable */ |
165 | printf ("%s: Unknown argument: %s\n\n", PROGNAME, optarg); | 165 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
166 | print_usage (); | 166 | print_usage (); |
167 | exit (STATE_UNKNOWN); | 167 | exit (STATE_UNKNOWN); |
168 | case 'h': /* help */ | 168 | case 'h': /* help */ |
169 | print_help (); | 169 | print_help (); |
170 | exit (STATE_OK); | 170 | exit (STATE_OK); |
171 | case 'V': /* version */ | 171 | case 'V': /* version */ |
172 | print_revision (PROGNAME, REVISION); | 172 | print_revision (progname, REVISION); |
173 | exit (STATE_OK); | 173 | exit (STATE_OK); |
174 | case 'c': /* critical */ | 174 | case 'c': /* critical */ |
175 | if (!is_intnonneg (optarg)) | 175 | if (!is_intnonneg (optarg)) |
@@ -207,7 +207,7 @@ process_arguments (int argc, char **argv) | |||
207 | void | 207 | void |
208 | print_usage (void) | 208 | print_usage (void) |
209 | { | 209 | { |
210 | printf ("Usage: %s -w <users> -c <users>\n", PROGNAME); | 210 | printf ("Usage: %s -w <users> -c <users>\n", progname); |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
@@ -217,7 +217,7 @@ print_usage (void) | |||
217 | void | 217 | void |
218 | print_help (void) | 218 | print_help (void) |
219 | { | 219 | { |
220 | print_revision (PROGNAME, REVISION); | 220 | print_revision (progname, REVISION); |
221 | printf | 221 | printf |
222 | ("Copyright (c) " COPYRIGHT " " AUTHOR "(" EMAIL ")\n\n" | 222 | ("Copyright (c) " COPYRIGHT " " AUTHOR "(" EMAIL ")\n\n" |
223 | "This plugin checks the number of users currently logged in on the local\n" | 223 | "This plugin checks the number of users currently logged in on the local\n" |
diff --git a/plugins/check_vsz.c b/plugins/check_vsz.c index 7eeab22c..767abf4f 100644 --- a/plugins/check_vsz.c +++ b/plugins/check_vsz.c | |||
@@ -33,7 +33,7 @@ | |||
33 | * | 33 | * |
34 | *****************************************************************************/ | 34 | *****************************************************************************/ |
35 | 35 | ||
36 | #define PROGNAME "check_vsz" | 36 | const char *progname = "check_vsz"; |
37 | #define REVISION "$Revision$" | 37 | #define REVISION "$Revision$" |
38 | #define COPYRIGHT "1999-2002" | 38 | #define COPYRIGHT "1999-2002" |
39 | #define AUTHOR "Karl DeBisschop" | 39 | #define AUTHOR "Karl DeBisschop" |
@@ -45,8 +45,8 @@ | |||
45 | #include "utils.h" | 45 | #include "utils.h" |
46 | 46 | ||
47 | int process_arguments (int argc, char **argv); | 47 | int process_arguments (int argc, char **argv); |
48 | void print_help (char *cmd); | 48 | void print_help (const char *cmd); |
49 | void print_usage (char *cmd); | 49 | void print_usage (const char *cmd); |
50 | 50 | ||
51 | int warn = -1; | 51 | int warn = -1; |
52 | int crit = -1; | 52 | int crit = -1; |
@@ -64,8 +64,8 @@ main (int argc, char **argv) | |||
64 | char *message = ""; | 64 | char *message = ""; |
65 | 65 | ||
66 | if (!process_arguments (argc, argv)) { | 66 | if (!process_arguments (argc, argv)) { |
67 | printf ("%s: failure parsing arguments\n", my_basename (argv[0])); | 67 | printf ("%s: failure parsing arguments\n", progname); |
68 | print_help (my_basename (argv[0])); | 68 | print_help (progname); |
69 | return STATE_UNKNOWN; | 69 | return STATE_UNKNOWN; |
70 | } | 70 | } |
71 | 71 | ||
@@ -166,20 +166,20 @@ process_arguments (int argc, char **argv) | |||
166 | 166 | ||
167 | switch (c) { | 167 | switch (c) { |
168 | case '?': /* help */ | 168 | case '?': /* help */ |
169 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 169 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
170 | print_usage (my_basename (argv[0])); | 170 | print_usage (progname); |
171 | exit (STATE_UNKNOWN); | 171 | exit (STATE_UNKNOWN); |
172 | case 'h': /* help */ | 172 | case 'h': /* help */ |
173 | print_help (my_basename (argv[0])); | 173 | print_help (progname); |
174 | exit (STATE_OK); | 174 | exit (STATE_OK); |
175 | case 'V': /* version */ | 175 | case 'V': /* version */ |
176 | print_revision (my_basename (argv[0]), "$Revision$"); | 176 | print_revision (progname, "$Revision$"); |
177 | exit (STATE_OK); | 177 | exit (STATE_OK); |
178 | case 'c': /* critical threshold */ | 178 | case 'c': /* critical threshold */ |
179 | if (!is_intnonneg (optarg)) { | 179 | if (!is_intnonneg (optarg)) { |
180 | printf ("%s: critical threshold must be an integer: %s\n", | 180 | printf ("%s: critical threshold must be an integer: %s\n", |
181 | my_basename (argv[0]), optarg); | 181 | progname, optarg); |
182 | print_usage (my_basename (argv[0])); | 182 | print_usage (progname); |
183 | exit (STATE_UNKNOWN); | 183 | exit (STATE_UNKNOWN); |
184 | } | 184 | } |
185 | crit = atoi (optarg); | 185 | crit = atoi (optarg); |
@@ -187,8 +187,8 @@ process_arguments (int argc, char **argv) | |||
187 | case 'w': /* warning threshold */ | 187 | case 'w': /* warning threshold */ |
188 | if (!is_intnonneg (optarg)) { | 188 | if (!is_intnonneg (optarg)) { |
189 | printf ("%s: warning threshold must be an integer: %s\n", | 189 | printf ("%s: warning threshold must be an integer: %s\n", |
190 | my_basename (argv[0]), optarg); | 190 | progname, optarg); |
191 | print_usage (my_basename (argv[0])); | 191 | print_usage (progname); |
192 | exit (STATE_UNKNOWN); | 192 | exit (STATE_UNKNOWN); |
193 | } | 193 | } |
194 | warn = atoi (optarg); | 194 | warn = atoi (optarg); |
@@ -203,8 +203,8 @@ process_arguments (int argc, char **argv) | |||
203 | if (warn == -1) { | 203 | if (warn == -1) { |
204 | if (!is_intnonneg (argv[c])) { | 204 | if (!is_intnonneg (argv[c])) { |
205 | printf ("%s: critical threshold must be an integer: %s\n", | 205 | printf ("%s: critical threshold must be an integer: %s\n", |
206 | PROGNAME, argv[c]); | 206 | progname, argv[c]); |
207 | print_usage (PROGNAME); | 207 | print_usage (progname); |
208 | exit (STATE_UNKNOWN); | 208 | exit (STATE_UNKNOWN); |
209 | } | 209 | } |
210 | warn = atoi (argv[c++]); | 210 | warn = atoi (argv[c++]); |
@@ -213,8 +213,8 @@ process_arguments (int argc, char **argv) | |||
213 | if (crit == -1) { | 213 | if (crit == -1) { |
214 | if (!is_intnonneg (argv[c])) { | 214 | if (!is_intnonneg (argv[c])) { |
215 | printf ("%s: critical threshold must be an integer: %s\n", | 215 | printf ("%s: critical threshold must be an integer: %s\n", |
216 | PROGNAME, argv[c]); | 216 | progname, argv[c]); |
217 | print_usage (PROGNAME); | 217 | print_usage (progname); |
218 | exit (STATE_UNKNOWN); | 218 | exit (STATE_UNKNOWN); |
219 | } | 219 | } |
220 | crit = atoi (argv[c++]); | 220 | crit = atoi (argv[c++]); |
@@ -227,14 +227,14 @@ process_arguments (int argc, char **argv) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | void | 229 | void |
230 | print_usage (char *cmd) | 230 | print_usage (const char *cmd) |
231 | { | 231 | { |
232 | printf ("Usage: %s -w <wsize> -c <csize> [-C command]\n" | 232 | printf ("Usage: %s -w <wsize> -c <csize> [-C command]\n" |
233 | " %s --help\n" " %s --version\n", cmd, cmd, cmd); | 233 | " %s --help\n" " %s --version\n", cmd, cmd, cmd); |
234 | } | 234 | } |
235 | 235 | ||
236 | void | 236 | void |
237 | print_help (char *cmd) | 237 | print_help (const char *cmd) |
238 | { | 238 | { |
239 | print_revision ("check_vsz", "$Revision$"); | 239 | print_revision ("check_vsz", "$Revision$"); |
240 | printf | 240 | printf |
diff --git a/plugins/negate.c b/plugins/negate.c index c76f5ca0..454ac963 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | #define PROGNAME "negate" | 26 | const char *progname = "negate"; |
27 | #define REVISION "$Revision$" | 27 | #define REVISION "$Revision$" |
28 | #define COPYRIGHT "2002" | 28 | #define COPYRIGHT "2002" |
29 | #define AUTHOR "Karl DeBisschop" | 29 | #define AUTHOR "Karl DeBisschop" |
@@ -52,10 +52,10 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n" | |||
52 | 52 | ||
53 | char *command_line; | 53 | char *command_line; |
54 | 54 | ||
55 | static int process_arguments (int, char **); | 55 | int process_arguments (int, char **); |
56 | static int validate_arguments (void); | 56 | int validate_arguments (void); |
57 | static void print_usage (void); | 57 | void print_usage (void); |
58 | static void print_help (void); | 58 | void print_help (void); |
59 | 59 | ||
60 | /****************************************************************************** | 60 | /****************************************************************************** |
61 | 61 | ||
@@ -76,7 +76,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
76 | <manvolnum>5<manvolnum> | 76 | <manvolnum>5<manvolnum> |
77 | </refmeta> | 77 | </refmeta> |
78 | <refnamdiv> | 78 | <refnamdiv> |
79 | <refname>&PROGNAME;</refname> | 79 | <refname>&progname;</refname> |
80 | <refpurpose>&SUMMARY;</refpurpose> | 80 | <refpurpose>&SUMMARY;</refpurpose> |
81 | </refnamdiv> | 81 | </refnamdiv> |
82 | </refentry> | 82 | </refentry> |
@@ -174,7 +174,7 @@ main (int argc, char **argv) | |||
174 | void | 174 | void |
175 | print_help (void) | 175 | print_help (void) |
176 | { | 176 | { |
177 | print_revision (PROGNAME, REVISION); | 177 | print_revision (progname, REVISION); |
178 | printf | 178 | printf |
179 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 179 | ("Copyright (c) %s %s <%s>\n\n%s\n", |
180 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 180 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); |
@@ -196,7 +196,7 @@ print_usage (void) | |||
196 | " %s -h for detailed help\n" | 196 | " %s -h for detailed help\n" |
197 | " %s -V for version information\n", | 197 | " %s -V for version information\n", |
198 | #endif | 198 | #endif |
199 | PROGNAME, OPTIONS, PROGNAME, PROGNAME); | 199 | progname, OPTIONS, progname, progname); |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
@@ -249,7 +249,7 @@ process_arguments (int argc, char **argv) | |||
249 | print_help (); | 249 | print_help (); |
250 | exit (EXIT_SUCCESS); | 250 | exit (EXIT_SUCCESS); |
251 | case 'V': /* version */ | 251 | case 'V': /* version */ |
252 | print_revision (PROGNAME, REVISION); | 252 | print_revision (progname, REVISION); |
253 | exit (EXIT_SUCCESS); | 253 | exit (EXIT_SUCCESS); |
254 | case 't': /* timeout period */ | 254 | case 't': /* timeout period */ |
255 | if (!is_integer (optarg)) | 255 | if (!is_integer (optarg)) |
diff --git a/plugins/urlize.c b/plugins/urlize.c index 9835c824..8d6fc3ad 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c | |||
@@ -37,12 +37,14 @@ | |||
37 | * | 37 | * |
38 | *****************************************************************************/ | 38 | *****************************************************************************/ |
39 | 39 | ||
40 | const char *progname = "urlize"; | ||
41 | |||
40 | #include "common.h" | 42 | #include "common.h" |
41 | #include "utils.h" | 43 | #include "utils.h" |
42 | #include "popen.h" | 44 | #include "popen.h" |
43 | 45 | ||
44 | void print_usage (char *); | 46 | void print_usage (const char *); |
45 | void print_help (char *); | 47 | void print_help (const char *); |
46 | 48 | ||
47 | int | 49 | int |
48 | main (int argc, char **argv) | 50 | main (int argc, char **argv) |
@@ -52,7 +54,7 @@ main (int argc, char **argv) | |||
52 | char input_buffer[MAX_INPUT_BUFFER]; | 54 | char input_buffer[MAX_INPUT_BUFFER]; |
53 | 55 | ||
54 | if (argc < 2) { | 56 | if (argc < 2) { |
55 | print_usage (my_basename (argv[0])); | 57 | print_usage (progname); |
56 | exit (STATE_UNKNOWN); | 58 | exit (STATE_UNKNOWN); |
57 | } | 59 | } |
58 | 60 | ||
@@ -62,12 +64,12 @@ main (int argc, char **argv) | |||
62 | } | 64 | } |
63 | 65 | ||
64 | if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) { | 66 | if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) { |
65 | print_revision (my_basename (argv[0]), "$Revision$"); | 67 | print_revision (progname, "$Revision$"); |
66 | exit (STATE_OK); | 68 | exit (STATE_OK); |
67 | } | 69 | } |
68 | 70 | ||
69 | if (argc < 2) { | 71 | if (argc < 2) { |
70 | print_usage (my_basename (argv[0])); | 72 | print_usage (progname); |
71 | exit (STATE_UNKNOWN); | 73 | exit (STATE_UNKNOWN); |
72 | } | 74 | } |
73 | 75 | ||
@@ -120,16 +122,15 @@ main (int argc, char **argv) | |||
120 | } | 122 | } |
121 | 123 | ||
122 | void | 124 | void |
123 | print_usage (char *cmd) | 125 | print_usage (const char *cmd) |
124 | { | 126 | { |
125 | printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n", | 127 | printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n", cmd); |
126 | my_basename (cmd)); | ||
127 | } | 128 | } |
128 | 129 | ||
129 | void | 130 | void |
130 | print_help (char *cmd) | 131 | print_help (const char *cmd) |
131 | { | 132 | { |
132 | print_revision ("urlize", "$Revision$"); | 133 | print_revision (progname, "$Revision$"); |
133 | printf | 134 | printf |
134 | ("Copyright (c) 2000 Karl DeBisschop (kdebiss@alum.mit.edu)\n\n" | 135 | ("Copyright (c) 2000 Karl DeBisschop (kdebiss@alum.mit.edu)\n\n" |
135 | "\nThis plugin wraps the text output of another command (plugin) in HTML\n" | 136 | "\nThis plugin wraps the text output of another command (plugin) in HTML\n" |
diff --git a/plugins/utils.c b/plugins/utils.c index 22020d72..474206b9 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -18,11 +18,11 @@ | |||
18 | #include <limits.h> | 18 | #include <limits.h> |
19 | 19 | ||
20 | extern int timeout_interval; | 20 | extern int timeout_interval; |
21 | extern const char *progname; | ||
21 | 22 | ||
22 | char *my_basename (char *); | ||
23 | void support (void); | 23 | void support (void); |
24 | char *clean_revstring (const char *); | 24 | char *clean_revstring (const char *); |
25 | void print_revision (char *, const char *); | 25 | void print_revision (const char *, const char *); |
26 | void terminate (int, const char *fmt, ...); | 26 | void terminate (int, const char *fmt, ...); |
27 | RETSIGTYPE timeout_alarm_handler (int); | 27 | RETSIGTYPE timeout_alarm_handler (int); |
28 | 28 | ||
@@ -57,8 +57,6 @@ char *strpcat (char *dest, const char *src, const char *str); | |||
57 | #define STRLEN 64 | 57 | #define STRLEN 64 |
58 | #define TXTBLK 128 | 58 | #define TXTBLK 128 |
59 | 59 | ||
60 | #define max(a,b) ((a)>(b))?(a):(b) | ||
61 | |||
62 | /* ************************************************************************** | 60 | /* ************************************************************************** |
63 | * max_state(STATE_x, STATE_y) | 61 | * max_state(STATE_x, STATE_y) |
64 | * compares STATE_x to STATE_y and returns result based on the following | 62 | * compares STATE_x to STATE_y and returns result based on the following |
@@ -68,7 +66,7 @@ char *strpcat (char *dest, const char *src, const char *str); | |||
68 | ****************************************************************************/ | 66 | ****************************************************************************/ |
69 | 67 | ||
70 | int | 68 | int |
71 | max_state(int a, int b) | 69 | max_state (int a, int b) |
72 | { | 70 | { |
73 | if (a == STATE_CRITICAL || b == STATE_CRITICAL) | 71 | if (a == STATE_CRITICAL || b == STATE_CRITICAL) |
74 | return STATE_CRITICAL; | 72 | return STATE_CRITICAL; |
@@ -84,13 +82,26 @@ max_state(int a, int b) | |||
84 | return max (a, b); | 82 | return max (a, b); |
85 | } | 83 | } |
86 | 84 | ||
87 | char * | 85 | void usage (char *msg) |
88 | my_basename (char *path) | ||
89 | { | 86 | { |
90 | if (!strstr (path, "/")) | 87 | printf (msg); |
91 | return path; | 88 | print_usage (); |
92 | else | 89 | exit (STATE_UNKNOWN); |
93 | return 1 + strrchr (path, '/'); | 90 | } |
91 | |||
92 | void usage2(char *msg, char *arg) | ||
93 | { | ||
94 | printf ("%s: %s - %s\n",progname,msg,arg); | ||
95 | print_usage (); | ||
96 | exit (STATE_UNKNOWN); | ||
97 | } | ||
98 | |||
99 | void | ||
100 | usage3 (char *msg, char arg) | ||
101 | { | ||
102 | printf ("%s: %s - %c\n", progname, msg, arg); | ||
103 | print_usage(); | ||
104 | exit (STATE_UNKNOWN); | ||
94 | } | 105 | } |
95 | 106 | ||
96 | 107 | ||
@@ -115,14 +126,14 @@ clean_revstring (const char *revstring) | |||
115 | } | 126 | } |
116 | 127 | ||
117 | void | 128 | void |
118 | print_revision (char *command_name, const char *revision_string) | 129 | print_revision (const char *command_name, const char *revision_string) |
119 | { | 130 | { |
120 | char plugin_revision[STRLEN]; | 131 | char plugin_revision[STRLEN]; |
121 | 132 | ||
122 | if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1) | 133 | if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1) |
123 | strncpy (plugin_revision, "N/A", STRLEN); | 134 | strncpy (plugin_revision, "N/A", STRLEN); |
124 | printf ("%s (nagios-plugins %s) %s\n", | 135 | printf ("%s (nagios-plugins %s) %s\n", |
125 | my_basename (command_name), VERSION, plugin_revision); | 136 | progname, VERSION, plugin_revision); |
126 | printf | 137 | printf |
127 | ("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n" | 138 | ("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n" |
128 | "copies of the plugins under the terms of the GNU General Public License.\n" | 139 | "copies of the plugins under the terms of the GNU General Public License.\n" |
diff --git a/plugins/utils.h.in b/plugins/utils.h.in index 96bf9b2f..317ec46f 100644 --- a/plugins/utils.h.in +++ b/plugins/utils.h.in | |||
@@ -16,7 +16,7 @@ suite of plugins. */ | |||
16 | char *my_basename (char *); | 16 | char *my_basename (char *); |
17 | void support (void); | 17 | void support (void); |
18 | char *clean_revstring (const char *revstring); | 18 | char *clean_revstring (const char *revstring); |
19 | void print_revision (char *, const char *); | 19 | void print_revision (const char *, const char *); |
20 | void terminate (int result, char *msg, ...); | 20 | void terminate (int result, char *msg, ...); |
21 | extern RETSIGTYPE timeout_alarm_handler (int); | 21 | extern RETSIGTYPE timeout_alarm_handler (int); |
22 | 22 | ||
@@ -69,28 +69,14 @@ char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */ | |||
69 | char *strpcpy (char *dest, const char *src, const char *str); | 69 | char *strpcpy (char *dest, const char *src, const char *str); |
70 | char *strpcat (char *dest, const char *src, const char *str); | 70 | char *strpcat (char *dest, const char *src, const char *str); |
71 | 71 | ||
72 | /* Handle comparisions for STATE_* */ | 72 | int max_state (int a, int b); |
73 | int max_state(int, int); | ||
74 | 73 | ||
75 | #define max(a,b) ((a)>(b))?(a):(b) | 74 | void usage (char *msg); |
75 | void usage2(char *msg, char *arg); | ||
76 | void usage3(char *msg, char arg); | ||
76 | 77 | ||
77 | #define usage(msg) {\ | ||
78 | printf(msg);\ | ||
79 | print_usage();\ | ||
80 | exit(STATE_UNKNOWN);\ | ||
81 | } | ||
82 | 78 | ||
83 | #define usage2(msg,arg) {\ | 79 | #define max(a,b) (((a)>(b))?(a):(b)) |
84 | printf("%s: %s - %s\n",PROGNAME,msg,arg);\ | ||
85 | print_usage();\ | ||
86 | exit(STATE_UNKNOWN);\ | ||
87 | } | ||
88 | |||
89 | #define usage3(msg,arg) {\ | ||
90 | printf("%s: %s - %c\n",PROGNAME,msg,arg);\ | ||
91 | print_usage();\ | ||
92 | exit(STATE_UNKNOWN);\ | ||
93 | } | ||
94 | 80 | ||
95 | #define state_text(a) \ | 81 | #define state_text(a) \ |
96 | (a)==0?"OK":\ | 82 | (a)==0?"OK":\ |