1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-01 00:57:11 +00:00

Check for the presence of an argument if the option requires one.

git-svn-id: svn://svn.cc65.org/cc65/trunk@304 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-08-23 14:18:03 +00:00
parent 01bdac2907
commit a30ea446e8

View File

@ -152,7 +152,12 @@ void LongOption (int* ArgNum, const LongOpt* OptTab, unsigned OptCount)
if (strcmp (Opt, OptTab->Option) == 0) { if (strcmp (Opt, OptTab->Option) == 0) {
/* Found, call the function */ /* Found, call the function */
if (OptTab->ArgCount > 0) { if (OptTab->ArgCount > 0) {
OptTab->Func (Opt, ArgVec[++(*ArgNum)]); /* We need an argument, check if we have one */
const char* Arg = ArgVec[++(*ArgNum)];
if (Arg == 0) {
NeedArg (Opt);
}
OptTab->Func (Opt, Arg);
} else { } else {
OptTab->Func (Opt, 0); OptTab->Func (Opt, 0);
} }