Code

convert PROGANE from a define to a const char
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>
Mon, 13 Jan 2003 12:15:16 +0000 (12:15 +0000)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>
Mon, 13 Jan 2003 12:15:16 +0000 (12:15 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@238 f882894a-f735-0410-b71e-b25c423dba1c

35 files changed:
plugins/check_by_ssh.c
plugins/check_dig.c
plugins/check_disk.c
plugins/check_dns.c
plugins/check_dummy.c
plugins/check_fping.c
plugins/check_hpjd.c
plugins/check_http.c
plugins/check_ldap.c
plugins/check_load.c
plugins/check_mrtg.c
plugins/check_mrtgtraf.c
plugins/check_mysql.c
plugins/check_nagios.c
plugins/check_nwstat.c
plugins/check_overcr.c
plugins/check_pgsql.c
plugins/check_ping.c
plugins/check_procs.c
plugins/check_radius.c
plugins/check_real.c
plugins/check_smtp.c
plugins/check_snmp.c
plugins/check_ssh.c
plugins/check_swap.c
plugins/check_tcp.c
plugins/check_time.c
plugins/check_udp.c
plugins/check_ups.c
plugins/check_users.c
plugins/check_vsz.c
plugins/negate.c
plugins/urlize.c
plugins/utils.c
plugins/utils.h.in

index 59e417861fcac568f13e3c36cf79b5e04dc2f9e9..5c5053092541f0c5f98644254cacdfcdc855a6c8 100644 (file)
@@ -22,7 +22,7 @@
  *
  *****************************************************************************/
  
  *
  *****************************************************************************/
  
-#define PROGRAM check_by_ssh
+const char *progname = "check_by_ssh";
 #define DESCRIPTION "Run checks on a remote system using ssh, wrapping the proper timeout around the ssh invocation."
 #define AUTHOR "Karl DeBisschop"
 #define EMAIL "karl@debisschop.net"
 #define DESCRIPTION "Run checks on a remote system using ssh, wrapping the proper timeout around the ssh invocation."
 #define AUTHOR "Karl DeBisschop"
 #define EMAIL "karl@debisschop.net"
 #include "utils.h"
 #include <time.h>
 
 #include "utils.h"
 #include <time.h>
 
-#define PROGNAME "check_by_ssh"
-
 int process_arguments (int, char **);
 int validate_arguments (void);
 int process_arguments (int, char **);
 int validate_arguments (void);
-void print_help (char *command_name);
+void print_help (const char *command_name);
 void print_usage (void);
 
 
 void print_usage (void);
 
 
@@ -223,10 +221,10 @@ process_arguments (int argc, char **argv)
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
-                       print_help (PROGNAME);
+                       print_help (progname);
                        exit (STATE_OK);
                case 'v':                                                                       /* help */
                        verbose = TRUE;
                        exit (STATE_OK);
                case 'v':                                                                       /* help */
                        verbose = TRUE;
@@ -286,7 +284,7 @@ process_arguments (int argc, char **argv)
        c = optind;
        if (hostname == NULL) {
                if (!is_host (argv[c]))
        c = optind;
        if (hostname == NULL) {
                if (!is_host (argv[c]))
-                       terminate (STATE_UNKNOWN, "%s: Invalid host name %s\n", PROGNAME, argv[c]);
+                       terminate (STATE_UNKNOWN, "%s: Invalid host name %s\n", progname, argv[c]);
                hostname = argv[c++];
        }
 
                hostname = argv[c++];
        }
 
@@ -317,10 +315,10 @@ validate_arguments (void)
                return ERROR;
 
        if (passive && commands != services)
                return ERROR;
 
        if (passive && commands != services)
-               terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide a service name for each command.\n", PROGNAME);
+               terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide a service name for each command.\n", progname);
 
        if (passive && host_shortname == NULL)
 
        if (passive && host_shortname == NULL)
-               terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide the host short name from the nagios configs.\n", PROGNAME);
+               terminate (STATE_UNKNOWN, "%s: In passive mode, you must provide the host short name from the nagios configs.\n", progname);
 
        return OK;
 }
 
        return OK;
 }
@@ -330,7 +328,7 @@ validate_arguments (void)
 
 
 void
 
 
 void
-print_help (char *cmd)
+print_help (const char *cmd)
 {
        print_revision (cmd, "$Revision$");
 
 {
        print_revision (cmd, "$Revision$");
 
index e4f86321d2e46aaaecead0812d8278499c047b07..5c6f1e12e8bdb45985d0ac535d8c79bdcab1de42 100644 (file)
@@ -25,7 +25,7 @@
 #include "utils.h"
 #include "popen.h"
 
 #include "utils.h"
 #include "popen.h"
 
-#define PROGNAME "check_dig"
+const char *progname = "check_dig";
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 #define AUTHOR "Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 #define AUTHOR "Karl DeBisschop"
@@ -197,7 +197,7 @@ process_arguments (int argc, char **argv)
                        }
                        break;
                case 'V':                                                                       /* version */
                        }
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -240,7 +240,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
@@ -272,5 +272,5 @@ print_usage (void)
        printf
                ("Usage: %s -H host -l lookup [-t timeout] [-v]\n"
                 "       %s --help\n"
        printf
                ("Usage: %s -H host -l lookup [-t timeout] [-v]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 }
index 553430596656601b7fb2923638176ef04b79c970..3c1cfef9519c51ffb692758749be38e69c0b818f 100644 (file)
@@ -45,7 +45,7 @@ int check_disk (int usp, int free_disk);
 void print_help (void);
 void print_usage (void);
 
 void print_help (void);
 void print_usage (void);
 
-const char *PROGNAME = "check_disk";
+const char *progname = "check_disk";
 
 int w_df = -1;
 int c_df = -1;
 
 int w_df = -1;
 int c_df = -1;
@@ -252,7 +252,7 @@ process_arguments (int argc, char **argv)
                        exclude_device = optarg;
                        break;
                case 'V':                                                                       /* version */
                        exclude_device = optarg;
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -323,7 +323,7 @@ check_disk (usp, free_disk)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin will check the percent of used disk space on a mounted\n"
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin will check the percent of used disk space on a mounted\n"
@@ -362,5 +362,5 @@ print_usage (void)
        printf
                ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n"
                 "       %s (-h|--help)\n"
        printf
                ("Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [--verbose]\n"
                 "       %s (-h|--help)\n"
-                "       %s (-V|--version)\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s (-V|--version)\n", progname, progname, progname);
 }
 }
