This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: getopts missing with latest cygwin


> >> -rwxr-xr-x   1 bin      bin         1518 Jul 25  1995 /usr/bin/getopts
> >>
> >> I have no idea how it actually is used with sh on this system, though.
> >
> >It's not.  It simply exists to satisfy a POSIX.2 requirement.  It need
> >not be (and is not) useful.
>
> It's not completely useless, though.

It's worse than useless :-) ... it looks like a functional command, but no
matter how hard you try, you can't get the thing to work.

> % /usr/bin/getopts "a:" foo -a
> /usr/bin/getopts[7]: getopts: a argument expected

Another interesting problem: "foo" (the variable holding the next parsed
argument) will be set in the environment of *getopts* which will be lost
when getopts exits.  The shell will never see "foo" change.

So, the external getopts can't communicate the parsed options to the shell,
nor the option argument (OPTARG) or option index (OPTIND).  I'll bet the
external getopts doesn't even work for parsing beyond the first argument.
If it does work past the first argument (i.e. the first invocation of
getopts), then getopts is dropping temp file garbage somewhere.

Worse than useless :-)

- Erik


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]