From a0f74700d861d997a9bd34576c5e2a665e4fd8df Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Mon, 10 May 2010 23:45:15 +0000 Subject: [PATCH] fix the argc/argv issue git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4833 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/wizard.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/source/src/wizard.cpp b/source/src/wizard.cpp index 67797031..4f124033 100644 --- a/source/src/wizard.cpp +++ b/source/src/wizard.cpp @@ -46,19 +46,12 @@ static void readarg(vector &argstr, const char *desc, const char *name) int wizardmain(int argc, char **argv) { - const char *outfile = NULL, *relpath = NULL; - for(int i = 1; i < argc; i++) - { - if(!strncmp(argv[i], "--wizard", 8)) continue; - if(!outfile) outfile = argv[i]; - else if(!relpath) relpath = argv[i]; - } - if(!outfile || !relpath) - { - printf("invalid arguments specified!\n"); - printf("usage: ac_server \n"); - return EXIT_FAILURE; - } + int k, i = 0; + while ( ( k = strncmp(argv[i],"--wizard",8) ) != 0 && i < argc ) i++; + if ( k != 0 ) return EXIT_FAILURE; + + char *outfile = argv[++i]; + char *relpath = argv[++i]; printf("AssaultCube Server Wizard\n\n"); printf("You can now specify some optional server settings.\n"