index 714ecab077530ad01e748112cc6d36a213631a35..3462701a07f6ba9a4caf73b492042cfc69642683 100644 (file)
@@ -48,7 +48,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-#define PROGNAME "check_dns"
+const char *progname = "check_dns";
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 
@@ -292,14 +292,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?': /* args not parsable */
 
                switch (c) {
                case '?': /* args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", PROGNAME, optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h': /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V': /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h': /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V': /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'v': /* version */
                        verbose = TRUE;
                        exit (STATE_OK);
                case 'v': /* version */
                        verbose = TRUE;
@@ -388,13 +388,13 @@ void
 print_usage (void)
 {
        printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" "       %s --help\n"
 print_usage (void)
 {
        printf ("Usage: %s -H host [-s server] [-a expected-address] [-t timeout]\n" "       %s --help\n"
-                                       "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                                       "       %s --version\n", progname, progname, progname);
 }
 
 void
 print_help (void)
 {
 }
 
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n");
        print_usage ();
        printf
        printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n");
        print_usage ();
        printf
index c2a5b7eb859294b7bfcfd05d25d52ddab3bbacc0..ca37e98e91b9d976862c1c1246c0ff3ba1cdd3ef 100644 (file)
 #include "common.h"
 #include "utils.h"
 
 #include "common.h"
 #include "utils.h"
 
-void print_help (char *);
-void print_usage (char *);
+const char *progname = "check_dummy";
+
+void print_help (const char *);
+void print_usage (const char *);
 
 int
 main (int argc, char **argv)
 
 int
 main (int argc, char **argv)
@@ -82,7 +84,7 @@ main (int argc, char **argv)
 }
 
 void
 }
 
 void
-print_help (char *cmd)
+print_help (const char *cmd)
 {
        print_revision (cmd, "$Revision$");
        printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n"
 {
        print_revision (cmd, "$Revision$");
        printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n"
@@ -94,7 +96,7 @@ print_help (char *cmd)
 }
 
 void
 }
 
 void
-print_usage (char *cmd)
+print_usage (const char *cmd)
 {
        printf ("Usage: %s <integer state>\n", cmd);
 }
 {
        printf ("Usage: %s <integer state>\n", cmd);
 }
index da11e678091d36d319f10bd2ee25bf33d7597f94..8887afe8eeaf647fe695da34b07d244aac18afdd 100644 (file)
@@ -32,7 +32,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-#define PROGNAME "check_fping"
+const char *progname = "check_fping";
 #define PACKET_COUNT 1
 #define PACKET_SIZE 56
 #define UNKNOWN_PACKET_LOSS 200        /* 200% */
 #define PACKET_COUNT 1
 #define PACKET_SIZE 56
 #define UNKNOWN_PACKET_LOSS 200        /* 200% */
@@ -243,14 +243,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
                        exit (STATE_OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
@@ -325,12 +325,12 @@ get_threshold (char *arg, char *rv[2])
                arg1[strcspn (arg1, ",:")] = 0;
                if (strstr (arg1, "%") && strstr (arg2, "%"))
                        terminate (STATE_UNKNOWN,
                arg1[strcspn (arg1, ",:")] = 0;
                if (strstr (arg1, "%") && strstr (arg2, "%"))
                        terminate (STATE_UNKNOWN,
-                                                                "%s: Only one threshold may be packet loss (%s)\n", PROGNAME,
+                                                                "%s: Only one threshold may be packet loss (%s)\n", progname,
                                                                 arg);
                if (!strstr (arg1, "%") && !strstr (arg2, "%"))
                        terminate (STATE_UNKNOWN,
                                                                 "%s: Only one threshold must be packet loss (%s)\n",
                                                                 arg);
                if (!strstr (arg1, "%") && !strstr (arg2, "%"))
                        terminate (STATE_UNKNOWN,
                                                                 "%s: Only one threshold must be packet loss (%s)\n",
-                                                                PROGNAME, arg);
+                                                                progname, arg);
        }
 
        if (arg2 && strstr (arg2, "%")) {
        }
 
        if (arg2 && strstr (arg2, "%")) {
@@ -358,7 +358,7 @@ get_threshold (char *arg, char *rv[2])
 void
 print_usage (void)
 {
 void
 print_usage (void)
 {
-       printf ("Usage: %s <host_address>\n", PROGNAME);
+       printf ("Usage: %s <host_address>\n", progname);
 }
 
 
 }
 
 
@@ -369,7 +369,7 @@ void
 print_help (void)
 {
 
 print_help (void)
 {
 
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
 
        printf
                ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n"
 
        printf
                ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n"
index 42b4bb544d3e75b05637cc044159af57721c61e2..a262fc23cb1440fc07a6efbede32962d22aa580f 100644 (file)
@@ -65,7 +65,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-#define PROGNAME "check_hpjd"
+const char *progname = "check_hpjd"
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 
@@ -438,7 +438,7 @@ process_arguments (int argc, char **argv)
                        community = optarg;
                        break;
                case 'V':                                                                       /* version */
                        community = optarg;
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -482,7 +482,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin tests the STATUS of an HP printer with a JetDirect card.\n"
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin tests the STATUS of an HP printer with a JetDirect card.\n"
@@ -510,7 +510,7 @@ print_usage (void)
        printf
                ("Usage: %s -H host [-C community]\n"
                 "       %s --help\n"
        printf
                ("Usage: %s -H host [-C community]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 
 
 }
 
 
index bbc76daeebb59d516b9e7dfb99deb47c0a0bf5d9..de7a2db7f7b70b70d3917874ddca0a2908df03fc 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_http"
+const char *progname = "check_http";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHORS "Ethan Galstad/Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHORS "Ethan Galstad/Karl DeBisschop"
@@ -328,7 +328,7 @@ process_arguments (int argc, char **argv)
                        exit (STATE_OK);
                        break;
                case 'V': /* version */
                        exit (STATE_OK);
                        break;
                case 'V': /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                        break;
                case 't': /* timeout period */
                        exit (STATE_OK);
                        break;
                case 't': /* timeout period */
@@ -1058,7 +1058,7 @@ my_close (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
@@ -1083,5 +1083,5 @@ print_usage (void)
                " %s -h for detailed help\n"
                " %s -V for version information\n",
 #endif
                " %s -h for detailed help\n"
                " %s -V for version information\n",
 #endif
-       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+       progname, OPTIONS, progname, progname);
 }
 }
index 213dc4a8302b8f6d2b58429b6961db0cbfc71905..6491e5ba1f4703a25d25abb69d027e242f96f317 100644 (file)
@@ -20,7 +20,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_ldap"
+const char *progname = "check_ldap";
 #define REVISION "$Revision$"
 
 #include "config.h"
 #define REVISION "$Revision$"
 
 #include "config.h"
@@ -35,8 +35,8 @@
 
 int process_arguments (int, char **);
 int validate_arguments (void);
 
 int process_arguments (int, char **);
 int validate_arguments (void);
-static void print_help (void);
-static void print_usage (void);
+void print_help (void);
+void print_usage (void);
 
 char ld_defattr[] = "(objectclass=*)";
 char *ld_attr = ld_defattr;
 
 char ld_defattr[] = "(objectclass=*)";
 char *ld_attr = ld_defattr;
@@ -165,7 +165,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 't':                                                                       /* timeout period */
                        if (!is_intnonneg (optarg))
                        exit (STATE_OK);
                case 't':                                                                       /* timeout period */
                        if (!is_intnonneg (optarg))
@@ -225,10 +225,10 @@ validate_arguments ()
 
 
 /* function print_help */
 
 
 /* function print_help */
-static void
+void
 print_help ()
 {
 print_help ()
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n"
                 "License: GPL\n" "\n");
        printf
                ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n"
                 "License: GPL\n" "\n");
@@ -248,11 +248,11 @@ print_help ()
 }
 
 
 }
 
 
-static void
+void
 print_usage ()
 {
        printf
                ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n"
                 "         [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
 print_usage ()
 {
        printf
                ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n"
                 "         [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
-                "(Note: all times are in seconds.)\n", PROGNAME);
+                "(Note: all times are in seconds.)\n", progname);
 }
 }
index 5caffbe879d87740322164a9b4ab80668efa2ef1..896e356b6114098bcc9a217e091de310ff4952c7 100644 (file)
@@ -44,7 +44,7 @@
 
 #endif
 
 
 #endif
 
-#define PROGNAME "check_load"
+const char *progname = "check_load";
 
 int process_arguments (int argc, char **argv);
 int validate_arguments (void);
 
 int process_arguments (int argc, char **argv);
 int validate_arguments (void);
@@ -212,7 +212,7 @@ process_arguments (int argc, char **argv)
                                usage ("Critical threshold must be float or float triplet!\n");
                        break;
                case 'V':                                                                       /* version */
                                usage ("Critical threshold must be float or float triplet!\n");
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -303,7 +303,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n"
                 "Copyright (c) 2000 Karl DeBisschop\n\n"
        printf
                ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n"
                 "Copyright (c) 2000 Karl DeBisschop\n\n"
index 80c9b00894bd2b0766aad18214a11ed5482bf64d..e26e2e66b7ccfae5e513ad0fce8d3773fd9f6242 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_mrtg"
+const char *progname = "check_mrtg";
 #define REVISION "$Revision$"
 #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
 
 #define REVISION "$Revision$"
 #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
 
