RPM Community Forums

Mailing List Message of <popt-devel>

Re: Allow equal after a short option

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 10 Mar 2008 - 00:10:21 CET
Message-Id: <A4FCE1AD-F9DB-46EB-8329-007EE0FFE0C9@mac.com>

On Mar 9, 2008, at 6:36 PM, Wayne Davison wrote:

> On Sat, Mar 08, 2008 at 12:10:52PM -0500, Jeff Johnson wrote:
>> Running test test1 - 9.
>> Test "test1 -2 foo" failed with: "arg1: 0 arg2:  rest: foo" != "arg1:
>> 0 arg2: foo"
>
> I can get that failure if the line I added does not replace the prior
> assignment (which makes it affect the case where *origOptString ==  
> '\0'
> as well as the desired case where it is not '\0').
>
> That's the only explanation I can come up with for why the code would
> fail.  I have attached a patch that codes up the increment in a  
> slightly
> different way, but I don't see how this change is any different on the
> code that follows than what was there before.  (Still, I might have
> missed something...)
>

Bingo.

My brain fart, nothing more. Tired old eyes again again, sigh.

Note the missing { ... }, I applied your original patch incorrectly.

Here's the fix:

Index: popt.c
===================================================================
RCS file: /v/rpm/cvs/popt/popt.c,v
retrieving revision 1.119
diff -u -b -B -w -p -r1.119 popt.c
--- popt.c      9 Mar 2008 20:24:45 -0000       1.119
+++ popt.c      9 Mar 2008 23:05:31 -0000
@@ -932,8 +932,7 @@ int poptGetNextOpt(poptContext con)

             origOptString++;
             if (*origOptString != '\0')
-               con->os->nextCharArg = origOptString;
-#ifdef NOTYET  /* XXX causes test 9 failure. */
+#ifndef        NOTYET  /* XXX causes test 9 failure. */
                 con->os->nextCharArg = origOptString +  
(*origOptString == '=');
  #endif
         }

Your original patch for -c=foo is now checked in.
73 de Jeff
Received on Mon Mar 10 00:10:31 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.