Code

bump copyright year
[nagiosplug.git] / plugins / check_dummy.c
1 /******************************************************************************
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; either version 2 of the License, or
6  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  GNU General Public License for more details.
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  $Id$
18  
19 ******************************************************************************/
21 const char *progname = "check_dummy";
22 const char *revision = "$Revision$";
23 const char *copyright = "1999-2004";
24 const char *email = "nagiosplug-devel@lists.sourceforge.net";
26 #include "common.h"
27 #include "utils.h"
29 void print_help (void);
30 void print_usage (void);
34 int
35 main (int argc, char **argv)
36 {
37         int result = STATE_UNKNOWN;
39         setlocale (LC_ALL, "");
40         bindtextdomain (PACKAGE, LOCALEDIR);
41         textdomain (PACKAGE);
43         if (argc < 2)
44                 usage (_("Incorrect number of arguments supplied\n"));
45         else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
46                 print_revision (progname, revision);
47                 exit (STATE_OK);
48         }
49         else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
50                 print_help ();
51                 exit (STATE_OK);
52         }
53         else if (!is_integer (argv[1]))
54                 usage (_("Arguments to check_dummy must be an integer\n"));
55         else
56                 result = atoi (argv[1]);
58         switch (result) {
59         case STATE_OK:
60                 printf (_("OK"));
61                 break;
62         case STATE_WARNING:
63                 printf (_("WARNING"));
64                 break;
65         case STATE_CRITICAL:
66                 printf (_("CRITICAL"));
67                 break;
68         case STATE_UNKNOWN:
69                 printf (_("UNKNOWN"));
70                 break;
71         default:
72                 printf (_("Status %d is not a supported error state\n"), result);
73                 break;
74         }
76         if (argc >= 3) 
77                 printf (": %s", argv[2]);
79         printf("\n");
81         return result;
82 }
86 void
87 print_help (void)
88 {
89         print_revision (progname, revision);
91         printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
92         printf (COPYRIGHT, copyright, email);
94         print_usage ();
96         printf (_(UT_HELP_VRSN));
98         printf (_("\n\
99 This plugin will simply return the state corresponding to the numeric value\n\
100 of the <state> argument with optional text.\n"));
102         printf (_(UT_SUPPORT));
107 void
108 print_usage (void)
110         printf (_("Usage: %s <integer state> [optional text]\n"), progname);