help-gengetopt
[Top][All Lists]
Advanced

[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: Andre Noll
Subject: Re: [help-gengetopt] make cmd_line_list and cmd_line_list_tmp static?
Date: Tue, 16 May 2006 21:12:47 +0200
User-agent: Mutt/1.5.9i

first of all, sorry for the delay (I was busy trying to get a job)

On 15:31, Lorenzo Bettini wrote:
> 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.

Very nice, thank you very much.

Is there a reason to use the custom parser only from
cmdline_parser_configfile() but not from cmdline_parser()?

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

I just tested the new version and this change finally solves the
problem of the grab command :)

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

Yes, that'd be interesting. From the cvs changelog I see that Uli
and Roland McGrath are the main authors of the getopt code in glibc.

One minor thing: There's a missing 'void' in src/skels/c_source.h_skel
for which causes gcc to spit out

        warning: function declaration isn't a prototype

Trivial fix below.
Andre


--- gengetopt-2.17rc3/src/skels/c_source.h_skel 2006-05-14 14:57:27.000000000 
+0200
+++ gengetopt-2.17rc3-hacked/src/skels/c_source.h_skel  2006-05-16 
20:52:07.000000000 +0200
@@ -57,7 +57,7 @@ static struct line_list *cmd_line_list =
 static struct line_list *cmd_line_list_tmp = 0;
 
 static void
-free_cmd_list()
+free_cmd_list(void)
 {
   /* free the list of a previous call */
   if (cmd_line_list)

-- 
The only person who always got his work done by Friday was Robinson Crusoe




reply via email to

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