On Monday 28 February 2005 08:25, Stephen Deasey wrote:
> I was thinking about making the Ns_ObjvBool proc look at it's arg, and
> if present, place that in the destination pointer and not consume an
> object from the objv array. The presence of the option (without
> argument) alone would signify true, it's absence false.
>
> Then I realised I left out the short-circuit logic... When a --
> (break) arg is found the options are assumed to have ended and we jump
> to arg processing. The signal for this is that the Ns_ObjvBreak proc
> returns exactly objc. But that's really what the Bool proc should
> return in the case described above when it doesn't consume an arg.
>
> Unfortunately it's not as simple as that. The "wrong num args"
> description needs to know that the option takes no argument too.
>
>
> Any thoughts?
And if Ns_ObjvBreak returns zero as a signal that none
of the options are expected any more:
remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex,
specPtr->arg);
if (remain == 0 || remain == objc) {
remain = objc;
break;
}
Hm?
Zoran