diff options
-rw-r--r-- | plugins/check_users.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c index 885c0dcf..f1e1c39d 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
@@ -55,13 +55,13 @@ const char *email = "devel@monitoring-plugins.org"; | |||
55 | 55 | ||
56 | #define possibly_set(a, b) ((a) == 0 ? (b) : 0) | 56 | #define possibly_set(a, b) ((a) == 0 ? (b) : 0) |
57 | 57 | ||
58 | int process_arguments(int, char **); | 58 | static int process_arguments(int, char **); |
59 | void print_help(void); | 59 | static void print_help(void); |
60 | void print_usage(void); | 60 | void print_usage(void); |
61 | 61 | ||
62 | char *warning_range = NULL; | 62 | static char *warning_range = NULL; |
63 | char *critical_range = NULL; | 63 | static char *critical_range = NULL; |
64 | thresholds *thlds = NULL; | 64 | static thresholds *thlds = NULL; |
65 | 65 | ||
66 | int main(int argc, char **argv) { | 66 | int main(int argc, char **argv) { |
67 | int users = -1; | 67 | int users = -1; |
@@ -180,8 +180,6 @@ int main(int argc, char **argv) { | |||
180 | 180 | ||
181 | /* process command-line arguments */ | 181 | /* process command-line arguments */ |
182 | int process_arguments(int argc, char **argv) { | 182 | int process_arguments(int argc, char **argv) { |
183 | int c; | ||
184 | int option = 0; | ||
185 | static struct option longopts[] = {{"critical", required_argument, 0, 'c'}, | 183 | static struct option longopts[] = {{"critical", required_argument, 0, 'c'}, |
186 | {"warning", required_argument, 0, 'w'}, | 184 | {"warning", required_argument, 0, 'w'}, |
187 | {"version", no_argument, 0, 'V'}, | 185 | {"version", no_argument, 0, 'V'}, |
@@ -191,13 +189,15 @@ int process_arguments(int argc, char **argv) { | |||
191 | if (argc < 2) | 189 | if (argc < 2) |
192 | usage("\n"); | 190 | usage("\n"); |
193 | 191 | ||
192 | int option_char; | ||
194 | while (true) { | 193 | while (true) { |
195 | c = getopt_long(argc, argv, "+hVvc:w:", longopts, &option); | 194 | int option = 0; |
195 | option_char = getopt_long(argc, argv, "+hVvc:w:", longopts, &option); | ||
196 | 196 | ||
197 | if (c == -1 || c == EOF || c == 1) | 197 | if (option_char == -1 || option_char == EOF || option_char == 1) |
198 | break; | 198 | break; |
199 | 199 | ||
200 | switch (c) { | 200 | switch (option_char) { |
201 | case '?': /* print short usage statement if args not parsable */ | 201 | case '?': /* print short usage statement if args not parsable */ |
202 | usage5(); | 202 | usage5(); |
203 | case 'h': /* help */ | 203 | case 'h': /* help */ |
@@ -215,13 +215,13 @@ int process_arguments(int argc, char **argv) { | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | c = optind; | 218 | option_char = optind; |
219 | 219 | ||
220 | if (warning_range == NULL && argc > c) | 220 | if (warning_range == NULL && argc > option_char) |
221 | warning_range = argv[c++]; | 221 | warning_range = argv[option_char++]; |
222 | 222 | ||
223 | if (critical_range == NULL && argc > c) | 223 | if (critical_range == NULL && argc > option_char) |
224 | critical_range = argv[c++]; | 224 | critical_range = argv[option_char++]; |
225 | 225 | ||
226 | /* this will abort in case of invalid ranges */ | 226 | /* this will abort in case of invalid ranges */ |
227 | set_thresholds(&thlds, warning_range, critical_range); | 227 | set_thresholds(&thlds, warning_range, critical_range); |