@@ -287,7 +287,7 @@ process_arguments (int argc, char **argv)
                        units_label = optarg;
                        break;
                case 'V':                                                                       /* version */
                        units_label = optarg;
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -308,7 +308,7 @@ process_arguments (int argc, char **argv)
                else
                        terminate (STATE_UNKNOWN,
                                   "%s is not a valid expiration time\nUse '%s -h' for additional help\n",
                else
                        terminate (STATE_UNKNOWN,
                                   "%s is not a valid expiration time\nUse '%s -h' for additional help\n",
-                                  argv[c], PROGNAME);
+                                  argv[c], progname);
        }
 
        if (argc > c && strcmp (argv[c], "MAX") == 0) {
        }
 
        if (argc > c && strcmp (argv[c], "MAX") == 0) {
@@ -359,7 +359,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY);
        print_usage ();
        printf ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n");
        printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY);
        print_usage ();
        printf ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n");
@@ -377,5 +377,5 @@ print_usage (void)
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }
 }
index d33ebd9ce17a100ac045d9ecc738fd6f0067bb7b..05830026a760d716800505d538876b8b06b8478b 100644 (file)
@@ -52,7 +52,7 @@
 #include "common.h"
 #include "utils.h"
 
 #include "common.h"
 #include "utils.h"
 
-#define PROGNAME "check_mrtgtraf"
+const char *progname = "check_mrtgtraf";
 
 int process_arguments (int, char **);
 int validate_arguments (void);
 
 int process_arguments (int, char **);
 int validate_arguments (void);
@@ -292,7 +292,7 @@ process_arguments (int argc, char **argv)
                                                        &outgoing_warning_threshold);
                        break;
                case 'V':                                                                       /* version */
                                                        &outgoing_warning_threshold);
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -356,7 +356,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n"
                 "This plugin tests the UPS service on the specified host.\n\n");
        printf
                ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n"
                 "This plugin tests the UPS service on the specified host.\n\n");
@@ -390,5 +390,5 @@ print_usage (void)
                ("Usage: %s  -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n"
                 "            [-e expire_minutes] [-t timeout] [-v]\n"
                 "       %s --help\n"
                ("Usage: %s  -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair> -c <critical_pair>\n"
                 "            [-e expire_minutes] [-t timeout] [-v]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 }
index a4a2ed1d8ffbfc46b557d2d9e860f4bee100f804..df2ed002a8c7587def18324b1875fa98260adbd0 100644 (file)
@@ -14,7 +14,7 @@
 * This plugin is for testing a mysql server.
 ******************************************************************************/
 
 * This plugin is for testing a mysql server.
 ******************************************************************************/
 
-#define PROGNAME "check_mysql"
+const char *progname = "check_mysql"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 
@@ -178,7 +178,7 @@ process_arguments (int argc, char **argv)
                        db_port = atoi (optarg);
                        break;
                case 'V':                                                                       /* version */
                        db_port = atoi (optarg);
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -230,7 +230,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n"
                 "This plugin is for testing a mysql server.\n");
        printf
                ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n"
                 "This plugin is for testing a mysql server.\n");
@@ -267,5 +267,5 @@ print_usage (void)
        printf
                ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
                 "       %s --help\n"
        printf
                ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 }
index d19445a55b9389ff7f6603366a2e56269b846700..5c4cd4a3a7d769126b7bea5df1d25f45a612c4e4 100644 (file)
@@ -30,7 +30,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-const char *PROGNAME = "check_nagios";
+const char *progname = "check_nagios";
 
 int process_arguments (int, char **);
 void print_usage (void);
 
 int process_arguments (int, char **);
 void print_usage (void);
@@ -166,7 +166,7 @@ process_arguments (int argc, char **argv)
                else
                        terminate (STATE_UNKNOWN,
                                                                 "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
                else
                        terminate (STATE_UNKNOWN,
                                                                 "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
-                                                                PROGNAME);
+                                                                progname);
                process_string = argv[3];
                return OK;
        }
                process_string = argv[3];
                return OK;
        }
@@ -183,14 +183,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %c\n\n", PROGNAME, optopt);
+                       printf ("%s: Unknown argument: %c\n\n", progname, optopt);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'F':                                                                       /* hostname */
                        status_log = optarg;
                        exit (STATE_OK);
                case 'F':                                                                       /* hostname */
                        status_log = optarg;
@@ -204,7 +204,7 @@ process_arguments (int argc, char **argv)
                        else
                                terminate (STATE_UNKNOWN,
                                                                         "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
                        else
                                terminate (STATE_UNKNOWN,
                                                                         "Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
-                                                                        PROGNAME);
+                                                                        progname);
                        break;
                }
        }
                        break;
                }
        }
@@ -213,11 +213,11 @@ process_arguments (int argc, char **argv)
        if (status_log == NULL)
                terminate (STATE_UNKNOWN,
                                                         "You must provide the status_log\nType '%s -h' for additional help\n",
        if (status_log == NULL)
                terminate (STATE_UNKNOWN,
                                                         "You must provide the status_log\nType '%s -h' for additional help\n",
-                                                        PROGNAME);
+                                                        progname);
        else if (process_string == NULL)
                terminate (STATE_UNKNOWN,
                                                         "You must provide a process string\nType '%s -h' for additional help\n",
        else if (process_string == NULL)
                terminate (STATE_UNKNOWN,
                                                         "You must provide a process string\nType '%s -h' for additional help\n",
-                                                        PROGNAME);
+                                                        progname);
 
        return OK;
 }
 
        return OK;
 }
@@ -231,7 +231,7 @@ print_usage (void)
 {
        printf
                ("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n",
 {
        printf
                ("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n",
-                PROGNAME);
+                progname);
 }
 
 
 }
 
 
@@ -241,7 +241,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin attempts to check the status of the Nagios process on the local\n"
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin attempts to check the status of the Nagios process on the local\n"
index 53deef879c1b2a8a4af2f0141be1f6935b429b28..2f7ecc107cadb5400b634b9b0d555d034502a54e 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_nwstat"
+const char *progname = "check_nwstat";
 #define REVISION "$Revision$"
 #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
 
 #define REVISION "$Revision$"
 #define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
 
@@ -128,8 +128,6 @@ int check_netware_version=FALSE;
 unsigned long vars_to_check=CHECK_NONE;
 int sap_number=-1;
 
 unsigned long vars_to_check=CHECK_NONE;
 int sap_number=-1;
 
-#define PROGNAME "check_nwstat"
-
 int process_arguments(int, char **);
 void print_usage(void);
 void print_help(void);
 int process_arguments(int, char **);
 void print_usage(void);
 void print_help(void);
@@ -674,14 +672,14 @@ int process_arguments(int argc, char **argv){
                switch (c)
                        {
                        case '?': /* print short usage statement if args not parsable */
                switch (c)
                        {
                        case '?': /* print short usage statement if args not parsable */
-                               printf("%s: Unknown argument: %s\n\n",my_basename(argv[0]),optarg);
+                               printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                                print_usage();
                                exit(STATE_UNKNOWN);
                        case 'h': /* help */
                                print_help();
                                exit(STATE_OK);
                        case 'V': /* version */
                                print_usage();
                                exit(STATE_UNKNOWN);
                        case 'h': /* help */
                                print_help();
                                exit(STATE_OK);
                        case 'V': /* version */
-                               print_revision(my_basename(argv[0]),"$Revision$");
+                               print_revision(progname,"$Revision$");
                                exit(STATE_OK);
                        case 'H': /* hostname */
                                server_address=optarg;
                                exit(STATE_OK);
                        case 'H': /* hostname */
                                server_address=optarg;
@@ -693,7 +691,7 @@ int process_arguments(int argc, char **argv){
                                if (is_intnonneg(optarg))
                                        server_port=atoi(optarg);
                                else
                                if (is_intnonneg(optarg))
                                        server_port=atoi(optarg);
                                else
-                                       terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",PROGNAME);
+                                       terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname);
                                break;
                        case 'v':
                                if(strlen(optarg)<3)
                                break;
                        case 'v':
                                if(strlen(optarg)<3)
@@ -806,12 +804,12 @@ void print_usage(void)
                 " %s -h for detailed help\n"
                 " %s -V for version information\n",
 #endif
                 " %s -h for detailed help\n"
                 " %s -V for version information\n",
 #endif
-                PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                progname, OPTIONS, progname, progname);
 }
 
 void print_help(void)
 {
 }
 
 void print_help(void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY);
        print_usage();
        printf
        printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY);
        print_usage();
        printf
