convert PROGANE from a define to a const char

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@238 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
Karl DeBisschop 2003-01-13 12:15:16 +00:00
parent de5650f28e
commit 0c3386274e
35 changed files with 234 additions and 239 deletions

View 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"
@ -34,11 +34,9 @@
#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);
@ -223,10 +221,10 @@ process_arguments (int argc, char **argv)
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;
@ -286,7 +284,7 @@ process_arguments (int argc, char **argv)
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++];
}
@ -317,10 +315,10 @@ validate_arguments (void)
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;
}
@ -330,7 +328,7 @@ validate_arguments (void)
void
print_help (char *cmd)
print_help (const char *cmd)
{
print_revision (cmd, "$Revision$");

View file

@ -25,7 +25,7 @@
#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"
@ -197,7 +197,7 @@ process_arguments (int argc, char **argv)
}
break;
case 'V': /* version */
print_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -240,7 +240,7 @@ validate_arguments (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);
@ -272,5 +272,5 @@ print_usage (void)
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);
}

View file

@ -45,7 +45,7 @@ int check_disk (int usp, int free_disk);
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;
@ -252,7 +252,7 @@ process_arguments (int argc, char **argv)
exclude_device = optarg;
break;
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -323,7 +323,7 @@ check_disk (usp, free_disk)
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"
@ -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"
" %s (-V|--version)\n", PROGNAME, PROGNAME, PROGNAME);
" %s (-V|--version)\n", progname, progname, progname);
}

View file

@ -48,7 +48,7 @@
#include "popen.h"
#include "utils.h"
#define PROGNAME "check_dns"
const char *progname = "check_dns";
#define REVISION "$Revision$"
#define COPYRIGHT "2000-2002"
@ -292,14 +292,14 @@ process_arguments (int argc, char **argv)
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;
@ -388,13 +388,13 @@ void
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

View file

@ -37,8 +37,10 @@
#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)
@ -82,7 +84,7 @@ 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"
@ -94,7 +96,7 @@ print_help (char *cmd)
}
void
print_usage (char *cmd)
print_usage (const char *cmd)
{
printf ("Usage: %s <integer state>\n", cmd);
}

View file

@ -32,7 +32,7 @@
#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% */
@ -243,14 +243,14 @@ process_arguments (int argc, char **argv)
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;
@ -325,12 +325,12 @@ get_threshold (char *arg, char *rv[2])
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, "%")) {
@ -358,7 +358,7 @@ get_threshold (char *arg, char *rv[2])
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_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
printf
("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n\n"

View file

@ -65,7 +65,7 @@
#include "popen.h"
#include "utils.h"
#define PROGNAME "check_hpjd"
const char *progname = "check_hpjd"
#define REVISION "$Revision$"
#define COPYRIGHT "2000-2002"
@ -438,7 +438,7 @@ process_arguments (int argc, char **argv)
community = optarg;
break;
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -482,7 +482,7 @@ validate_arguments (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"
@ -510,7 +510,7 @@ print_usage (void)
printf
("Usage: %s -H host [-C community]\n"
" %s --help\n"
" %s --version\n", PROGNAME, PROGNAME, PROGNAME);
" %s --version\n", progname, progname, progname);
}

View 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"
@ -328,7 +328,7 @@ process_arguments (int argc, char **argv)
exit (STATE_OK);
break;
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
break;
case 't': /* timeout period */
@ -1058,7 +1058,7 @@ my_close (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);
@ -1083,5 +1083,5 @@ print_usage (void)
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}

View file

@ -20,7 +20,7 @@
*
*****************************************************************************/
#define PROGNAME "check_ldap"
const char *progname = "check_ldap";
#define REVISION "$Revision$"
#include "config.h"
@ -35,8 +35,8 @@
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;
@ -165,7 +165,7 @@ process_arguments (int argc, char **argv)
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))
@ -225,10 +225,10 @@ validate_arguments ()
/* 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");
@ -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"
"(Note: all times are in seconds.)\n", PROGNAME);
"(Note: all times are in seconds.)\n", progname);
}

View file

@ -44,7 +44,7 @@
#endif
#define PROGNAME "check_load"
const char *progname = "check_load";
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 */
print_revision (my_basename (argv[0]), "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -303,7 +303,7 @@ print_usage (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"

View 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"
@ -287,7 +287,7 @@ process_arguments (int argc, char **argv)
units_label = optarg;
break;
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
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",
argv[c], PROGNAME);
argv[c], progname);
}
if (argc > c && strcmp (argv[c], "MAX") == 0) {
@ -359,7 +359,7 @@ validate_arguments (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");
@ -377,5 +377,5 @@ print_usage (void)
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}

View file

@ -52,7 +52,7 @@
#include "common.h"
#include "utils.h"
#define PROGNAME "check_mrtgtraf"
const char *progname = "check_mrtgtraf";
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 */
print_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -356,7 +356,7 @@ validate_arguments (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");
@ -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"
" %s --version\n", PROGNAME, PROGNAME, PROGNAME);
" %s --version\n", progname, progname, progname);
}

