fix infinite loop bugs in commandline parsing
This commit is contained in:
parent
b5519378e7
commit
2d143a9147
|
@ -254,7 +254,8 @@ bool CommandLine::parse(int argc,char **argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
int c = getopt_long(argc,argv,"",long_options,&option_index);
|
int c = getopt_long(argc,argv,"",long_options,&option_index);
|
||||||
if(c == -1)
|
if(c == -1) break;
|
||||||
|
if(c == '?')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch(c)
|
switch(c)
|
||||||
|
@ -361,8 +362,7 @@ bool CommandLine::parse(int argc,char **argv)
|
||||||
int remain = argc-optind;
|
int remain = argc-optind;
|
||||||
if(remain==1)
|
if(remain==1)
|
||||||
nds_file = argv[optind];
|
nds_file = argv[optind];
|
||||||
else if(remain>1)
|
else if(remain>1) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -443,9 +443,7 @@ bool CommandLine::validate()
|
||||||
|
|
||||||
void CommandLine::errorHelp(const char* binName)
|
void CommandLine::errorHelp(const char* binName)
|
||||||
{
|
{
|
||||||
//TODO - strip this down to just the filename
|
printerror(help_string);
|
||||||
printerror("USAGE: %s [options] [nds-file]\n", binName);
|
|
||||||
printerror("USAGE: %s --help - for help\n", binName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandLine::process_movieCommands()
|
void CommandLine::process_movieCommands()
|
||||||
|
|
Loading…
Reference in New Issue