index 305a8242808887d103b8fdc5a7685e4760725d81..2ff37a485b1741fdd8695e08d79d62c40dd4a694 100644 (file)
@@ -58,7 +58,7 @@
 
 #define PORT   2000
 
 
 #define PORT   2000
 
-#define PROGNAME "check_overcr"
+const char *progname = "check_overcr";
 
 char *server_address = NULL;
 int server_port = PORT;
 
 char *server_address = NULL;
 int server_port = PORT;
@@ -367,14 +367,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'H':                                                                       /* hostname */
                        server_address = optarg;
                        exit (STATE_OK);
                case 'H':                                                                       /* hostname */
                        server_address = optarg;
@@ -385,7 +385,7 @@ process_arguments (int argc, char **argv)
                        else
                                terminate (STATE_UNKNOWN,
                                                                         "Server port an integer (seconds)\nType '%s -h' for additional help\n",
                        else
                                terminate (STATE_UNKNOWN,
                                                                         "Server port an integer (seconds)\nType '%s -h' for additional help\n",
-                                                                        PROGNAME);
+                                                                        progname);
                        break;
                case 'v':                                                                       /* variable */
                        if (strcmp (optarg, "LOAD1") == 0)
                        break;
                case 'v':                                                                       /* variable */
                        if (strcmp (optarg, "LOAD1") == 0)
@@ -438,7 +438,7 @@ print_usage (void)
 {
        printf
                ("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n",
 {
        printf
                ("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n",
-                PROGNAME);
+                progname);
 }
 
 
 }
 
 
@@ -448,7 +448,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin attempts to contact the Over-CR collector daemon running on the\n"
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin attempts to contact the Over-CR collector daemon running on the\n"
index 98c504faff1d7f1147514d2afde2a7ffc1f4944f..4c8662bab7029d4bfa5335beea63a074dfbcd351 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_pgsql"
+const char *progname = "check_pgsql"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHOR "Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHOR "Karl DeBisschop"
@@ -122,7 +122,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
@@ -218,7 +218,7 @@ main (int argc, char **argv)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
@@ -235,7 +235,7 @@ print_usage (void)
        printf ("Usage:\n" " %s %s\n"
                                        " %s (-h | --help) for detailed help\n"
                                        " %s (-V | --version) for version information\n",
        printf ("Usage:\n" " %s %s\n"
                                        " %s (-h | --help) for detailed help\n"
                                        " %s (-V | --version) for version information\n",
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }
 \f
 
 }
 \f
 
@@ -281,7 +281,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':     /* version */
                        print_help ();
                        exit (STATE_OK);
                case 'V':     /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 't':     /* timeout period */
                        if (!is_integer (optarg))
                        exit (STATE_OK);
                case 't':     /* timeout period */
                        if (!is_integer (optarg))
index 3602122c28abd4a6288e266bc4f5f79b8c21380b..0c0f2e44f2872e0d4601e683c9b733dd596ecc3c 100644 (file)
@@ -10,7 +10,7 @@
 *
 *****************************************************************************/
 
 *
 *****************************************************************************/
 
-#define PROGNAME "check_ping"
+const char *progname = "check_ping";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHOR "Ethan Galstad/Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHOR "Ethan Galstad/Karl DeBisschop"
@@ -189,7 +189,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':       /* version */
                        print_help ();
                        exit (STATE_OK);
                case 'V':       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 't':       /* timeout period */
                        timeout_interval = atoi (optarg);
                        exit (STATE_OK);
                case 't':       /* timeout period */
                        timeout_interval = atoi (optarg);
@@ -482,13 +482,13 @@ print_usage (void)
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }
 
 void
 print_help (void)
 {
 }
 
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
index 967b4de7d00409c01c29eabb54ee04b70b694351..3849c77666c87db12c3c2e9ac2dca41bc7ab184a 100644 (file)
@@ -34,7 +34,7 @@
 *
 ******************************************************************************/
 
 *
 ******************************************************************************/
 
-#define PROGNAME "check_snmp"
+const char *progname = "check_snmp";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
@@ -298,12 +298,12 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 't':                                                                       /* timeout period */
                        if (!is_integer (optarg)) {
                                printf ("%s: Timeout Interval must be an integer!\n\n",
                        exit (STATE_OK);
                case 't':                                                                       /* timeout period */
                        if (!is_integer (optarg)) {
                                printf ("%s: Timeout Interval must be an integer!\n\n",
-                                       my_basename (argv[0]));
+                                       progname);
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -325,7 +325,7 @@ process_arguments (int argc, char **argv)
                        }
                        else {
                                printf ("%s: Critical Process Count must be an integer!\n\n",
                        }
                        else {
                                printf ("%s: Critical Process Count must be an integer!\n\n",
-                                       my_basename (argv[0]));
+                                       progname);
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -345,7 +345,7 @@ process_arguments (int argc, char **argv)
                        }
                        else {
                                printf ("%s: Warning Process Count must be an integer!\n\n",
                        }
                        else {
                                printf ("%s: Warning Process Count must be an integer!\n\n",
-                                       my_basename (argv[0]));
+                                       progname);
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -356,7 +356,7 @@ process_arguments (int argc, char **argv)
                                break;
                        }
                        printf ("%s: Parent Process ID must be an integer!\n\n",
                                break;
                        }
                        printf ("%s: Parent Process ID must be an integer!\n\n",
-                               my_basename (argv[0]));
+                               progname);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 's':                                                                       /* status */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 's':                                                                       /* status */
@@ -462,7 +462,7 @@ if (wmax >= 0 && wmin == -1)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
index c346dc77d43de39a3bfb7dabf1dd9550be4d0c23..0762896bc26de8d88887023d3854fa4925edd3bd 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_radius"
+const char *progname = "check_radius"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #define AUTHORS "Robert August Vincent II/Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2001"
 #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.
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
@@ -264,14 +264,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
                        exit (OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
@@ -324,7 +324,7 @@ process_arguments (int argc, char **argv)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHORS, EMAIL, SUMMARY);
@@ -347,5 +347,5 @@ print_usage (void)
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }
 }
index c553352c22f1cd2d0e2f795d86c78e41d416fd21..a91093734311eeb617131a57c2f763070bcc8ca6 100644 (file)
@@ -48,7 +48,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_real"
+const char *progname = "check_real";
 
 #define PORT   554
 #define EXPECT "RTSP/1."
 
 #define PORT   554
 #define EXPECT "RTSP/1."
@@ -370,7 +370,7 @@ process_arguments (int argc, char **argv)
                        }
                        break;
                case 'V':                                                                       /* version */
                        }
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -410,7 +410,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Pedro Leite (leite@cic.ua.pt)/Karl DeBisschop\n\n"
                 "This plugin tests the REAL service on the specified host.\n\n");
        printf
                ("Copyright (c) 2000 Pedro Leite (leite@cic.ua.pt)/Karl DeBisschop\n\n"
                 "This plugin tests the REAL service on the specified host.\n\n");
@@ -454,7 +454,7 @@ print_usage (void)
                ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n"
                 "            [-t timeout] [-v]\n"
                 "       %s --help\n"
                ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n"
                 "            [-t timeout] [-v]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 
 
 }
 
 
index 6f174299aa02daba82ebd822a5c3a878af35ee1c..d8b90597c8ad3489a688faefab2ea6b63ede2447 100644 (file)
@@ -39,7 +39,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_smtp"
+const char *progname = "check_smtp";
 
 #define SMTP_PORT      25
 #define SMTP_EXPECT     "220"
 
 #define SMTP_PORT      25
 #define SMTP_EXPECT     "220"
