X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/37a4386d2c3260f8c4ed6b9268a5d48f847ec85b..d7b6774d82ae234978542c43c9ad655c8ade101e:/popt/popt.c diff --git a/popt/popt.c b/popt/popt.c index a2c24e78..a01b6b96 100644 --- a/popt/popt.c +++ b/popt/popt.c @@ -809,16 +809,20 @@ int poptGetNextOpt(poptContext con) *oe++ = '\0'; /* XXX longArg is mapped back to persistent storage. */ longArg = origOptString + (oe - localOptString); - } + } else + oe = NULL; opt = findOption(con->options, optString, '\0', &cb, &cbData, singleDash); if (!opt && !singleDash) return POPT_ERROR_BADOPT; + if (!opt && oe) + oe[-1] = '='; /* restore overwritten '=' */ } if (!opt) { con->os->nextCharArg = origOptString + 1; + longArg = NULL; } else { if (con->os == con->optionStack && opt->argInfo & POPT_ARGFLAG_STRIP) @@ -856,7 +860,7 @@ int poptGetNextOpt(poptContext con) origOptString++; if (*origOptString != '\0') - con->os->nextCharArg = origOptString; + con->os->nextCharArg = origOptString + (*origOptString == '='); } /*@=branchstate@*/