[fpc-devel] GetLongOpts won't set flag when long option is found

Michael Van Canneyt michael at freepascal.org
Thu Oct 13 14:21:01 CEST 2016



On Mon, 10 Oct 2016, grouchysmurf wrote:

> Hi.
>
> I've  been  playing  with GetLongOpts recently and I *think* I found a
> bug  though  this may be as well a required behaviour but I decided to
> report it anyway.
>
> GetLongOpts fails to set a flag even when directly told to so.
>
> Consider following code [1].
>
> When  executed  with  '-o'  it  sets  flag  as expected. When one uses
> '--option' instead flag is not set.
>
> In getopts.pp, line #397:
>
>          if longind<>nil then
>           plongint(longind)^:=indfound+1;
>          if pfound^.flag<>nil then
>           begin
>             pfound^.flag^:=pfound^.value;
>             internal_getopt:=#0;
>             exit;
>           end;
>
> I  do  believe  that  the exit should be there but again, maybe that's
> just me.

I will look at it, at least I can reproduce the problem.

Can you please post a bugreport, so it will not be forgotten ?

Michael.



More information about the fpc-devel mailing list