@@ -294,7 +294,7 @@ process_arguments (int argc, char **argv)
                        }
                        break;
                case 'V':                                                                       /* version */
                        }
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -340,7 +340,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin test the SMTP service on the specified host.\n\n");
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin test the SMTP service on the specified host.\n\n");
@@ -381,5 +381,5 @@ print_usage (void)
        printf
                ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n"
                 "       %s --help\n"
        printf
                ("Usage: %s -H host [-e expect] [-p port] [-f from addr] [-w warn] [-c crit] [-t timeout] [-v]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 }
index cb13bc9ae3e22cb3a5fd893f832a46da9e95c9a5..b0059845358cbd19755a208462e16828759aadf9 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_snmp"
+const char *progname = "check_snmp";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
@@ -475,7 +475,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK); 
                case 'V':       /* version */
                        print_help ();
                        exit (STATE_OK); 
                case 'V':       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'v': /* verbose */
                        verbose = TRUE;
                        exit (STATE_OK);
                case 'v': /* verbose */
                        verbose = TRUE;
@@ -753,10 +753,9 @@ validate_arguments ()
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
        printf
-               ("Copyright (c) %s %s <%s>\n\n%s\n",
-                COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
+               ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        print_usage ();
        printf
                ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n" NOTES "\n", 
        print_usage ();
        printf
                ("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n" NOTES "\n", 
@@ -771,7 +770,7 @@ print_usage (void)
                ("Usage:\n" " %s %s\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
                ("Usage:\n" " %s %s\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
-                PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                progname, OPTIONS, progname, progname);
 }
 \f
 
 }
 \f
 
index 4637bcee0c781280567a8308de4bdc7dc6231886..faaead6a36725ef8e27a286067b567a169ec07de 100644 (file)
@@ -15,7 +15,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_ssh"
+const char *progname = "check_ssh";
 #define REVISION "$Revision$"
 
 #ifndef MSG_DONTWAIT
 #define REVISION "$Revision$"
 
 #ifndef MSG_DONTWAIT
@@ -95,7 +95,7 @@ process_arguments (int argc, char **argv)
                case '?':                                                                       /* help */
                        usage ("");
                case 'V':                                                                       /* version */
                case '?':                                                                       /* help */
                        usage ("");
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -238,7 +238,7 @@ ssh_connect (char *haddr, short hport)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf ("Copyright (c) 1999 Remi Paulmier (remi@sinfomic.fr)\n\n");
        print_usage ();
        printf ("by default, port is %d\n", SSH_DFL_PORT);
        printf ("Copyright (c) 1999 Remi Paulmier (remi@sinfomic.fr)\n\n");
        print_usage ();
        printf ("by default, port is %d\n", SSH_DFL_PORT);
@@ -251,7 +251,7 @@ print_usage (void)
                ("Usage:\n"
                 " %s -t [timeout] -p [port] <host>\n"
                 " %s -V prints version info\n"
                ("Usage:\n"
                 " %s -t [timeout] -p [port] <host>\n"
                 " %s -V prints version info\n"
-                " %s -h prints more detailed help\n", PROGNAME, PROGNAME, PROGNAME);
+                " %s -h prints more detailed help\n", progname, progname, progname);
 }
 
 /* end of check_ssh.c */
 }
 
 /* end of check_ssh.c */
index 968779dc37d633f628d42643ddb5680740bffc46..b213c964fb805d7ad52ce5eeaeaa8ab3de88b459 100644 (file)
@@ -29,7 +29,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-#define PROGNAME "check_swap"
+const char *progname = "check_swap";
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 #define AUTHOR "Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "2000-2002"
 #define AUTHOR "Karl DeBisschop"
@@ -267,7 +267,7 @@ process_arguments (int argc, char **argv)
                        verbose = TRUE;
                        break;
                case 'V':                                                                       /* version */
                        verbose = TRUE;
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -336,7 +336,7 @@ print_usage (void)
                 " %s [-a] -w <bytes_free> -c <bytes_free>\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
                 " %s [-a] -w <bytes_free> -c <bytes_free>\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
-                PROGNAME, PROGNAME, PROGNAME, PROGNAME);
+                progname, progname, progname, progname);
 }
 
 
 }
 
 
@@ -346,7 +346,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        print_usage ();
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        print_usage ();
index 32d38b421ab39d6679740cc67b860fd6d325a4f6..43580b6c6815044e3afc42ef5526212c1c2d7871 100644 (file)
@@ -22,7 +22,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGRAM check_tcp
+/* const char *progname = "check_tcp"; */
 #define REVISION "$Revision$"
 #define DESCRIPTION "Check a TCP port"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define DESCRIPTION "Check a TCP port"
 #define AUTHOR "Ethan Galstad"
@@ -65,7 +65,7 @@ int process_arguments (int, char **);
 void print_usage (void);
 void print_help (void);
 
 void print_usage (void);
 void print_help (void);
 
-char *PROGNAME = NULL;
+char *progname = NULL;
 char *SERVICE = NULL;
 char *SEND = NULL;
 char *EXPECT = NULL;
 char *SERVICE = NULL;
 char *SEND = NULL;
 char *EXPECT = NULL;