View file

@ -14,7 +14,7 @@
* This plugin is for testing a mysql server.
******************************************************************************/
#define PROGNAME "check_mysql"
const char *progname = "check_mysql"
#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 */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -230,7 +230,7 @@ validate_arguments (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");
@ -267,5 +267,5 @@ print_usage (void)
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);
}

View file

@ -30,7 +30,7 @@
#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);
@ -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",
PROGNAME);
progname);
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 */
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;
@ -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",
PROGNAME);
progname);
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",
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;
}
@ -231,7 +231,7 @@ print_usage (void)
{
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)
{
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"

View 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"
@ -128,8 +128,6 @@ int check_netware_version=FALSE;
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);
@ -674,14 +672,14 @@ int process_arguments(int argc, char **argv){
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;
@ -693,7 +691,7 @@ int process_arguments(int argc, char **argv){
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)
@ -806,12 +804,12 @@ void print_usage(void)
" %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

View file

@ -58,7 +58,7 @@
#define PORT 2000
#define PROGNAME "check_overcr"
const char *progname = "check_overcr";
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 */
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;
@ -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",
PROGNAME);
progname);
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",
PROGNAME);
progname);
}
@ -448,7 +448,7 @@ print_usage (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"

View 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"
@ -122,7 +122,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
<refname>&PROGNAME;</refname>
<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
@ -218,7 +218,7 @@ main (int argc, char **argv)
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);
@ -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",
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}
@ -281,7 +281,7 @@ process_arguments (int argc, char **argv)
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))

View 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"
@ -189,7 +189,7 @@ process_arguments (int argc, char **argv)
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);
@ -482,13 +482,13 @@ print_usage (void)
" %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);

View 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"
@ -298,12 +298,12 @@ process_arguments (int argc, char **argv)
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);
}
@ -325,7 +325,7 @@ process_arguments (int argc, char **argv)
}
else {
printf ("%s: Critical Process Count must be an integer!\n\n",
my_basename (argv[0]));
progname);
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",
my_basename (argv[0]));
progname);
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",
my_basename (argv[0]));
progname);
print_usage ();
exit (STATE_UNKNOWN);
case 's': /* status */
@ -462,7 +462,7 @@ if (wmax >= 0 && wmin == -1)
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);

View 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"
@ -112,7 +112,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
<refname>&PROGNAME;</refname>
<refname>&progname;</refname>
<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 */
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;
@ -324,7 +324,7 @@ process_arguments (int argc, char **argv)
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);
@ -347,5 +347,5 @@ print_usage (void)
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}

View file

@ -48,7 +48,7 @@
#include "netutils.h"
#include "utils.h"
#define PROGNAME "check_real"
const char *progname = "check_real";
#define PORT 554
#define EXPECT "RTSP/1."
@ -370,7 +370,7 @@ process_arguments (int argc, char **argv)
}
break;
case 'V': /* version */
print_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -410,7 +410,7 @@ validate_arguments (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");
@ -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"
" %s --version\n", PROGNAME, PROGNAME, PROGNAME);
" %s --version\n", progname, progname, progname);
}

View file

@ -39,7 +39,7 @@
#include "netutils.h"
#include "utils.h"
#define PROGNAME "check_smtp"
const char *progname = "check_smtp";
#define SMTP_PORT 25
#define SMTP_EXPECT "220"
@ -294,7 +294,7 @@ process_arguments (int argc, char **argv)
}
break;
case 'V': /* version */
print_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -340,7 +340,7 @@ validate_arguments (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");
@ -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"
" %s --version\n", PROGNAME, PROGNAME, PROGNAME);
" %s --version\n", progname, progname, progname);
}

View 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"
@ -475,7 +475,7 @@ process_arguments (int argc, char **argv)
print_help ();
exit (STATE_OK);
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
case 'v': /* verbose */
verbose = TRUE;
@ -753,10 +753,9 @@ validate_arguments ()
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",
@ -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",
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}

View file

