X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_dummy.c;h=0892611508fe05ff5ed9bac779b8f7d9a367c476;hb=6ecaa524bf28b5fb861b161ea075a11119cb3bd2;hp=9ca7a3aba071e503e8d0a613561ff92c68c37078;hpb=22bd672d19c378f1e6124ee18e64e5a88cf53739;p=nagiosplug.git diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 9ca7a3a..0892611 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c @@ -14,32 +14,33 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ -#include "common.h" -#include "utils.h" - const char *progname = "check_dummy"; const char *revision = "$Revision$"; -const char *copyright = "1999-2003"; +const char *copyright = "1999-2004"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; +#include "common.h" +#include "utils.h" + void print_help (void); void print_usage (void); - int main (int argc, char **argv) { - int result; + int result = STATE_UNKNOWN; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (argc != 2) - usage (_("Incorrect number of arguments supplied\n")); + if (argc < 2) + usage4 (_("Could not parse arguments")); else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { print_revision (progname, revision); exit (STATE_OK); @@ -49,28 +50,33 @@ main (int argc, char **argv) exit (STATE_OK); } else if (!is_integer (argv[1])) - usage (_("Arguments to check_dummy must be an integer\n")); + usage4 (_("Arguments to check_dummy must be an integer")); else result = atoi (argv[1]); switch (result) { case STATE_OK: - printf ("Status is OK\n"); + printf (_("OK")); break; case STATE_WARNING: - printf ("Status is at WARNING level\n"); + printf (_("WARNING")); break; case STATE_CRITICAL: - printf ("Status is CRITICAL\n"); + printf (_("CRITICAL")); break; case STATE_UNKNOWN: - printf ("Status is UNKNOWN\n"); + printf (_("UNKNOWN")); break; default: - printf ("Status %d is not a supported error state\n", result); + printf (_("Status %d is not a supported error state\n"), result); break; } + if (argc >= 3) + printf (": %s", argv[2]); + + printf("\n"); + return result; } @@ -81,17 +87,17 @@ print_help (void) { print_revision (progname, revision); - printf (_("Copyright (c) 1999 Ethan Galstad \n")); - printf (_(COPYRIGHT), copyright, email); + printf ("Copyright (c) 1999 Ethan Galstad \n"); + printf (COPYRIGHT, copyright, email); + + printf (_("\ +This plugin will simply return the state corresponding to the numeric value\n\ +of the argument with optional text.\n\n")); print_usage (); printf (_(UT_HELP_VRSN)); - printf (_("\n\ -This plugin will simply return the state corresponding to the numeric value\n\ -of the argument.\n")); - printf (_(UT_SUPPORT)); } @@ -100,5 +106,5 @@ of the argument.\n")); void print_usage (void) { - printf (_("Usage: %s \n"), progname); + printf ("Usage: %s [optional text]\n", progname); }