aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_mysql.c')
-rw-r--r--plugins/check_mysql.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index f806a279..18324c81 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -189,25 +189,26 @@ process_arguments (int argc, char **argv)
c = optind;
- if (strlen(db_host) == 0 && argc > c)
- if (is_host (argv[c])) {
- db_host = argv[c++];
- }
- else {
- usage ("Invalid host name");
- }
-
- if (strlen(db_user) == 0 && argc > c)
- db_user = argv[c++];
-
- if (strlen(db_pass) == 0 && argc > c)
- db_pass = argv[c++];
-
- if (strlen(db) == 0 && argc > c)
- db = argv[c++];
+ while ( argc > c ) {
- if (is_intnonneg (argv[c]) && argc > c)
- db_port = atoi (argv[c++]);
+ if (strlen(db_host) == 0)
+ if (is_host (argv[c])) {
+ db_host = argv[c++];
+ }
+ else {
+ usage ("Invalid host name");
+ }
+ else if (strlen(db_user) == 0)
+ db_user = argv[c++];
+ else if (strlen(db_pass) == 0)
+ db_pass = argv[c++];
+ else if (strlen(db) == 0)
+ db = argv[c++];
+ else if (is_intnonneg (argv[c]))
+ db_port = atoi (argv[c++]);
+ else
+ break;
+ }
return validate_arguments ();
}