diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-03-30 23:14:12 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-03-31 10:18:49 -0700 |
commit | 1a651243bb2c8e18baa9aac30ac52a62185074e7 (patch) | |
tree | dd2c0bfc448faef129fb64edec9f64d2ab12bfe5 /src/admin | |
parent | 769e8ac9c17779a15492d7fcfc1931c014670c2d (diff) | |
download | tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.gz tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.bz2 tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.xz tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.zip |
Be stricter about most arrays
Diffstat (limited to 'src/admin')
-rw-r--r-- | src/admin/ladmin.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp index f889b19..b56fd65 100644 --- a/src/admin/ladmin.cpp +++ b/src/admin/ladmin.cpp @@ -2840,34 +2840,36 @@ void term_func(void) //------------------------ // Main function of ladmin //------------------------ -int do_init(int argc, ZString *argv) +int do_init(Slice<ZString> argv) { + ZString argv0 = argv.pop_front(); bool loaded_config_yet = false; - for (int i = 1; i < argc; ++i) + while (argv) { - if (argv[i].startswith('-')) + ZString argvi = argv.pop_front(); + if (argvi.startswith('-')) { - if (argv[i] == "--help") + if (argvi == "--help") { PRINTF("Usage: %s [--help] [--version] [files...]\n", - argv[0]); + argv0); exit(0); } - else if (argv[i] == "--version") + else if (argvi == "--version") { PRINTF("%s\n", CURRENT_VERSION_STRING); exit(0); } else { - FPRINTF(stderr, "Unknown argument: %s\n", argv[i]); + FPRINTF(stderr, "Unknown argument: %s\n", argvi); runflag = false; } } else { loaded_config_yet = true; - runflag &= load_config_file(argv[i], admin_confs); + runflag &= load_config_file(argvi, admin_confs); } } |