delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/30/07:23:38

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <004501c2c85a$6032d0b0$78d96f83@pomello>
From: "Max Bowsher" <maxb AT ukf DOT net>
To: <cygwin AT cygwin DOT com>
References: <E18dzmF-0002Lr-00 AT smtp03 DOT mrf DOT mail DOT rcn DOT net> <001301c2c7e8$11fb57e0$78d96f83 AT pomello> <20030130011501 DOT GB3603 AT redhat DOT com> <00b301c2c7ff$c646c5b0$78d96f83 AT pomello> <20030130013920 DOT GA4679 AT redhat DOT com> <00d901c2c801$2ebf59d0$78d96f83 AT pomello> <20030130015946 DOT GE4679 AT redhat DOT com>
Subject: Re: getopt_long behavior
Date: Thu, 30 Jan 2003 12:23:20 -0000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

Christopher Faylor wrote:
> On Thu, Jan 30, 2003 at 01:44:52AM -0000, Max Bowsher wrote:
>> This does not invalidate the proposal "do something at link time to
>> force POSIXLY_CORRECT if necessary for this app".
>
> I don't understand what it has to do with anything.  Your proposed
> change (which I've already made) will still work.  It will just
> require that executables be relinked before there is any change.
>
> To answer the question, no I don't think this calls for a binmode.o
> solution.  That would just lend to exactly the kind of confusion that
> Larry was cautioning against.

OK, confusion == bad. But I don't think what I propose would cause
confusion, done right. So maybe I'm not explaining it very well:

* getopt reordering is helpful for most programs
* getopt reordering is annoying for programs which take invocations of other
programs as arguments
* Cygwin getopt penalizes all programs for the sake of the few.
* POSIXLY_INCORRECT_GETOPT goes a little way to fixing this, but is still
not ideal.
* Ideal would be for the default to be reordering-enabled, and the few
programs which don't work well with this to automatically switch it off.

Possible solutions include having the few programs which need to:
- Call setenv("POSIXLY_CORRECT", "1") before calling getopt.
- Call [the hypothetical] set_getopt_posixly_correct(1) before calling
getopt
- Have an optionally linked premain object which does on of these

The only possible flaw is:
How to determine which programs need to do this.
Off hand, I can think of strace, and find -exec.

Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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