diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 13:36:49 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-09 13:36:49 +0000 |
commit | 90b45deb4138efb47efbdd98a4aede1aebb47146 (patch) | |
tree | d27a0180ce89542ee546a0b1e958b68a114ea7ce /plugins/check_users.c | |
parent | 4784cac1f017a67978c2f3f2af75b161d1ef33c0 (diff) | |
download | monitoring-plugins-90b45deb4138efb47efbdd98a4aede1aebb47146.tar.gz |
more pedantic compiler warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@674 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_users.c')
-rw-r--r-- | plugins/check_users.c | 86 |
1 files changed, 49 insertions, 37 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c index d4480e70..9e182015 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
@@ -25,43 +25,11 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
25 | #include "popen.h" | 25 | #include "popen.h" |
26 | #include "utils.h" | 26 | #include "utils.h" |
27 | 27 | ||
28 | void | ||
29 | print_usage (void) | ||
30 | { | ||
31 | printf ("Usage: %s -w <users> -c <users>\n", progname); | ||
32 | printf (_(UT_HLP_VRS), progname, progname); | ||
33 | } | ||
34 | |||
35 | void | ||
36 | print_help (void) | ||
37 | { | ||
38 | print_revision (progname, revision); | ||
39 | |||
40 | printf (_("Copyright (c) 1999 Ethan Galstad\n")); | ||
41 | printf (_(COPYRIGHT), copyright, email); | ||
42 | |||
43 | printf (_("\ | ||
44 | This plugin checks the number of users currently logged in on the local\n\ | ||
45 | system and generates an error if the number exceeds the thresholds specified.\n")); | ||
46 | |||
47 | print_usage (); | ||
48 | |||
49 | printf (_(UT_HELP_VRSN)); | ||
50 | |||
51 | printf (_("\ | ||
52 | -w, --warning=INTEGER\n\ | ||
53 | Set WARNING status if more than INTEGER users are logged in\n\ | ||
54 | -c, --critical=INTEGER\n\ | ||
55 | Set CRITICAL status if more than INTEGER users are logged in\n")); | ||
56 | |||
57 | printf (_(UT_SUPPORT)); | ||
58 | } | ||
59 | |||
60 | #define possibly_set(a,b) ((a) == 0 ? (b) : 0) | 28 | #define possibly_set(a,b) ((a) == 0 ? (b) : 0) |
61 | 29 | ||
62 | int process_arguments (int, char **); | 30 | int process_arguments (int, char **); |
63 | void print_usage (void); | ||
64 | void print_help (void); | 31 | void print_help (void); |
32 | void print_usage (void); | ||
65 | 33 | ||
66 | int wusers = -1; | 34 | int wusers = -1; |
67 | int cusers = -1; | 35 | int cusers = -1; |
@@ -171,12 +139,14 @@ process_arguments (int argc, char **argv) | |||
171 | case 'c': /* critical */ | 139 | case 'c': /* critical */ |
172 | if (!is_intnonneg (optarg)) | 140 | if (!is_intnonneg (optarg)) |
173 | usage (_("Critical threshold must be a nonnegative integer\n")); | 141 | usage (_("Critical threshold must be a nonnegative integer\n")); |
174 | cusers = atoi (optarg); | 142 | else |
143 | cusers = atoi (optarg); | ||
175 | break; | 144 | break; |
176 | case 'w': /* warning */ | 145 | case 'w': /* warning */ |
177 | if (!is_intnonneg (optarg)) | 146 | if (!is_intnonneg (optarg)) |
178 | usage (_("Warning threshold must be a nonnegative integer\n")); | 147 | usage (_("Warning threshold must be a nonnegative integer\n")); |
179 | wusers = atoi (optarg); | 148 | else |
149 | wusers = atoi (optarg); | ||
180 | break; | 150 | break; |
181 | } | 151 | } |
182 | } | 152 | } |
@@ -185,14 +155,56 @@ process_arguments (int argc, char **argv) | |||
185 | if (wusers == -1 && argc > c) { | 155 | if (wusers == -1 && argc > c) { |
186 | if (is_intnonneg (argv[c]) == FALSE) | 156 | if (is_intnonneg (argv[c]) == FALSE) |
187 | usage (_("Warning threshold must be a nonnegative integer\n")); | 157 | usage (_("Warning threshold must be a nonnegative integer\n")); |
188 | wusers = atoi (argv[c++]); | 158 | else |
159 | wusers = atoi (argv[c++]); | ||
189 | } | 160 | } |
190 | 161 | ||
191 | if (cusers == -1 && argc > c) { | 162 | if (cusers == -1 && argc > c) { |
192 | if (is_intnonneg (argv[c]) == FALSE) | 163 | if (is_intnonneg (argv[c]) == FALSE) |
193 | usage (_("Warning threshold must be a nonnegative integer\n")); | 164 | usage (_("Warning threshold must be a nonnegative integer\n")); |
194 | cusers = atoi (argv[c]); | 165 | else |
166 | cusers = atoi (argv[c]); | ||
195 | } | 167 | } |
196 | 168 | ||
197 | return OK; | 169 | return OK; |
198 | } | 170 | } |
171 | |||
172 | |||
173 | |||
174 | |||
175 | |||
176 | |||
177 | void | ||
178 | print_help (void) | ||
179 | { | ||
180 | print_revision (progname, revision); | ||
181 | |||
182 | printf (_("Copyright (c) 1999 Ethan Galstad\n")); | ||
183 | printf (_(COPYRIGHT), copyright, email); | ||
184 | |||
185 | printf (_("\ | ||
186 | This plugin checks the number of users currently logged in on the local\n\ | ||
187 | system and generates an error if the number exceeds the thresholds specified.\n")); | ||
188 | |||
189 | print_usage (); | ||
190 | |||
191 | printf (_(UT_HELP_VRSN)); | ||
192 | |||
193 | printf (_("\ | ||
194 | -w, --warning=INTEGER\n\ | ||
195 | Set WARNING status if more than INTEGER users are logged in\n\ | ||
196 | -c, --critical=INTEGER\n\ | ||
197 | Set CRITICAL status if more than INTEGER users are logged in\n")); | ||
198 | |||
199 | printf (_(UT_SUPPORT)); | ||
200 | } | ||
201 | |||
202 | |||
203 | |||
204 | |||
205 | void | ||
206 | print_usage (void) | ||
207 | { | ||
208 | printf ("Usage: %s -w <users> -c <users>\n", progname); | ||
209 | printf (_(UT_HLP_VRS), progname, progname); | ||
210 | } | ||