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: Mon, 8 May 2006 16:35:42 +0200
User-agent: Mutt/1.5.9i

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.

It's still a bit crufty, so it sure needs some more work. But it is
hopefully more readable than the original glibc source and definitely
much shorter.

The getopt() and getopt_long() functions of this version take the same
arguments as the original ones, so they may used as a drop-in
replacement for the corresponding functions of the system.

At the bottom of the file there's a test included. Activate it with

        gcc -Wall -DTEST getopt.c

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

Attachment: getopt.c
Description: Text Data


reply via email to

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