Andre Noll wrote:
the struct that is passed to getopt_internal_r is static, so its fields
are initialized to 0 only once: the first time getopt_internal_r is
called the struct is correctly initialized, the other times it is not
(unless you set optind to 0, which is not standard)
Exactly.
what do you think?
I fully agree with your analysis. But I'm afraid the glibc people will
argue that their implementation is posix conform and that there are
(glibc-only) workarounds for our problem available.
So I think the best way to circumvent this is to further clean
up the getopt.c I've posted and to include it in gengetopt.
I've just posted a tentative version that uses the customized version to
solve the problem
actually, as far as I understand, the posix says that at the beginning
optind must be 1, so it makes sense (at least to me :-) that optind = 1
must be considered the initialization condition and not optind = 0
This not only avoids future compatiblility issues with other
implementations of getopt, but also gives us the freedom to change
things at will rather than having to rely on a standard which simply
doesn't cover things like multiple parsers or a non-constant argv.
yes but my only concern is that any future updates/addition to getopt
implementation must be adapted by hand to the customized version...
time will tell ;-)
hope to hear from you soon
cheers
Lorenzo
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science |
| Dip. Sistemi e Informatica, Univ. di Firenze |
| Florence - Italy (GNU/Linux User # 158233) |
| Home Page : http://www.lorenzobettini.it |
| http://music.dsi.unifi.it XKlaim language |
| http://www.purplesucker.com Deep Purple Cover Band |
| http://www.gnu.org/software/src-highlite |
| http://www.gnu.org/software/gengetopt |
| http://www.lorenzobettini.it/software/gengen |
| http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+
_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt