summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de5650f)
raw | patch | inline | side by side (parent: de5650f)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Mon, 13 Jan 2003 12:15:16 +0000 (12:15 +0000) | ||
committer | Karl 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:
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 59e417861fcac568f13e3c36cf79b5e04dc2f9e9..5c5053092541f0c5f98644254cacdfcdc855a6c8 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
*
*****************************************************************************/
-#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"
#include "utils.h"
#include <time.h>
-#define PROGNAME "check_by_ssh"
-
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);
print_usage ();
exit (STATE_UNKNOWN);
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
- print_help (PROGNAME);
+ print_help (progname);
exit (STATE_OK);
case 'v': /* help */
verbose = TRUE;
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++];
}
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)
- 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;
}
void
-print_help (char *cmd)
+print_help (const char *cmd)
{
print_revision (cmd, "$Revision$");
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index e4f86321d2e46aaaecead0812d8278499c047b07..5c6f1e12e8bdb45985d0ac535d8c79bdcab1de42 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
#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"
}
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
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
("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);
}
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 553430596656601b7fb2923638176ef04b79c970..3c1cfef9519c51ffb692758749be38e69c0b818f 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
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;
exclude_device = optarg;
break;
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
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
("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);
}
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 714ecab077530ad01e748112cc6d36a213631a35..3462701a07f6ba9a4caf73b492042cfc69642683 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
#include "popen.h"
#include "utils.h"
-#define PROGNAME "check_dns"
+const char *progname = "check_dns";
#define REVISION "$Revision$"
#define COPYRIGHT "2000-2002"
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_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'v': /* version */
verbose = TRUE;
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)
{
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n");
print_usage ();
printf
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c
index c2a5b7eb859294b7bfcfd05d25d52ddab3bbacc0..ca37e98e91b9d976862c1c1246c0ff3ba1cdd3ef 100644 (file)
--- a/plugins/check_dummy.c
+++ b/plugins/check_dummy.c
#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)
}
void
-print_help (char *cmd)
+print_help (const char *cmd)
{
print_revision (cmd, "$Revision$");
printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n"
}
void
-print_usage (char *cmd)
+print_usage (const char *cmd)
{
printf ("Usage: %s <integer state>\n", cmd);
}
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index da11e678091d36d319f10bd2ee25bf33d7597f94..8887afe8eeaf647fe695da34b07d244aac18afdd 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
#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% */
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_revision (my_basename (argv[0]), "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'v': /* verbose mode */
verbose = TRUE;
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",
- PROGNAME, arg);
+ progname, arg);
}
if (arg2 && strstr (arg2, "%")) {
void
print_usage (void)
{
- printf ("Usage: %s <host_address>\n", PROGNAME);
+ printf ("Usage: %s <host_address>\n", progname);
}
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"
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 42b4bb544d3e75b05637cc044159af57721c61e2..a262fc23cb1440fc07a6efbede32962d22aa580f 100644 (file)
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
#include "popen.h"
#include "utils.h"
-#define PROGNAME "check_hpjd"
+const char *progname = "check_hpjd"
#define REVISION "$Revision$"
#define COPYRIGHT "2000-2002"
community = optarg;
break;
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
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
("Usage: %s -H host [-C community]\n"
" %s --help\n"
- " %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+ " %s --version\n", progname, progname, progname);
}
diff --git a/plugins/check_http.c b/plugins/check_http.c
index bbc76daeebb59d516b9e7dfb99deb47c0a0bf5d9..de7a2db7f7b70b70d3917874ddca0a2908df03fc 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
*
*****************************************************************************/
-#define PROGNAME "check_http"
+const char *progname = "check_http";
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2001"
#define AUTHORS "Ethan Galstad/Karl DeBisschop"
exit (STATE_OK);
break;
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
break;
case 't': /* timeout period */
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);
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
- PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+ progname, OPTIONS, progname, progname);
}
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 213dc4a8302b8f6d2b58429b6961db0cbfc71905..6491e5ba1f4703a25d25abb69d027e242f96f317 100644 (file)
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
*
*****************************************************************************/
-#define PROGNAME "check_ldap"
+const char *progname = "check_ldap";
#define REVISION "$Revision$"
#include "config.h"
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;
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))
/* function print_help */
-static void
+void
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");
}
-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"
- "(Note: all times are in seconds.)\n", PROGNAME);
+ "(Note: all times are in seconds.)\n", progname);
}
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 5caffbe879d87740322164a9b4ab80668efa2ef1..896e356b6114098bcc9a217e091de310ff4952c7 100644 (file)
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
#endif
-#define PROGNAME "check_load"
+const char *progname = "check_load";
int process_arguments (int argc, char **argv);
int validate_arguments (void);
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 ();
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"
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 80c9b00894bd2b0766aad18214a11ed5482bf64d..e26e2e66b7ccfae5e513ad0fce8d3773fd9f6242 100644 (file)
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
*
*****************************************************************************/
-#define PROGNAME "check_mrtg"
+const char *progname = "check_mrtg";
#define REVISION "$Revision$"
#define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
units_label = optarg;
break;
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
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) {
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");
" %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)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
#include "common.h"
#include "utils.h"
-#define PROGNAME "check_mrtgtraf"
+const char *progname = "check_mrtgtraf";
int process_arguments (int, char **);
int validate_arguments (void);
&outgoing_warning_threshold);
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
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");
("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);
}
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index a4a2ed1d8ffbfc46b557d2d9e860f4bee100f804..df2ed002a8c7587def18324b1875fa98260adbd0 100644 (file)
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
* This plugin is for testing a mysql server.
******************************************************************************/
-#define PROGNAME "check_mysql"
+const char *progname = "check_mysql"
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2002"
db_port = atoi (optarg);
break;
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
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
("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);
}
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index d19445a55b9389ff7f6603366a2e56269b846700..5c4cd4a3a7d769126b7bea5df1d25f45a612c4e4 100644 (file)
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
#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);
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;
}
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_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'F': /* hostname */
status_log = optarg;
else
terminate (STATE_UNKNOWN,
"Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n",
- PROGNAME);
+ progname);
break;
}
}
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",
- PROGNAME);
+ progname);
return OK;
}
{
printf
("Usage: %s -F <status log file> -e <expire_minutes> -C <process_string>\n",
- PROGNAME);
+ progname);
}
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"
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 53deef879c1b2a8a4af2f0141be1f6935b429b28..2f7ecc107cadb5400b634b9b0d555d034502a54e 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
*
*****************************************************************************/
-#define PROGNAME "check_nwstat"
+const char *progname = "check_nwstat";
#define REVISION "$Revision$"
#define COPYRIGHT "Copyright (c) 1999-2001 Ethan Galstad"
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);
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_revision(my_basename(argv[0]),"$Revision$");
+ print_revision(progname,"$Revision$");
exit(STATE_OK);
case 'H': /* hostname */
server_address=optarg;
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)
" %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)
{
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
printf ("%s\n\n%s\n", COPYRIGHT, SUMMARY);
print_usage();
printf
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 305a8242808887d103b8fdc5a7685e4760725d81..2ff37a485b1741fdd8695e08d79d62c40dd4a694 100644 (file)
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.c
#define PORT 2000
-#define PROGNAME "check_overcr"
+const char *progname = "check_overcr";
char *server_address = NULL;
int server_port = PORT;
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_revision (my_basename (argv[0]), "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'H': /* hostname */
server_address = optarg;
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)
{
printf
("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n",
- PROGNAME);
+ progname);
}
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"
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 98c504faff1d7f1147514d2afde2a7ffc1f4944f..4c8662bab7029d4bfa5335beea63a074dfbcd351 100644 (file)
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
*
*****************************************************************************/
-#define PROGNAME "check_pgsql"
+const char *progname = "check_pgsql"
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2001"
#define AUTHOR "Karl DeBisschop"
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
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 ("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
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))
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 3602122c28abd4a6288e266bc4f5f79b8c21380b..0c0f2e44f2872e0d4601e683c9b733dd596ecc3c 100644 (file)
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
*
*****************************************************************************/
-#define PROGNAME "check_ping"
+const char *progname = "check_ping";
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2001"
#define AUTHOR "Ethan Galstad/Karl DeBisschop"
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);
" %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)
{
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
printf
("Copyright (c) %s %s <%s>\n\n%s\n",
COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 967b4de7d00409c01c29eabb54ee04b70b694351..3849c77666c87db12c3c2e9ac2dca41bc7ab184a 100644 (file)
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
*
******************************************************************************/
-#define PROGNAME "check_snmp"
+const char *progname = "check_snmp";
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2002"
#define AUTHOR "Ethan Galstad"
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",
- my_basename (argv[0]));
+ progname);
print_usage ();
exit (STATE_UNKNOWN);
}
}
else {
printf ("%s: Critical Process Count must be an integer!\n\n",
- my_basename (argv[0]));
+ progname);
print_usage ();
exit (STATE_UNKNOWN);
}
}
else {
printf ("%s: Warning Process Count must be an integer!\n\n",
- my_basename (argv[0]));
+ progname);
print_usage ();
exit (STATE_UNKNOWN);
}
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 */
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);
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index c346dc77d43de39a3bfb7dabf1dd9550be4d0c23..0762896bc26de8d88887023d3854fa4925edd3bd 100644 (file)
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
*
*****************************************************************************/
-#define PROGNAME "check_radius"
+const char *progname = "check_radius"
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2001"
#define AUTHORS "Robert August Vincent II/Karl DeBisschop"
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
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_revision (my_basename (argv[0]), "$Revision$");
+ print_revision (progname, "$Revision$");
exit (OK);
case 'v': /* verbose mode */
verbose = TRUE;
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);
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
- PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+ progname, OPTIONS, progname, progname);
}
diff --git a/plugins/check_real.c b/plugins/check_real.c
index c553352c22f1cd2d0e2f795d86c78e41d416fd21..a91093734311eeb617131a57c2f763070bcc8ca6 100644 (file)
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
#include "netutils.h"
#include "utils.h"
-#define PROGNAME "check_real"
+const char *progname = "check_real";
#define PORT 554
#define EXPECT "RTSP/1."
}
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
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");
("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);
}
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 6f174299aa02daba82ebd822a5c3a878af35ee1c..d8b90597c8ad3489a688faefab2ea6b63ede2447 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
#include "netutils.h"
#include "utils.h"
-#define PROGNAME "check_smtp"
+const char *progname = "check_smtp";
#define SMTP_PORT 25
#define SMTP_EXPECT "220"
}
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
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
("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);
}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index cb13bc9ae3e22cb3a5fd893f832a46da9e95c9a5..b0059845358cbd19755a208462e16828759aadf9 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
*
*****************************************************************************/
-#define PROGNAME "check_snmp"
+const char *progname = "check_snmp";
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2002"
#define AUTHOR "Ethan Galstad"
print_help ();
exit (STATE_OK);
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'v': /* verbose */
verbose = TRUE;
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);
+ ("Copyright (c) %s %s <%s>\n\n%s\n", COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
print_usage ();
printf
("\nOptions:\n" LONGOPTIONS "\n" DESCRIPTION "\n" NOTES "\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
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 4637bcee0c781280567a8308de4bdc7dc6231886..faaead6a36725ef8e27a286067b567a169ec07de 100644 (file)
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
#include "netutils.h"
#include "utils.h"
-#define PROGNAME "check_ssh"
+const char *progname = "check_ssh";
#define REVISION "$Revision$"
#ifndef MSG_DONTWAIT
case '?': /* help */
usage ("");
case 'V': /* version */
- print_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
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);
("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 */
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 968779dc37d633f628d42643ddb5680740bffc46..b213c964fb805d7ad52ce5eeaeaa8ab3de88b459 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
#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"
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 ();
" %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);
}
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 ();
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 32d38b421ab39d6679740cc67b860fd6d325a4f6..43580b6c6815044e3afc42ef5526212c1c2d7871 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
*
*****************************************************************************/
-#define PROGRAM check_tcp
+/* const char *progname = "check_tcp"; */
#define REVISION "$Revision$"
#define DESCRIPTION "Check a TCP port"
#define AUTHOR "Ethan Galstad"
void print_usage (void);
void print_help (void);
-char *PROGNAME = NULL;
+char *progname = NULL;
char *SERVICE = NULL;
char *SEND = NULL;
char *EXPECT = NULL;
struct timeval tv;
if (strstr (argv[0], "check_udp")) {
- asprintf (&PROGNAME, "check_udp");
+ asprintf (&progname, "check_udp");
asprintf (&SERVICE, "UDP");
SEND = NULL;
EXPECT = NULL;
PORT = 0;
}
else if (strstr (argv[0], "check_tcp")) {
- asprintf (&PROGNAME, "check_tcp");
+ asprintf (&progname, "check_tcp");
asprintf (&SERVICE, "TCP");
SEND = NULL;
EXPECT = NULL;
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");
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");
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");
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");
}
#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");
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");
}
#endif
else if (strstr (argv[0], "check_nntp")) {
- asprintf (&PROGNAME, "check_nntp");
+ asprintf (&progname, "check_nntp");
asprintf (&SERVICE, "NNTP");
SEND = NULL;
EXPECT = NULL;
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_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)
- usage ("Invalid host name/address\n");
+ usage2 ("invalid host name or address", optarg);
server_address = optarg;
break;
case 'c': /* critical */
{
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);
}
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",
diff --git a/plugins/check_time.c b/plugins/check_time.c
index c7405f61bceabf3dfcd66b9eaec73004a486e535..e4bd26d7f7fc24c5cb34eb5836d08e300dbcc07f 100644 (file)
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
#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"
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)
" [-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);
}
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);
diff --git a/plugins/check_udp.c b/plugins/check_udp.c
index f6b528dcaaa3ced63e5ac30d0d59f835ceb366a4..8626f8c4816a81db8fa1469920345460cc8197cf 100644 (file)
--- a/plugins/check_udp.c
+++ b/plugins/check_udp.c
#include "netutils.h"
#include "utils.h"
-#define PROGNAME "check_udp"
+const char *progname = "check_udp";
int warning_time = 0;
int check_warning_time = FALSE;
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_revision (my_basename (argv[0]), "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'v': /* verbose mode */
verbose = TRUE;
{
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);
}
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");
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 470e3be749ea4acd02221429db8b7b9e8deed4d7..4c9032268f8a940e4cefd758aefd1269dae4e78b 100644 (file)
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
#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 CHECK_NONE 0
-#define PORT 3305
+#define PORT 3493
#define UPS_NONE 0 /* no supported options */
#define UPS_UTILITY 1 /* supports utility line voltage */
}
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
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"
("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);
}
diff --git a/plugins/check_users.c b/plugins/check_users.c
index e39e0d2bae25eb0b99f17db8811000a3589118fa..565d9e7032ca1ac7c0e196a2c06a83ff526d53e2 100644 (file)
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
#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"
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_revision (PROGNAME, REVISION);
+ print_revision (progname, REVISION);
exit (STATE_OK);
case 'c': /* critical */
if (!is_intnonneg (optarg))
void
print_usage (void)
{
- printf ("Usage: %s -w <users> -c <users>\n", PROGNAME);
+ printf ("Usage: %s -w <users> -c <users>\n", progname);
}
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"
diff --git a/plugins/check_vsz.c b/plugins/check_vsz.c
index 7eeab22cc9d48af2e2ef50598b3e6ad0811c0088..767abf4fd6d4d3be28dfaeaebad1cb72e879210c 100644 (file)
--- a/plugins/check_vsz.c
+++ b/plugins/check_vsz.c
*
*****************************************************************************/
-#define PROGNAME "check_vsz"
+const char *progname = "check_vsz";
#define REVISION "$Revision$"
#define COPYRIGHT "1999-2002"
#define AUTHOR "Karl DeBisschop"
#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;
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;
}
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 */
- print_help (my_basename (argv[0]));
+ print_help (progname);
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",
- my_basename (argv[0]), optarg);
- print_usage (my_basename (argv[0]));
+ progname, optarg);
+ print_usage (progname);
exit (STATE_UNKNOWN);
}
crit = atoi (optarg);
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);
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++]);
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++]);
}
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
-print_help (char *cmd)
+print_help (const char *cmd)
{
print_revision ("check_vsz", "$Revision$");
printf
diff --git a/plugins/negate.c b/plugins/negate.c
index c76f5ca08cddddddc6bd50fdeb48c1cc0dc24741..454ac963570f9705678330d7b7e99b75f4375df6 100644 (file)
--- a/plugins/negate.c
+++ b/plugins/negate.c
*
*****************************************************************************/
-#define PROGNAME "negate"
+const char *progname = "negate";
#define REVISION "$Revision$"
#define COPYRIGHT "2002"
#define AUTHOR "Karl DeBisschop"
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
/******************************************************************************
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
-<refname>&PROGNAME;</refname>
+<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
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);
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
- PROGNAME, OPTIONS, PROGNAME, PROGNAME);
+ progname, OPTIONS, progname, progname);
}
\f
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))
diff --git a/plugins/urlize.c b/plugins/urlize.c
index 9835c824d4c1fbf38d2dc0e1f4324b7d9ab20d47..8d6fc3adf1fe9806ffde14f01ecf748017770707 100644 (file)
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
*
*****************************************************************************/
+const char *progname = "urlize";
+
#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)
char input_buffer[MAX_INPUT_BUFFER];
if (argc < 2) {
- print_usage (my_basename (argv[0]));
+ print_usage (progname);
exit (STATE_UNKNOWN);
}
}
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) {
- print_usage (my_basename (argv[0]));
+ print_usage (progname);
exit (STATE_UNKNOWN);
}
}
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
-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"
diff --git a/plugins/utils.c b/plugins/utils.c
index 22020d72eb16c5958908e9fc885cf68be05d0e1b..474206b93638bded27106ec8efbdfb7e1d40c15b 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
#include <limits.h>
extern int timeout_interval;
+extern const char *progname;
-char *my_basename (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);
#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
****************************************************************************/
int
-max_state(int a, int b)
+max_state (int a, int b)
{
if (a == STATE_CRITICAL || b == STATE_CRITICAL)
return STATE_CRITICAL;
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);
}
}
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",
- 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"
diff --git a/plugins/utils.h.in b/plugins/utils.h.in
index 96bf9b2f3b6d95dbea0a720680e756867116dda4..317ec46fba6cbd9ebc625b8b7a15e9129766be18 100644 (file)
--- a/plugins/utils.h.in
+++ b/plugins/utils.h.in
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);
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":\