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 @@ | |||
1 | /************************************************************* | 1 | /****************************************************************************** |
2 | * | 2 | |
3 | * CHECK_DUMMY.C | 3 | This program is free software; you can redistribute it and/or modify |
4 | * | 4 | it under the terms of the GNU General Public License as published by |
5 | * Program: Dummy plugin for Nagios | 5 | the Free Software Foundation; either version 2 of the License, or |
6 | * License: GPL | 6 | (at your option) any later version. |
7 | * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) | 7 | |
8 | * | 8 | This program is distributed in the hope that it will be useful, |
9 | * Last Modified: $Date$ | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * Command line: CHECK_DUMMY <state> | 11 | GNU General Public License for more details. |
12 | * | 12 | |
13 | * Description: | 13 | You should have received a copy of the GNU General Public License |
14 | * | 14 | along with this program; if not, write to the Free Software |
15 | * This plugin will simply return the state corresponding to the | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | * numerical value of the <state> argument. | 16 | |
17 | * | 17 | ******************************************************************************/ |
18 | * License Information: | 18 | |
19 | * | ||
20 | * This program is free software; you can redistribute it and/or modify | ||
21 | * it under the terms of the GNU General Public License as published by | ||
22 | * the Free Software Foundation; either version 2 of the License, or | ||
23 | * (at your option) any later version. | ||
24 | * | ||
25 | * This program is distributed in the hope that it will be useful, | ||
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
28 | * GNU General Public License for more details. | ||
29 | * | ||
30 | * You should have received a copy of the GNU General Public License | ||
31 | * along with this program; if not, write to the Free Software | ||
32 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
33 | * | ||
34 | **************************************************************/ | ||
35 | |||
36 | #include "config.h" | ||
37 | #include "common.h" | 19 | #include "common.h" |
38 | #include "utils.h" | 20 | #include "utils.h" |
39 | 21 | ||
@@ -42,39 +24,18 @@ const char *revision = "$Revision$"; | |||
42 | const char *copyright = "1999-2003"; | 24 | const char *copyright = "1999-2003"; |
43 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
44 | 26 | ||
45 | void | 27 | void print_help (void); |
46 | print_usage (void) | 28 | void print_usage (void); |
47 | { | ||
48 | printf (_("Usage: %s <integer state>\n"), progname); | ||
49 | } | ||
50 | 29 | ||
51 | void | ||
52 | print_help (void) | ||
53 | { | ||
54 | print_revision (progname, revision); | ||
55 | 30 | ||
56 | printf (_(COPYRIGHT), copyright, email); | ||
57 | |||
58 | print_usage (); | ||
59 | |||
60 | printf (_(UT_HELP_VRSN)); | ||
61 | |||
62 | printf (_("\n\ | ||
63 | This plugin will simply return the state corresponding to the numeric value\n\ | ||
64 | of the <state> argument.\n")); | ||
65 | |||
66 | support (); | ||
67 | } | ||
68 | 31 | ||
69 | int | 32 | int |
70 | main (int argc, char **argv) | 33 | main (int argc, char **argv) |
71 | { | 34 | { |
72 | int result; | 35 | int result; |
73 | 36 | ||
74 | if (argc != 2) { | 37 | if (argc != 2) |
75 | printf (_("Incorrect number of arguments supplied\n")); | 38 | usage (_("Incorrect number of arguments supplied\n")); |
76 | exit (STATE_UNKNOWN); | ||
77 | } | ||
78 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { | 39 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { |
79 | print_revision (progname, revision); | 40 | print_revision (progname, revision); |
80 | exit (STATE_OK); | 41 | exit (STATE_OK); |
@@ -83,11 +44,10 @@ main (int argc, char **argv) | |||
83 | print_help (); | 44 | print_help (); |
84 | exit (STATE_OK); | 45 | exit (STATE_OK); |
85 | } | 46 | } |
86 | else if (!is_integer (argv[1])) { | 47 | else if (!is_integer (argv[1])) |
87 | print_usage (); | 48 | usage (_("Arguments to check_dummy must be an integer\n")); |
88 | exit (STATE_UNKNOWN); | 49 | else |
89 | } | 50 | result = atoi (argv[1]); |
90 | result = atoi (argv[1]); | ||
91 | 51 | ||
92 | switch (result) { | 52 | switch (result) { |
93 | case STATE_OK: | 53 | case STATE_OK: |
@@ -99,10 +59,42 @@ main (int argc, char **argv) | |||
99 | case STATE_CRITICAL: | 59 | case STATE_CRITICAL: |
100 | printf ("Status is CRITICAL\n"); | 60 | printf ("Status is CRITICAL\n"); |
101 | break; | 61 | break; |
102 | default: | 62 | case STATE_UNKNOWN: |
103 | printf ("Status is UNKNOWN\n"); | 63 | printf ("Status is UNKNOWN\n"); |
104 | result = STATE_UNKNOWN; | 64 | break; |
65 | default: | ||
66 | printf ("Status %d is not a supported error state\n", result); | ||
67 | break; | ||
105 | } | 68 | } |
106 | 69 | ||
107 | return result; | 70 | return result; |
108 | } | 71 | } |
72 | |||
73 | |||
74 | |||
75 | void | ||
76 | print_help (void) | ||
77 | { | ||
78 | print_revision (progname, revision); | ||
79 | |||
80 | printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n")); | ||
81 | printf (_(COPYRIGHT), copyright, email); | ||
82 | |||
83 | print_usage (); | ||
84 | |||
85 | printf (_(UT_HELP_VRSN)); | ||
86 | |||
87 | printf (_("\n\ | ||
88 | This plugin will simply return the state corresponding to the numeric value\n\ | ||
89 | of the <state> argument.\n")); | ||
90 | |||
91 | printf (_(UT_SUPPORT)); | ||
92 | } | ||
93 | |||
94 | |||
95 | |||
96 | void | ||
97 | print_usage (void) | ||
98 | { | ||
99 | printf (_("Usage: %s <integer state>\n"), progname); | ||
100 | } | ||