@@ -103,7 +103,7 @@ main (int argc, char **argv)
        struct timeval tv;
 
        if (strstr (argv[0], "check_udp")) {
        struct timeval tv;
 
        if (strstr (argv[0], "check_udp")) {
-               asprintf (&PROGNAME, "check_udp");
+               asprintf (&progname, "check_udp");
                asprintf (&SERVICE, "UDP");
                SEND = NULL;
                EXPECT = NULL;
                asprintf (&SERVICE, "UDP");
                SEND = NULL;
                EXPECT = NULL;
@@ -112,7 +112,7 @@ main (int argc, char **argv)
                PORT = 0;
        }
        else if (strstr (argv[0], "check_tcp")) {
                PORT = 0;
        }
        else if (strstr (argv[0], "check_tcp")) {
-               asprintf (&PROGNAME, "check_tcp");
+               asprintf (&progname, "check_tcp");
                asprintf (&SERVICE, "TCP");
                SEND = NULL;
                EXPECT = NULL;
                asprintf (&SERVICE, "TCP");
                SEND = NULL;
                EXPECT = NULL;
@@ -121,7 +121,7 @@ main (int argc, char **argv)
                PORT = 0;
        }
        else if (strstr (argv[0], "check_ftp")) {
                PORT = 0;
        }
        else if (strstr (argv[0], "check_ftp")) {
-               asprintf (&PROGNAME, "check_ftp");
+               asprintf (&progname, "check_ftp");
                asprintf (&SERVICE, "FTP");
                SEND = NULL;
                asprintf (&EXPECT, "220");
                asprintf (&SERVICE, "FTP");
                SEND = NULL;
                asprintf (&EXPECT, "220");
@@ -130,7 +130,7 @@ main (int argc, char **argv)
                PORT = 21;
        }
        else if (strstr (argv[0], "check_smtp")) {
                PORT = 21;
        }
        else if (strstr (argv[0], "check_smtp")) {
-               asprintf (&PROGNAME, "check_smtp");
+               asprintf (&progname, "check_smtp");
                asprintf (&SERVICE, "SMTP");
                SEND = NULL;
                asprintf (&EXPECT, "220");
                asprintf (&SERVICE, "SMTP");
                SEND = NULL;
                asprintf (&EXPECT, "220");
@@ -139,7 +139,7 @@ main (int argc, char **argv)
                PORT = 25;
        }
        else if (strstr (argv[0], "check_pop")) {
                PORT = 25;
        }
        else if (strstr (argv[0], "check_pop")) {
-               asprintf (&PROGNAME, "check_pop");
+               asprintf (&progname, "check_pop");
                asprintf (&SERVICE, "POP");
                SEND = NULL;
                asprintf (&EXPECT, "+OK");
                asprintf (&SERVICE, "POP");
                SEND = NULL;
                asprintf (&EXPECT, "+OK");
@@ -148,7 +148,7 @@ main (int argc, char **argv)
                PORT = 110;
        }
        else if (strstr (argv[0], "check_imap")) {
                PORT = 110;
        }
        else if (strstr (argv[0], "check_imap")) {
-               asprintf (&PROGNAME, "check_imap");
+               asprintf (&progname, "check_imap");
                asprintf (&SERVICE, "IMAP");
                SEND = NULL;
                asprintf (&EXPECT, "* OK");
                asprintf (&SERVICE, "IMAP");
                SEND = NULL;
                asprintf (&EXPECT, "* OK");
@@ -158,7 +158,7 @@ main (int argc, char **argv)
        }
 #ifdef HAVE_SSL
        else if (strstr(argv[0],"check_simap")) {
        }
 #ifdef HAVE_SSL
        else if (strstr(argv[0],"check_simap")) {
-               asprintf (&PROGNAME, "check_simap");
+               asprintf (&progname, "check_simap");
                asprintf (&SERVICE, "SIMAP");
                SEND=NULL;
                asprintf (&EXPECT, "* OK");
                asprintf (&SERVICE, "SIMAP");
                SEND=NULL;
                asprintf (&EXPECT, "* OK");
@@ -168,7 +168,7 @@ main (int argc, char **argv)
                PORT=993;
        }
        else if (strstr(argv[0],"check_spop")) {
                PORT=993;
        }
        else if (strstr(argv[0],"check_spop")) {
-               asprintf (&PROGNAME, "check_spop");
+               asprintf (&progname, "check_spop");
                asprintf (&SERVICE, "SPOP");
                SEND=NULL;
                asprintf (&EXPECT, "+OK");
                asprintf (&SERVICE, "SPOP");
                SEND=NULL;
                asprintf (&EXPECT, "+OK");
@@ -179,7 +179,7 @@ main (int argc, char **argv)
        }
 #endif
        else if (strstr (argv[0], "check_nntp")) {
        }
 #endif
        else if (strstr (argv[0], "check_nntp")) {
-               asprintf (&PROGNAME, "check_nntp");
+               asprintf (&progname, "check_nntp");
                asprintf (&SERVICE, "NNTP");
                SEND = NULL;
                EXPECT = NULL;
                asprintf (&SERVICE, "NNTP");
                SEND = NULL;
                EXPECT = NULL;
@@ -387,21 +387,21 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                 /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                 /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                 /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                 /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                 /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                 /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'v':                 /* verbose mode */
                        verbose = TRUE;
                        break;
                case 'H':                 /* hostname */
                        if (is_host (optarg) == FALSE)
                        exit (STATE_OK);
                case 'v':                 /* verbose mode */
                        verbose = TRUE;
                        break;
                case 'H':                 /* hostname */
                        if (is_host (optarg) == FALSE)
-                               usage ("Invalid host name/address\n");
+                               usage2 ("invalid host name or address", optarg);
                        server_address = optarg;
                        break;
                case 'c':                 /* critical */
                        server_address = optarg;
                        break;
                case 'c':                 /* critical */
@@ -479,7 +479,7 @@ print_usage (void)
 {
        printf
                ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n"
 {
        printf
                ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n"
-                "         [-e expect] [-W wait] [-t to_sec] [-v]\n", PROGNAME);
+                "         [-e expect] [-W wait] [-t to_sec] [-v]\n", progname);
 }
 
 
 }
 
 
@@ -489,7 +489,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"
                 "This plugin tests %s connections with the specified host.\n\n",
        printf
                ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"
                 "This plugin tests %s connections with the specified host.\n\n",
index c7405f61bceabf3dfcd66b9eaec73004a486e535..e4bd26d7f7fc24c5cb34eb5836d08e300dbcc07f 100644 (file)
@@ -39,7 +39,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_time"
+const char *progname = "check_time";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
@@ -209,7 +209,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'H':                                                                       /* hostname */
                        if (is_host (optarg) == FALSE)
                        exit (STATE_OK);
                case 'H':                                                                       /* hostname */
                        if (is_host (optarg) == FALSE)
@@ -306,7 +306,7 @@ print_usage (void)
                 "           [-W connect_time] [-C connect_time] [-t timeout]\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
                 "           [-W connect_time] [-C connect_time] [-t timeout]\n"
                 " %s (-h | --help) for detailed help\n"
                 " %s (-V | --version) for version information\n",
-                PROGNAME, PROGNAME, PROGNAME);
+                progname, progname, progname);
 }
 
 
 }
 
 
@@ -316,7 +316,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
index f6b528dcaaa3ced63e5ac30d0d59f835ceb366a4..8626f8c4816a81db8fa1469920345460cc8197cf 100644 (file)
@@ -41,7 +41,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_udp"
+const char *progname = "check_udp";
 
 int warning_time = 0;
 int check_warning_time = FALSE;
 
 int warning_time = 0;
 int check_warning_time = FALSE;
@@ -163,14 +163,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
                        exit (STATE_OK);
                case 'v':                                                                       /* verbose mode */
                        verbose = TRUE;
@@ -233,7 +233,7 @@ print_usage (void)
 {
        printf
                ("Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n"
 {
        printf
                ("Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n"
-                "         [-e expect] [-s send] [-t to_sec] [-v]\n", PROGNAME);
+                "         [-e expect] [-s send] [-t to_sec] [-v]\n", progname);
 }
 
 
 }
 
 
@@ -243,7 +243,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"
                 "This plugin tests an UDP connection with the specified host.\n\n");
        printf
                ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n"
                 "This plugin tests an UDP connection with the specified host.\n\n");
index 470e3be749ea4acd02221429db8b7b9e8deed4d7..4c9032268f8a940e4cefd758aefd1269dae4e78b 100644 (file)
@@ -56,7 +56,7 @@
 #include "netutils.h"
 #include "utils.h"
 
 #include "netutils.h"
 #include "utils.h"
 
-#define PROGNAME "check_ups"
+const char *progname = "check_ups";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
@@ -64,7 +64,7 @@
 
 #define CHECK_NONE     0
 
 
 #define CHECK_NONE     0
 
-#define PORT   3305
+#define PORT     3493
 
 #define UPS_NONE     0   /* no supported options */
 #define UPS_UTILITY  1   /* supports utility line voltage */
 
 #define UPS_NONE     0   /* no supported options */
 #define UPS_UTILITY  1   /* supports utility line voltage */
@@ -535,7 +535,7 @@ process_arguments (int argc, char **argv)
                        }
                        break;
                case 'V':                                                                       /* version */
                        }
                        break;
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'h':                                                                       /* help */
                        print_help ();
@@ -571,7 +571,7 @@ validate_arguments (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n"
                 "This plugin tests the UPS service on the specified host.\n"
        printf
                ("Copyright (c) 2000 Tom Shields/Karl DeBisschop\n\n"
                 "This plugin tests the UPS service on the specified host.\n"
@@ -611,5 +611,5 @@ print_usage (void)
                ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n"
                 "            [-t timeout] [-v]\n"
                 "       %s --help\n"
                ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n"
                 "            [-t timeout] [-v]\n"
                 "       %s --help\n"
-                "       %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+                "       %s --version\n", progname, progname, progname);
 }
 }
index e39e0d2bae25eb0b99f17db8811000a3589118fa..565d9e7032ca1ac7c0e196a2c06a83ff526d53e2 100644 (file)
@@ -48,7 +48,7 @@
 #include "popen.h"
 #include "utils.h"
 
 #include "popen.h"
 #include "utils.h"
 
-#define PROGNAME "check_users"
+const char *progname = "check_users";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Ethan Galstad"
@@ -162,14 +162,14 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", PROGNAME, optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (STATE_OK);
                case 'c':                                                                       /* critical */
                        if (!is_intnonneg (optarg))
                        exit (STATE_OK);
                case 'c':                                                                       /* critical */
                        if (!is_intnonneg (optarg))
