From: cuz Date: Wed, 23 Aug 2000 14:18:03 +0000 (+0000) Subject: Check for the presence of an argument if the option requires one. X-Git-Tag: V2.12.0~3219 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a30ea446e875e444c25565ef168b3bafb3470e75;p=cc65 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 --- diff --git a/src/common/cmdline.c b/src/common/cmdline.c index b12feb7c0..e0b4d6116 100644 --- a/src/common/cmdline.c +++ b/src/common/cmdline.c @@ -152,7 +152,12 @@ void LongOption (int* ArgNum, const LongOpt* OptTab, unsigned OptCount) if (strcmp (Opt, OptTab->Option) == 0) { /* Found, call the function */ 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 { OptTab->Func (Opt, 0); }