summaryrefslogtreecommitdiffstats
path: root/plugins/check_users.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-10-31 13:16:34 (GMT)
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-10-31 13:16:34 (GMT)
commit7185547291299ce9d32dc95054c35dcabf184e3f (patch)
tree3f09166ed5e788fdbe47c1ce3548c9dd6f02a3de /plugins/check_users.c
parent61f569e6d3493e2cd648c3c17f4eb7c82f1070f0 (diff)
downloadmonitoring-plugins-7185547291299ce9d32dc95054c35dcabf184e3f.tar.gz
check_users: do not export local variables + style fixes
Diffstat (limited to 'plugins/check_users.c')
-rw-r--r--plugins/check_users.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 885c0dc..f1e1c39 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
58int process_arguments(int, char **); 58static int process_arguments(int, char **);
59void print_help(void); 59static void print_help(void);
60void print_usage(void); 60void print_usage(void);
61 61
62char *warning_range = NULL; 62static char *warning_range = NULL;
63char *critical_range = NULL; 63static char *critical_range = NULL;
64thresholds *thlds = NULL; 64static thresholds *thlds = NULL;
65 65
66int main(int argc, char **argv) { 66int 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 */
182int process_arguments(int argc, char **argv) { 182int 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);