[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] make cmd_line_list and cmd_line_list_tmp static?

From: Lorenzo Bettini
Subject: Re: [help-gengetopt] make cmd_line_list and cmd_line_list_tmp static?
Date: Sun, 14 May 2006 16:18:50 +0200
User-agent: Thunderbird (X11/20060501)

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)


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


|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        :    |
|         XKlaim language  |
| Deep Purple Cover Band |
|           |
|              |
|       |
|    |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]