diff --git a/plugins/check_game.c b/plugins/check_game.c
index ac72873deb9f6fe6f8f4f3e375db3ae6f419a780..05b363af509259c1a4ebc8556306fb90d99835e0 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+* $Id$
*****************************************************************************/
const char *progname = "check_game";
const char *revision = "$Revision$";
-const char *copyright = "2002-2003";
+const char *copyright = "2002-2004";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
main (int argc, char **argv)
{
char *command_line;
- int result;
+ int result = STATE_UNKNOWN;
FILE *fp;
char input_buffer[MAX_INPUT_BUFFER];
char *p, *ret[QSTAT_MAX_RETURN_ARGS];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
-
- result = process_arguments (argc, argv);
-
- if (result != OK) {
- printf (_("Incorrect arguments supplied\n"));
- printf ("\n");
- print_revision (progname, revision);
- printf (_("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"));
- printf (_("License: GPL\n"));
- printf ("\n");
- return STATE_UNKNOWN;
- }
+
+ if (process_arguments (argc, argv) == ERROR)
+ usage4 (_("Could not parse arguments"));
result = STATE_OK;
/* run the command */
fp = spopen (command_line);
if (fp == NULL) {
- printf (_("Error - Could not open pipe: %s\n"), command_line);
+ printf (_("Could not open pipe: %s\n"), command_line);
return STATE_UNKNOWN;
}
*/
if (!strncmp (input_buffer, "unknown option", 14)) {
- printf (_("ERROR: Host type parameter incorrect!\n"));
+ printf (_("CRITICAL - Host type parameter incorrect!\n"));
result = STATE_CRITICAL;
return result;
}
}
if (strstr (ret[2], QSTAT_HOST_ERROR)) {
- printf ("ERROR: Host not found\n");
+ printf (_("CRITICAL - Host not found\n"));
result = STATE_CRITICAL;
}
else if (strstr (ret[2], QSTAT_HOST_DOWN)) {
- printf ("ERROR: Game server down or unavailable\n");
+ printf (_("CRITICAL - Game server down or unavailable\n"));
result = STATE_CRITICAL;
}
else if (strstr (ret[2], QSTAT_HOST_TIMEOUT)) {
- printf ("ERROR: Game server timeout\n");
+ printf (_("CRITICAL - Game server timeout\n"));
result = STATE_CRITICAL;
}
else {
}
-
int
process_arguments (int argc, char **argv)
{
switch (c) {
case '?': /* args not parsable */
- printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
- print_usage ();
- exit (STATE_UNKNOWN);
+ usage2 (_("Unknown argument"), optarg);
case 'h': /* help */
print_help ();
exit (STATE_OK);
return validate_arguments ();
}
+
int
validate_arguments (void)
{
}
-
-
-
-\f
void
print_help (void)
{
print_revision (progname, revision);
- printf (_(COPYRIGHT), copyright, email);
+ printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
+ printf (COPYRIGHT, copyright, email);
- printf (_("This plugin tests %s connections with the specified host."), progname);
+ printf (_("This plugin tests game server connections with the specified host."));
print_usage ();
-
void
print_usage (void)
{
- printf (_("\
+ printf ("\
Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
- [-pf ping_field]\n"), progname);
- printf (_(UT_HLP_VRS), progname, progname);
+ [-pf ping_field]\n", progname);
}
/******************************************************************************