@ -15,7 +15,7 @@
#include "netutils.h"
#include "utils.h"
#define PROGNAME "check_ssh"
const char *progname = "check_ssh";
#define REVISION "$Revision$"
#ifndef MSG_DONTWAIT
@ -95,7 +95,7 @@ process_arguments (int argc, char **argv)
case '?': /* help */
usage ("");
case 'V': /* version */
print_revision (PROGNAME, REVISION);
print_revision (progname, REVISION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -238,7 +238,7 @@ ssh_connect (char *haddr, short hport)
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);
@ -251,7 +251,7 @@ print_usage (void)
("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 */

View file

@ -29,7 +29,7 @@
#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"
@ -267,7 +267,7 @@ process_arguments (int argc, char **argv)
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 ();
@ -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",
PROGNAME, PROGNAME, PROGNAME, PROGNAME);
progname, progname, progname, progname);
}
@ -346,7 +346,7 @@ print_usage (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 ();

View 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"
@ -65,7 +65,7 @@ int process_arguments (int, char **);
void print_usage (void);
void print_help (void);
char *PROGNAME = NULL;
char *progname = 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")) {
asprintf (&PROGNAME, "check_udp");
asprintf (&progname, "check_udp");
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")) {
asprintf (&PROGNAME, "check_tcp");
asprintf (&progname, "check_tcp");
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")) {
asprintf (&PROGNAME, "check_ftp");
asprintf (&progname, "check_ftp");
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")) {
asprintf (&PROGNAME, "check_smtp");
asprintf (&progname, "check_smtp");
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")) {
asprintf (&PROGNAME, "check_pop");
asprintf (&progname, "check_pop");
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")) {
asprintf (&PROGNAME, "check_imap");
asprintf (&progname, "check_imap");
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")) {
asprintf (&PROGNAME, "check_simap");
asprintf (&progname, "check_simap");
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")) {
asprintf (&PROGNAME, "check_spop");
asprintf (&progname, "check_spop");
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")) {
asprintf (&PROGNAME, "check_nntp");
asprintf (&progname, "check_nntp");
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 */
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 */
@ -479,7 +479,7 @@ print_usage (void)
{
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)
{
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",

View file

@ -39,7 +39,7 @@
#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"
@ -209,7 +209,7 @@ process_arguments (int argc, char **argv)
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)
@ -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",
PROGNAME, PROGNAME, PROGNAME);
progname, progname, progname);
}
@ -316,7 +316,7 @@ print_usage (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);

View file

@ -41,7 +41,7 @@
#include "netutils.h"
#include "utils.h"
#define PROGNAME "check_udp"
const char *progname = "check_udp";
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 */
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;
@ -233,7 +233,7 @@ print_usage (void)
{
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)
{
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");

View file

@ -56,7 +56,7 @@
#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"
@ -64,7 +64,7 @@
#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 */
@ -535,7 +535,7 @@ process_arguments (int argc, char **argv)
}
break;
case 'V': /* version */
print_revision (PROGNAME, "$Revision$");
print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
@ -571,7 +571,7 @@ validate_arguments (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"
@ -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"
" %s --version\n", PROGNAME, PROGNAME, PROGNAME);
" %s --version\n", progname, progname, progname);
}

View file

@ -48,7 +48,7 @@
#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"
@ -162,14 +162,14 @@ process_arguments (int argc, char **argv)
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))
@ -207,7 +207,7 @@ process_arguments (int argc, char **argv)
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)
{
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"

View 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"
@ -45,8 +45,8 @@
#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;
@ -64,8 +64,8 @@ main (int argc, char **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;
}
@ -166,20 +166,20 @@ process_arguments (int argc, char **argv)
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);
@ -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",
my_basename (argv[0]), optarg);
print_usage (my_basename (argv[0]));
progname, optarg);
print_usage (progname);
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",
PROGNAME, argv[c]);
print_usage (PROGNAME);
progname, argv[c]);
print_usage (progname);
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",
PROGNAME, argv[c]);
print_usage (PROGNAME);
progname, argv[c]);
print_usage (progname);
exit (STATE_UNKNOWN);
}
crit = atoi (argv[c++]);
@ -227,14 +227,14 @@ process_arguments (int argc, char **argv)
}
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

View file

@ -23,7 +23,7 @@
*
*****************************************************************************/
#define PROGNAME "negate"
const char *progname = "negate";
#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;
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);
/******************************************************************************
@ -76,7 +76,7 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
<manvolnum>5<manvolnum>
</refmeta>
<refnamdiv>
<refname>&PROGNAME;</refname>
<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
@ -174,7 +174,7 @@ main (int argc, char **argv)
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);
@ -196,7 +196,7 @@ print_usage (void)
" %s -h for detailed help\n"
" %s -V for version information\n",
#endif
PROGNAME, OPTIONS, PROGNAME, PROGNAME);
progname, OPTIONS, progname, progname);
}
@ -249,7 +249,7 @@ process_arguments (int argc, char **argv)
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))

View file

@ -37,12 +37,14 @@
*
*****************************************************************************/
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)
@ -52,7 +54,7 @@ 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);
}
@ -62,12 +64,12 @@ main (int argc, char **argv)
}
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);
}
@ -120,16 +122,15 @@ main (int argc, char **argv)
}
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"

View file

@ -18,11 +18,11 @@
#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);
@ -57,8 +57,6 @@ char *strpcat (char *dest, const char *src, const char *str);
#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
@ -68,7 +66,7 @@ char *strpcat (char *dest, const char *src, const char *str);
****************************************************************************/
int
max_state(int a, int b)
max_state (int a, int b)
{
if (a == STATE_CRITICAL || b == STATE_CRITICAL)
return STATE_CRITICAL;
@ -84,13 +82,26 @@ max_state(int a, int 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
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"

View file

@ -16,7 +16,7 @@ suite of plugins. */
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);
@ -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);
/* 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":\