delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/12/14:46:03

Date: Tue, 12 Jun 2001 21:09:02 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Mark E." <snowball3 AT bigfoot DOT com>
Message-Id: <3791-Tue12Jun2001210902+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3B2556BB.3255.1FD3D5@localhost> (snowball3@bigfoot.com)
Subject: Re: getconf
References: <3B2556BB DOT 3255 DOT 1FD3D5 AT localhost>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Mark E." <snowball3 AT bigfoot DOT com>
> Date: Mon, 11 Jun 2001 23:39:39 -0400
> 
> getconf is a tool I could make use of, so I implemented it. Below is my first 
> version.

Thanks!

I have a couple of minor comments:

>   /* For now, any option will trigger the usage text.  */
>   while ((c = getopt(argc, argv, "h")) != -1)
>   {
>     switch (c)
>     {
>       case 'h':
>       {
>         help();
>         break;
>       }
>       default:

Shouldn't we support the -v option defined by the Posix draft?

>   while (beg <= end)
>   {
>     i = (end + beg) / 2;
>     cmp = strcmp (var_name, var_list[i].name);
>     if (cmp == 0)
>     {
>       beg = end = i;
>       break;
>     }
>     if (cmp > 0)
>     {
>       beg = i + 1;
>     }
>     else
>     {
>       end = i - 1;
>     }
>   }

If you are using binary search, isn't it better to call bsearch?

Finally, a general remark that is not directly related to the code.  A
few ported packages include a fake getconf script which just exits,
because the configure script invokes getconf.  When getconf is
included in djdev, people who work on these packages should remove
those fake scripts and use the real getconf instead.  (I know it's too
early to talk about this; I just wanted to go on record about this
before I forget.)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019