@@ -207,7 +207,7 @@ process_arguments (int argc, char **argv)
 void
 print_usage (void)
 {
 void
 print_usage (void)
 {
-       printf ("Usage: %s -w <users> -c <users>\n", PROGNAME);
+       printf ("Usage: %s -w <users> -c <users>\n", progname);
 }
 
 
 }
 
 
@@ -217,7 +217,7 @@ print_usage (void)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) " COPYRIGHT " " AUTHOR "(" EMAIL ")\n\n"
                 "This plugin checks the number of users currently logged in on the local\n"
        printf
                ("Copyright (c) " COPYRIGHT " " AUTHOR "(" EMAIL ")\n\n"
                 "This plugin checks the number of users currently logged in on the local\n"
index 7eeab22cc9d48af2e2ef50598b3e6ad0811c0088..767abf4fd6d4d3be28dfaeaebad1cb72e879210c 100644 (file)
@@ -33,7 +33,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "check_vsz"
+const char *progname = "check_vsz";
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "1999-2002"
 #define AUTHOR "Karl DeBisschop"
@@ -45,8 +45,8 @@
 #include "utils.h"
 
 int process_arguments (int argc, char **argv);
 #include "utils.h"
 
 int process_arguments (int argc, char **argv);
-void print_help (char *cmd);
-void print_usage (char *cmd);
+void print_help (const char *cmd);
+void print_usage (const char *cmd);
 
 int warn = -1;
 int crit = -1;
 
 int warn = -1;
 int crit = -1;
@@ -64,8 +64,8 @@ main (int argc, char **argv)
        char *message = "";
 
        if (!process_arguments (argc, argv)) {
        char *message = "";
 
        if (!process_arguments (argc, argv)) {
-               printf ("%s: failure parsing arguments\n", my_basename (argv[0]));
-               print_help (my_basename (argv[0]));
+               printf ("%s: failure parsing arguments\n", progname);
+               print_help (progname);
                return STATE_UNKNOWN;
        }
 
                return STATE_UNKNOWN;
        }
 
@@ -166,20 +166,20 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':                                                                       /* help */
 
                switch (c) {
                case '?':                                                                       /* help */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
-                       print_usage (my_basename (argv[0]));
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
+                       print_usage (progname);
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
-                       print_help (my_basename (argv[0]));
+                       print_help (progname);
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'c':                                                                       /* critical threshold */
                        if (!is_intnonneg (optarg)) {
                                printf ("%s: critical threshold must be an integer: %s\n",
                        exit (STATE_OK);
                case 'c':                                                                       /* critical threshold */
                        if (!is_intnonneg (optarg)) {
                                printf ("%s: critical threshold must be an integer: %s\n",
-                                                               my_basename (argv[0]), optarg);
-                               print_usage (my_basename (argv[0]));
+                                                               progname, optarg);
+                               print_usage (progname);
                                exit (STATE_UNKNOWN);
                        }
                        crit = atoi (optarg);
                                exit (STATE_UNKNOWN);
                        }
                        crit = atoi (optarg);
@@ -187,8 +187,8 @@ process_arguments (int argc, char **argv)
                case 'w':                                                                       /* warning threshold */
                        if (!is_intnonneg (optarg)) {
                                printf ("%s: warning threshold must be an integer: %s\n",
                case 'w':                                                                       /* warning threshold */
                        if (!is_intnonneg (optarg)) {
                                printf ("%s: warning threshold must be an integer: %s\n",
-                                                               my_basename (argv[0]), optarg);
-                               print_usage (my_basename (argv[0]));
+                                                               progname, optarg);
+                               print_usage (progname);
                                exit (STATE_UNKNOWN);
                        }
                        warn = atoi (optarg);
                                exit (STATE_UNKNOWN);
                        }
                        warn = atoi (optarg);
@@ -203,8 +203,8 @@ process_arguments (int argc, char **argv)
        if (warn == -1) {
                if (!is_intnonneg (argv[c])) {
                        printf ("%s: critical threshold must be an integer: %s\n",
        if (warn == -1) {
                if (!is_intnonneg (argv[c])) {
                        printf ("%s: critical threshold must be an integer: %s\n",
-                                                       PROGNAME, argv[c]);
-                       print_usage (PROGNAME);
+                                                       progname, argv[c]);
+                       print_usage (progname);
                        exit (STATE_UNKNOWN);
                }
                warn = atoi (argv[c++]);
                        exit (STATE_UNKNOWN);
                }
                warn = atoi (argv[c++]);
@@ -213,8 +213,8 @@ process_arguments (int argc, char **argv)
        if (crit == -1) {
                if (!is_intnonneg (argv[c])) {
                        printf ("%s: critical threshold must be an integer: %s\n",
        if (crit == -1) {
                if (!is_intnonneg (argv[c])) {
                        printf ("%s: critical threshold must be an integer: %s\n",
-                                                       PROGNAME, argv[c]);
-                       print_usage (PROGNAME);
+                                                       progname, argv[c]);
+                       print_usage (progname);
                        exit (STATE_UNKNOWN);
                }
                crit = atoi (argv[c++]);
                        exit (STATE_UNKNOWN);
                }
                crit = atoi (argv[c++]);
@@ -227,14 +227,14 @@ process_arguments (int argc, char **argv)
 }
 
 void
 }
 
 void
-print_usage (char *cmd)
+print_usage (const char *cmd)
 {
        printf ("Usage: %s -w <wsize> -c <csize> [-C command]\n"
                                        "       %s --help\n" "       %s --version\n", cmd, cmd, cmd);
 }
 
 void
 {
        printf ("Usage: %s -w <wsize> -c <csize> [-C command]\n"
                                        "       %s --help\n" "       %s --version\n", cmd, cmd, cmd);
 }
 
 void
-print_help (char *cmd)
+print_help (const char *cmd)
 {
        print_revision ("check_vsz", "$Revision$");
        printf
 {
        print_revision ("check_vsz", "$Revision$");
        printf
index c76f5ca08cddddddc6bd50fdeb48c1cc0dc24741..454ac963570f9705678330d7b7e99b75f4375df6 100644 (file)
@@ -23,7 +23,7 @@
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
-#define PROGNAME "negate"
+const char *progname = "negate";
 #define REVISION "$Revision$"
 #define COPYRIGHT "2002"
 #define AUTHOR "Karl DeBisschop"
 #define REVISION "$Revision$"
 #define COPYRIGHT "2002"
 #define AUTHOR "Karl DeBisschop"
@@ -52,10 +52,10 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n"
 
 char *command_line;
 
 
 char *command_line;
 
-static int process_arguments (int, char **);
-static int validate_arguments (void);
-static void print_usage (void);
-static void print_help (void);
+int process_arguments (int, char **);
+int validate_arguments (void);
+void print_usage (void);
+void print_help (void);
 \f
 /******************************************************************************
 
 \f
 /******************************************************************************
 
@@ -76,7 +76,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
 <manvolnum>5<manvolnum>
 </refmeta>
 <refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
 <refpurpose>&SUMMARY;</refpurpose>
 </refnamdiv>
 </refentry>
@@ -174,7 +174,7 @@ main (int argc, char **argv)
 void
 print_help (void)
 {
 void
 print_help (void)
 {
-       print_revision (PROGNAME, REVISION);
+       print_revision (progname, REVISION);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
        printf
                ("Copyright (c) %s %s <%s>\n\n%s\n",
                 COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
@@ -196,7 +196,7 @@ print_usage (void)
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
                                        " %s -h for detailed help\n"
                                        " %s -V for version information\n",
 #endif
-                                       PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+                                       progname, OPTIONS, progname, progname);
 }
 \f
 
 }
 \f
 
@@ -249,7 +249,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (EXIT_SUCCESS);
                case 'V':     /* version */
                        print_help ();
                        exit (EXIT_SUCCESS);
                case 'V':     /* version */
-                       print_revision (PROGNAME, REVISION);
+                       print_revision (progname, REVISION);
                        exit (EXIT_SUCCESS);
                case 't':     /* timeout period */
                        if (!is_integer (optarg))
                        exit (EXIT_SUCCESS);
                case 't':     /* timeout period */
                        if (!is_integer (optarg))
index 9835c824d4c1fbf38d2dc0e1f4324b7d9ab20d47..8d6fc3adf1fe9806ffde14f01ecf748017770707 100644 (file)
  *
  *****************************************************************************/
 
  *
  *****************************************************************************/
 
+const char *progname = "urlize";
+
 #include "common.h"
 #include "utils.h"
 #include "popen.h"
 
 #include "common.h"
 #include "utils.h"
 #include "popen.h"
 
-void print_usage (char *);
-void print_help (char *);
+void print_usage (const char *);
+void print_help (const char *);
 
 int
 main (int argc, char **argv)
 
 int
 main (int argc, char **argv)
@@ -52,7 +54,7 @@ main (int argc, char **argv)
        char input_buffer[MAX_INPUT_BUFFER];
 
        if (argc < 2) {
        char input_buffer[MAX_INPUT_BUFFER];
 
        if (argc < 2) {
-               print_usage (my_basename (argv[0]));
+               print_usage (progname);
                exit (STATE_UNKNOWN);
        }
 
                exit (STATE_UNKNOWN);
        }
 
@@ -62,12 +64,12 @@ main (int argc, char **argv)
        }
 
        if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) {
        }
 
        if (!strcmp (argv[1], "-V") || !strcmp (argv[1], "--version")) {
-               print_revision (my_basename (argv[0]), "$Revision$");
+               print_revision (progname, "$Revision$");
                exit (STATE_OK);
        }
 
        if (argc < 2) {
                exit (STATE_OK);
        }
 
        if (argc < 2) {
-               print_usage (my_basename (argv[0]));
+               print_usage (progname);
                exit (STATE_UNKNOWN);
        }
 
                exit (STATE_UNKNOWN);
        }
 
@@ -120,16 +122,15 @@ main (int argc, char **argv)
 }
 
 void
 }
 
 void
-print_usage (char *cmd)
+print_usage (const char *cmd)
 {
 {
-       printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n",
-                                       my_basename (cmd));
+       printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n",       cmd);
 }
 
 void
 }
 
 void
