summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_by_ssh.c18
-rw-r--r--plugins/check_dig.c8
-rw-r--r--plugins/check_disk.c8
-rw-r--r--plugins/check_dns.c10
-rw-r--r--plugins/check_dummy.c10
-rw-r--r--plugins/check_fping.c14
-rw-r--r--plugins/check_hpjd.c8
-rw-r--r--plugins/check_http.c8
-rw-r--r--plugins/check_ldap.c16
-rw-r--r--plugins/check_load.c6
-rw-r--r--plugins/check_mrtg.c10
-rw-r--r--plugins/check_mrtgtraf.c8
-rw-r--r--plugins/check_mysql.c8
-rw-r--r--plugins/check_nagios.c18
-rw-r--r--plugins/check_nwstat.c14
-rw-r--r--plugins/check_overcr.c12
-rw-r--r--plugins/check_pgsql.c10
-rw-r--r--plugins/check_ping.c8
-rw-r--r--plugins/check_procs.c14
-rw-r--r--plugins/check_radius.c12
-rw-r--r--plugins/check_real.c8
-rw-r--r--plugins/check_smtp.c8
-rw-r--r--plugins/check_snmp.c11
-rw-r--r--plugins/check_ssh.c8
-rw-r--r--plugins/check_swap.c8
-rw-r--r--plugins/check_tcp.c32
-rw-r--r--plugins/check_time.c8
-rw-r--r--plugins/check_udp.c10
-rw-r--r--plugins/check_ups.c10
-rw-r--r--plugins/check_users.c10
-rw-r--r--plugins/check_vsz.c38
-rw-r--r--plugins/negate.c18
-rw-r--r--plugins/urlize.c21
-rw-r--r--plugins/utils.c37
-rw-r--r--plugins/utils.h.in26
35 files changed, 234 insertions, 239 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 59e4178..5c50530 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 25const 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
39int process_arguments (int, char **); 37int process_arguments (int, char **);
40int validate_arguments (void); 38int validate_arguments (void);
41void print_help (char *command_name); 39void print_help (const char *command_name);
42void print_usage (void); 40void 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
332void 330void
333print_help (char *cmd) 331print_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 e4f8632..5c6f1e1 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" 28const 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)
240void 240void
241print_help (void) 241print_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 5534305..3c1cfef 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -45,7 +45,7 @@ int check_disk (int usp, int free_disk);
45void print_help (void); 45void print_help (void);
46void print_usage (void); 46void print_usage (void);
47 47
48const char *PROGNAME = "check_disk"; 48const char *progname = "check_disk";
49 49
50int w_df = -1; 50int w_df = -1;
51int c_df = -1; 51int 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)
323void 323void
324print_help (void) 324print_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 714ecab..3462701 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" 51const 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
388print_usage (void) 388print_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
394void 394void
395print_help (void) 395print_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 c2a5b7e..ca37e98 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
40void print_help (char *); 40const char *progname = "check_dummy";
41void print_usage (char *); 41
42void print_help (const char *);
43void print_usage (const char *);
42 44
43int 45int
44main (int argc, char **argv) 46main (int argc, char **argv)
@@ -82,7 +84,7 @@ main (int argc, char **argv)
82} 84}
83 85
84void 86void
85print_help (char *cmd) 87print_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
96void 98void
97print_usage (char *cmd) 99print_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 da11e67..8887afe 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" 35const 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])
358void 358void
359print_usage (void) 359print_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
369print_help (void) 369print_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 42b4bb5..a262fc2 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" 68const 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)
482void 482void
483print_help (void) 483print_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 bbc76da..de7a2db 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" 26const 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)
1058void 1058void
1059print_help (void) 1059print_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 213dc4a..6491e5b 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" 23const 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
36int process_arguments (int, char **); 36int process_arguments (int, char **);
37int validate_arguments (void); 37int validate_arguments (void);
38static void print_help (void); 38void print_help (void);
39static void print_usage (void); 39void print_usage (void);
40 40
41char ld_defattr[] = "(objectclass=*)"; 41char ld_defattr[] = "(objectclass=*)";
42char *ld_attr = ld_defattr; 42char *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 */
228static void 228void
229print_help () 229print_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
251static void 251void
252print_usage () 252print_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 5caffbe..896e356 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" 47const char *progname = "check_load";
48 48
49int process_arguments (int argc, char **argv); 49int process_arguments (int argc, char **argv);
50int validate_arguments (void); 50int 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)
303void 303void
304print_help (void) 304print_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 80c9b00..e26e2e6 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" 26const 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)
359void 359void
360print_help (void) 360print_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 d33ebd9..0583002 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" 55const char *progname = "check_mrtgtraf";
56 56
57int process_arguments (int, char **); 57int process_arguments (int, char **);
58int validate_arguments (void); 58int 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)
356void 356void
357print_help (void) 357print_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 a4a2ed1..df2ed00 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" 17const 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)
230void 230void
231print_help (void) 231print_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 d19445a..5c4cd4a 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
33const char *PROGNAME = "check_nagios"; 33const char *progname = "check_nagios";
34 34
35int process_arguments (int, char **); 35int process_arguments (int, char **);
36void print_usage (void); 36void 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)
241void 241void
242print_help (void) 242print_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 53deef8..2f7ecc1 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" 26const 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;
128unsigned long vars_to_check=CHECK_NONE; 128unsigned long vars_to_check=CHECK_NONE;
129int sap_number=-1; 129int sap_number=-1;
130 130
131#define PROGNAME "check_nwstat"
132
133int process_arguments(int, char **); 131int process_arguments(int, char **);
134void print_usage(void); 132void print_usage(void);
135void print_help(void); 133void 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
812void print_help(void) 810void 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 305a824..2ff37a4 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" 61const char *progname = "check_overcr";
62 62
63char *server_address = NULL; 63char *server_address = NULL;
64int server_port = PORT; 64int 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)
448void 448void
449print_help (void) 449print_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 98c504f..4c8662b 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" 26const 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)
218void 218void
219print_help (void) 219print_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 3602122..0c0f2e4 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" 13const 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
488void 488void
489print_help (void) 489print_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 967b4de..3849c77 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" 37const 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)
462void 462void
463print_help (void) 463print_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 c346dc7..0762896 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" 26const 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)
324void 324void
325print_help (void) 325print_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 c553352..a910937 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" 51const 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)
410void 410void
411print_help (void) 411print_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 6f17429..d8b9059 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" 42const 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)
340void 340void
341print_help (void) 341print_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 cb13bc9..b005984 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" 26const 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 ()
753void 753void
754print_help (void) 754print_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 4637bce..faaead6 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" 18const 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)
238void 238void
239print_help (void) 239print_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 968779d..b213c96 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" 32const 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)
346void 346void
347print_help (void) 347print_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 32d38b4..43580b6 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 **);
65void print_usage (void); 65void print_usage (void);
66void print_help (void); 66void print_help (void);
67 67
68char *PROGNAME = NULL; 68char *progname = NULL;
69char *SERVICE = NULL; 69char *SERVICE = NULL;
70char *SEND = NULL; 70char *SEND = NULL;
71char *EXPECT = NULL; 71char *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)
489void 489void
490print_help (void) 490print_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 c7405f6..e4bd26d 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" 42const 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)
316void 316void
317print_help (void) 317print_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 f6b528d..8626f8c 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" 44const char *progname = "check_udp";
45 45
46int warning_time = 0; 46int warning_time = 0;
47int check_warning_time = FALSE; 47int 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)
243void 243void
244print_help (void) 244print_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 470e3be..4c90322 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" 59const 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)
571void 571void
572print_help (void) 572print_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 e39e0d2..565d9e7 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" 51const 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)
207void 207void
208print_usage (void) 208print_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)
217void 217void
218print_help (void) 218print_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 7eeab22..767abf4 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" 36const 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
47int process_arguments (int argc, char **argv); 47int process_arguments (int argc, char **argv);
48void print_help (char *cmd); 48void print_help (const char *cmd);
49void print_usage (char *cmd); 49void print_usage (const char *cmd);
50 50
51int warn = -1; 51int warn = -1;
52int crit = -1; 52int 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
229void 229void
230print_usage (char *cmd) 230print_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
236void 236void
237print_help (char *cmd) 237print_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 c76f5ca..454ac96 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -23,7 +23,7 @@
23 * 23 *
24 *****************************************************************************/ 24 *****************************************************************************/
25 25
26#define PROGNAME "negate" 26const 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
53char *command_line; 53char *command_line;
54 54
55static int process_arguments (int, char **); 55int process_arguments (int, char **);
56static int validate_arguments (void); 56int validate_arguments (void);
57static void print_usage (void); 57void print_usage (void);
58static void print_help (void); 58void 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)
174void 174void
175print_help (void) 175print_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 9835c82..8d6fc3a 100644
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
@@ -37,12 +37,14 @@
37 * 37 *
38 *****************************************************************************/ 38 *****************************************************************************/
39 39
40const 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
44void print_usage (char *); 46void print_usage (const char *);
45void print_help (char *); 47void print_help (const char *);
46 48
47int 49int
48main (int argc, char **argv) 50main (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
122void 124void
123print_usage (char *cmd) 125print_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
129void 130void
130print_help (char *cmd) 131print_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 22020d7..474206b 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -18,11 +18,11 @@
18#include <limits.h> 18#include <limits.h>
19 19
20extern int timeout_interval; 20extern int timeout_interval;
21extern const char *progname;
21 22
22char *my_basename (char *);
23void support (void); 23void support (void);
24char *clean_revstring (const char *); 24char *clean_revstring (const char *);
25void print_revision (char *, const char *); 25void print_revision (const char *, const char *);
26void terminate (int, const char *fmt, ...); 26void terminate (int, const char *fmt, ...);
27RETSIGTYPE timeout_alarm_handler (int); 27RETSIGTYPE 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
70int 68int
71max_state(int a, int b) 69max_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
87char * 85void usage (char *msg)
88my_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
92void usage2(char *msg, char *arg)
93{
94 printf ("%s: %s - %s\n",progname,msg,arg);
95 print_usage ();
96 exit (STATE_UNKNOWN);
97}
98
99void
100usage3 (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
117void 128void
118print_revision (char *command_name, const char *revision_string) 129print_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 96bf9b2..317ec46 100644
--- a/plugins/utils.h.in
+++ b/plugins/utils.h.in
@@ -16,7 +16,7 @@ suite of plugins. */
16char *my_basename (char *); 16char *my_basename (char *);
17void support (void); 17void support (void);
18char *clean_revstring (const char *revstring); 18char *clean_revstring (const char *revstring);
19void print_revision (char *, const char *); 19void print_revision (const char *, const char *);
20void terminate (int result, char *msg, ...); 20void terminate (int result, char *msg, ...);
21extern RETSIGTYPE timeout_alarm_handler (int); 21extern RETSIGTYPE timeout_alarm_handler (int);
22 22
@@ -69,28 +69,14 @@ char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */
69char *strpcpy (char *dest, const char *src, const char *str); 69char *strpcpy (char *dest, const char *src, const char *str);
70char *strpcat (char *dest, const char *src, const char *str); 70char *strpcat (char *dest, const char *src, const char *str);
71 71
72/* Handle comparisions for STATE_* */ 72int max_state (int a, int b);
73int max_state(int, int);
74 73
75#define max(a,b) ((a)>(b))?(a):(b) 74void usage (char *msg);
75void usage2(char *msg, char *arg);
76void 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":\