diff --git a/plugins/check_real.c b/plugins/check_real.c
index 7cd17eea34c7f962ef22cdbcbadc190dc8f7c228..f843172628ae764ecc64210693aa8feead1158fb 100644 (file)
--- a/plugins/check_real.c
+++ b/plugins/check_real.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_real";
const char *revision = "$Revision$";
-const char *copyright = "2000-2003";
+const char *copyright = "2000-2004";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
-
-
-\f
int
main (int argc, char **argv)
{
int sd;
- int result;
+ int result = STATE_UNKNOWN;
char buffer[MAX_INPUT_BUFFER];
char *status_line = NULL;
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ if (process_arguments (argc, argv) != TRUE)
+ usage4 (_("Could not parse arguments"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
else if (is_host (optarg))
server_address = optarg;
else
- usage (_("Invalid host name\n"));
+ usage2 (_("Invalid hostname/address"), optarg);
break;
case 'e': /* string to expect in response header */
server_expect = optarg;
server_port = atoi (optarg);
}
else {
- usage (_("Server port must be a positive integer\n"));
+ usage (_("Port must be a positive integer\n"));
}
break;
case 'w': /* warning time threshold */
check_warning_time = TRUE;
}
else {
- usage (_("Warning time must be a nonnegative integer\n"));
+ usage (_("Warning time must be a positive integer\n"));
}
break;
case 'c': /* critical time threshold */
}
break;
case 'V': /* version */
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
exit (STATE_OK);
case 'h': /* help */
print_help ();
exit (STATE_OK);
case '?': /* usage */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
server_address = argv[c++];
}
else {
- usage (_("Invalid host name"));
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
}
-
-
int
validate_arguments (void)
{
-
-\f
void
print_help (void)
{
char *myport;
asprintf (&myport, "%d", PORT);
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
- printf (_("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n"));
- printf (_(COPYRIGHT), copyright, email);
+ printf ("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n");
+ printf (COPYRIGHT, copyright, email);
printf (_("This plugin tests the REAL service on the specified host.\n\n"));
-
-
void
print_usage (void)
{
printf ("\
Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\
- [-t timeout] [-v]\n", progname);
- printf (_(UT_HLP_VRS), progname, progname);
+ [-t timeout] [-v]\n", progname);
}