From efcfe62f1104f596bc92d2dce86e28d938d0aef7 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Fri, 15 Jan 1999 22:13:26 +0000 Subject: [PATCH] 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 --- mozilla/nsprpub/lib/libc/src/plgetopt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mozilla/nsprpub/lib/libc/src/plgetopt.c b/mozilla/nsprpub/lib/libc/src/plgetopt.c index c12387fc561..d2e5be3020d 100644 --- a/mozilla/nsprpub/lib/libc/src/plgetopt.c +++ b/mozilla/nsprpub/lib/libc/src/plgetopt.c @@ -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;