X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_dummy.c;h=dfd6c9c2602780e7c3bc003b55df71f8804dd840;hb=f8766fe505898d1617e11703840ac0a42f25272e;hp=6864d02d39ca3dee36a0d0032a7fe4da74c6aa26;hpb=016d33230eb4fffd7e1f5644ce4901cb4d01f4e3;p=nagiosplug.git diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 6864d02..dfd6c9c 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c @@ -1,18 +1,34 @@ /****************************************************************************** - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* Nagios check_dummy plugin +* +* License: GPL +* Copyright (c) 1999-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the check_dummy plugin +* +* This plugin will simply return the state corresponding to the numeric value +* +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id$ @@ -20,7 +36,7 @@ const char *progname = "check_dummy"; const char *revision = "$Revision$"; -const char *copyright = "1999-2004"; +const char *copyright = "1999-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -30,55 +46,54 @@ void print_help (void); void print_usage (void); - int main (int argc, char **argv) { - int result = STATE_UNKNOWN; - - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - if (argc < 2) - usage (_("Incorrect number of arguments supplied\n")); - else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { - print_revision (progname, revision); - exit (STATE_OK); - } - else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { - print_help (); - exit (STATE_OK); - } - else if (!is_integer (argv[1])) - usage (_("Arguments to check_dummy must be an integer\n")); - else - result = atoi (argv[1]); - - switch (result) { - case STATE_OK: - printf (_("OK")); - break; - case STATE_WARNING: - printf (_("WARNING")); - break; - case STATE_CRITICAL: - printf (_("CRITICAL")); - break; - case STATE_UNKNOWN: - printf (_("UNKNOWN")); - break; - default: - printf (_("Status %d is not a supported error state\n"), result); - break; - } - - if (argc >= 3) - printf (": %s", argv[2]); - - printf("\n"); - - return result; + int result = STATE_UNKNOWN; + + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + 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); + } + else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { + print_help (); + exit (STATE_OK); + } + else if (!is_integer (argv[1])) + usage4 (_("Arguments to check_dummy must be an integer")); + else + result = atoi (argv[1]); + + switch (result) { + case STATE_OK: + printf (_("OK")); + break; + case STATE_WARNING: + printf (_("WARNING")); + break; + case STATE_CRITICAL: + printf (_("CRITICAL")); + break; + case STATE_UNKNOWN: + printf (_("UNKNOWN")); + break; + default: + printf (_("Status %d is not a supported error state\n"), result); + break; + } + + if (argc >= 3) + printf (": %s", argv[2]); + + printf("\n"); + + return result; } @@ -86,20 +101,22 @@ main (int argc, char **argv) void print_help (void) { - print_revision (progname, revision); + 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); - print_usage (); + printf ("%s\n", _("This plugin will simply return the state corresponding to the numeric value")); + + printf ("%s\n", _("of the argument with optional text")); - printf (_(UT_HELP_VRSN)); + printf ("\n\n"); + + print_usage (); - printf (_("\n\ -This plugin will simply return the state corresponding to the numeric value\n\ -of the argument with optional text.\n")); + printf (_(UT_HELP_VRSN)); - printf (_(UT_SUPPORT)); + printf (_(UT_SUPPORT)); } @@ -107,5 +124,6 @@ of the argument with optional text.\n")); void print_usage (void) { - printf (_("Usage: %s [optional text]\n"), progname); + printf (_("Usage:")); + printf (" %s [optional text]\n", progname); }