-print_help (char *cmd)
+print_help (const char *cmd)
 {
 {
-       print_revision ("urlize", "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Karl DeBisschop (kdebiss@alum.mit.edu)\n\n"
                 "\nThis plugin wraps the text output of another command (plugin) in HTML\n"
        printf
                ("Copyright (c) 2000 Karl DeBisschop (kdebiss@alum.mit.edu)\n\n"
                 "\nThis plugin wraps the text output of another command (plugin) in HTML\n"
index 22020d72eb16c5958908e9fc885cf68be05d0e1b..474206b93638bded27106ec8efbdfb7e1d40c15b 100644 (file)
 #include <limits.h>
 
 extern int timeout_interval;
 #include <limits.h>
 
 extern int timeout_interval;
+extern const char *progname;
 
 
-char *my_basename (char *);
 void support (void);
 char *clean_revstring (const char *);
 void support (void);
 char *clean_revstring (const char *);
-void print_revision (char *, const char *);
+void print_revision (const char *, const char *);
 void terminate (int, const char *fmt, ...);
 RETSIGTYPE timeout_alarm_handler (int);
 
 void terminate (int, const char *fmt, ...);
 RETSIGTYPE timeout_alarm_handler (int);
 
@@ -57,8 +57,6 @@ char *strpcat (char *dest, const char *src, const char *str);
 #define STRLEN 64
 #define TXTBLK 128
 
 #define STRLEN 64
 #define TXTBLK 128
 
-#define max(a,b) ((a)>(b))?(a):(b)
-
 /* **************************************************************************
  * max_state(STATE_x, STATE_y)
  * compares STATE_x to  STATE_y and returns result based on the following
 /* **************************************************************************
  * max_state(STATE_x, STATE_y)
  * 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);
  ****************************************************************************/
 
 int
  ****************************************************************************/
 
 int
-max_state(int a, int b)
+max_state (int a, int b)
 {
        if (a == STATE_CRITICAL || b == STATE_CRITICAL)
                return STATE_CRITICAL;
 {
        if (a == STATE_CRITICAL || b == STATE_CRITICAL)
                return STATE_CRITICAL;
@@ -84,13 +82,26 @@ max_state(int a, int b)
                return max (a, b);
 }
 
                return max (a, b);
 }
 
-char *
-my_basename (char *path)
+void usage (char *msg)
 {
 {
-       if (!strstr (path, "/"))
-               return path;
-       else
-               return 1 + strrchr (path, '/');
+       printf (msg);
+       print_usage ();
+       exit (STATE_UNKNOWN);
+}
+
+void usage2(char *msg, char *arg)
+{
+       printf ("%s: %s - %s\n",progname,msg,arg);
+       print_usage ();
+       exit (STATE_UNKNOWN);
+}
+
+void
+usage3 (char *msg, char arg)
+{
+       printf ("%s: %s - %c\n", progname, msg, arg);
+       print_usage();
+       exit (STATE_UNKNOWN);
 }
 
 
 }
 
 
@@ -115,14 +126,14 @@ clean_revstring (const char *revstring)
 }
 
 void
 }
 
 void
-print_revision (char *command_name, const char *revision_string)
+print_revision (const char *command_name, const char *revision_string)
 {
        char plugin_revision[STRLEN];
 
        if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1)
                strncpy (plugin_revision, "N/A", STRLEN);
        printf ("%s (nagios-plugins %s) %s\n",
 {
        char plugin_revision[STRLEN];
 
        if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1)
                strncpy (plugin_revision, "N/A", STRLEN);
        printf ("%s (nagios-plugins %s) %s\n",
-                                       my_basename (command_name), VERSION, plugin_revision);
+                                       progname, VERSION, plugin_revision);
        printf
                ("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n"
                 "copies of the plugins under the terms of the GNU General Public License.\n"
        printf
                ("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n"
                 "copies of the plugins under the terms of the GNU General Public License.\n"
index 96bf9b2f3b6d95dbea0a720680e756867116dda4..317ec46fba6cbd9ebc625b8b7a15e9129766be18 100644 (file)
@@ -16,7 +16,7 @@ suite of plugins. */
 char *my_basename (char *);
 void support (void);
 char *clean_revstring (const char *revstring);
 char *my_basename (char *);
 void support (void);
 char *clean_revstring (const char *revstring);
-void print_revision (char *, const char *);
+void print_revision (const char *, const char *);
 void terminate (int result, char *msg, ...);
 extern RETSIGTYPE timeout_alarm_handler (int);
 
 void terminate (int result, char *msg, ...);
 extern RETSIGTYPE timeout_alarm_handler (int);
 
@@ -69,28 +69,14 @@ char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */
 char *strpcpy (char *dest, const char *src, const char *str);
 char *strpcat (char *dest, const char *src, const char *str);
 
 char *strpcpy (char *dest, const char *src, const char *str);
 char *strpcat (char *dest, const char *src, const char *str);
 
-/* Handle comparisions for STATE_* */
-int max_state(int, int);
+int max_state (int a, int b);
 
 
-#define max(a,b) ((a)>(b))?(a):(b)
+void usage (char *msg);
+void usage2(char *msg, char *arg);
+void usage3(char *msg, char arg);
 
 
-#define usage(msg) {\
- printf(msg);\
- print_usage();\
- exit(STATE_UNKNOWN);\
-}
 
 
-#define usage2(msg,arg) {\
- printf("%s: %s - %s\n",PROGNAME,msg,arg);\
- print_usage();\
- exit(STATE_UNKNOWN);\
-}
-
-#define usage3(msg,arg) {\
- printf("%s: %s - %c\n",PROGNAME,msg,arg);\
- print_usage();\
- exit(STATE_UNKNOWN);\
-}
+#define max(a,b) (((a)>(b))?(a):(b))
 
 #define state_text(a) \
 (a)==0?"OK":\
 
 #define state_text(a) \
 (a)==0?"OK":\