summaryrefslogtreecommitdiffstats
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)
189 189
190 c = optind; 190 c = optind;
191 191
192 if (strlen(db_host) == 0 && argc > c) 192 while ( argc > c ) {
193 if (is_host (argv[c])) {
194 db_host = argv[c++];
195 }
196 else {
197 usage ("Invalid host name");
198 }
199
200 if (strlen(db_user) == 0 && argc > c)
201 db_user = argv[c++];
202
203 if (strlen(db_pass) == 0 && argc > c)
204 db_pass = argv[c++];
205
206 if (strlen(db) == 0 && argc > c)
207 db = argv[c++];
208 193
209 if (is_intnonneg (argv[c]) && argc > c) 194 if (strlen(db_host) == 0)
210 db_port = atoi (argv[c++]); 195 if (is_host (argv[c])) {
196 db_host = argv[c++];
197 }
198 else {
199 usage ("Invalid host name");
200 }
201 else if (strlen(db_user) == 0)
202 db_user = argv[c++];
203 else if (strlen(db_pass) == 0)
204 db_pass = argv[c++];
205 else if (strlen(db) == 0)
206 db = argv[c++];
207 else if (is_intnonneg (argv[c]))
208 db_port = atoi (argv[c++]);
209 else
210 break;
211 }
211 212
212 return validate_arguments (); 213 return validate_arguments ();
213} 214}