[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 15:31:06 +0200
User-agent: Thunderbird (X11/20060501)

Andre Noll wrote:
On 12:41, Lorenzo Bettini wrote:
on what happend during the first call. How about coding up an own
version of getopt() with sane semantics?
that would be the other possibility I was thinking of... but I'm quite scared of writing another version of getopt with the same semantics... would you be interested in that?

Something like the attached?

This is glibc's getopt() and getopt_long() in a single file, with
its monster getopt_internal_r() function split up into three smaller
functions, and some glibc cruft removed.


so I used the file you sent me and modified it so that the initialization takes place when optind is 1 (and not 0).

I also modified the file and renamed the getopt stuffs with the prefix custom_; I then made everything static and include the contents of this file in the generated C files (in case conf or string parsers are generated). The customized version of getopt_long is then used by conf and string parsers and everything seems to work now and also valgrind does not find anything evil.

I also tested these features with the test_multiple_parsers test program that uses three parsers (and calls the string parsers many times).

you can find this new version here

this fix makes it work, but I'd still hear from the libc people in order to understand whether their getopt implementation was intended like that.

I hope to hear from you soon!

thanks again

|  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]