Bugzilla bug #2431: fixed PL_GetNextOpt so that it returns PL_OPT_BAD
instead of asserts when an option that has an associated value is not followed by a value. Also fixed a bug that incorrectly skipped the option following a naked option. git-svn-id: svn://10.0.0.236/trunk@17872 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a1dbc02252
commit
efcfe62f11
@ -141,7 +141,7 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
*/
|
||||
if (':' == internal->options[cop + 1])
|
||||
{
|
||||
PR_ASSERT(0 == *internal->xargv);
|
||||
if (0 != *internal->xargv) return PL_OPT_BAD;
|
||||
opt->value = internal->argv[++(internal->xargc)];
|
||||
internal->xargv = &static_Nul;
|
||||
internal->minus = PR_FALSE;
|
||||
@ -156,7 +156,7 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
/*
|
||||
** No '-', so it must be a standalone value. The option is nul.
|
||||
*/
|
||||
opt->value = internal->argv[(internal->xargc)++];
|
||||
opt->value = internal->argv[internal->xargc];
|
||||
internal->xargv = &static_Nul;
|
||||
opt->option = 0;
|
||||
return PL_OPT_OK;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user