diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 00:41:06 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 00:41:06 +0000 |
commit | 41158497e887d2d9cd925574f349fd3e65402644 (patch) | |
tree | 947605c94adb74ae12cc83440fb22ab6f90c8b08 /plugins/check_dummy.c | |
parent | 8aee8dd8b4e64a9b023334e0c36761bf75f99306 (diff) | |
download | monitoring-plugins-41158497e887d2d9cd925574f349fd3e65402644.tar.gz |
more pedantic compiler warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@668 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dummy.c')
-rw-r--r-- | plugins/check_dummy.c | 128 |
1 files changed, 60 insertions, 68 deletions
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index d90b1409..3db5238f 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c @@ -1,39 +1,21 @@ -/************************************************************* - * - * CHECK_DUMMY.C - * - * Program: Dummy plugin for Nagios - * License: GPL - * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) - * - * Last Modified: $Date$ - * - * Command line: CHECK_DUMMY <state> - * - * Description: - * - * This plugin will simply return the state corresponding to the - * numerical value of the <state> argument. - * - * 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. - * - **************************************************************/ - -#include "config.h" +/****************************************************************************** + + 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. + +******************************************************************************/ + #include "common.h" #include "utils.h" @@ -42,39 +24,18 @@ const char *revision = "$Revision$"; const char *copyright = "1999-2003"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; -void -print_usage (void) -{ - printf (_("Usage: %s <integer state>\n"), progname); -} +void print_help (void); +void print_usage (void); -void -print_help (void) -{ - print_revision (progname, revision); - printf (_(COPYRIGHT), copyright, email); - - print_usage (); - - printf (_(UT_HELP_VRSN)); - - printf (_("\n\ -This plugin will simply return the state corresponding to the numeric value\n\ -of the <state> argument.\n")); - - support (); -} int main (int argc, char **argv) { int result; - if (argc != 2) { - printf (_("Incorrect number of arguments supplied\n")); - exit (STATE_UNKNOWN); - } + 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); @@ -83,11 +44,10 @@ main (int argc, char **argv) print_help (); exit (STATE_OK); } - else if (!is_integer (argv[1])) { - print_usage (); - exit (STATE_UNKNOWN); - } - result = atoi (argv[1]); + 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: @@ -99,10 +59,42 @@ main (int argc, char **argv) case STATE_CRITICAL: printf ("Status is CRITICAL\n"); break; - default: + case STATE_UNKNOWN: printf ("Status is UNKNOWN\n"); - result = STATE_UNKNOWN; + break; + default: + printf ("Status %d is not a supported error state\n", result); + break; } return result; } + + + +void +print_help (void) +{ + print_revision (progname, revision); + + printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n")); + printf (_(COPYRIGHT), copyright, email); + + print_usage (); + + printf (_(UT_HELP_VRSN)); + + printf (_("\n\ +This plugin will simply return the state corresponding to the numeric value\n\ +of the <state> argument.\n")); + + printf (_(UT_SUPPORT)); +} + + + +void +print_usage (void) +{ + printf (_("Usage: %s <integer state>\n"), progname); +} |