delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/01/18:16:23

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
Date: Thu, 1 Apr 2004 15:11:54 -0800 (PST)
From: "Peter A. Castro" <doctor AT fruitbat DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: zsh and line breaks
In-Reply-To: <Pine.GSO.4.56.0404011646230.29906@slinky.cs.nyu.edu>
Message-ID: <Pine.LNX.4.53.0404011454580.9892@gremlin.fruitbat.org>
References: <s38u10erwrz DOT fsf AT ackusativ DOT ling DOT uu DOT se> <1vvf60l9i7n4nlobcroik2le5ofe6v2rn4 AT 4ax DOT com> <Pine DOT LNX DOT 4 DOT 53 DOT 0403291441160 DOT 5939 AT gremlin DOT fruitbat DOT org> <3372 DOT 1080639122 AT trentino DOT logica DOT co DOT uk> <Pine DOT LNX DOT 4 DOT 53 DOT 0403301047250 DOT 5939 AT gremlin DOT fruitbat DOT org> <2603 DOT 1080737128 AT trentino DOT logica DOT co DOT uk> <Pine DOT LNX DOT 4 DOT 53 DOT 0403310935450 DOT 9892 AT gremlin DOT fruitbat DOT org> <25057 DOT 1080810596 AT trentino DOT logica DOT co DOT uk> <Pine DOT LNX DOT 4 DOT 53 DOT 0404011224320 DOT 9892 AT gremlin DOT fruitbat DOT org> <Pine DOT GSO DOT 4 DOT 56 DOT 0404011646230 DOT 29906 AT slinky DOT cs DOT nyu DOT edu>
MIME-Version: 1.0
X-IsSubscribed: yes

On Thu, 1 Apr 2004, Igor Pechtchanski wrote:

> On Thu, 1 Apr 2004, Peter A. Castro wrote:
> > On Thu, 1 Apr 2004, Oliver Kiddle wrote:
> >
> > > "Peter A. Castro" wrote:
> > > > > It is easy for us to add `#ifdef __CYGWIN__' around changes or #define
> > > > > O_TEXT to zero on other systems so if you do correct the problem,
> > > > > please send the changes back to us.
> > > >
> > > > There are about 43 open() calls which I've updated with the O_TEXT
> > > > option.  Having all those ifdef's seemed rather ugly (makes the code hard
> > > > to look at, expectially when they are within a few lines of each other)
> > > > so I took a more "elegent" approach, though you may want to revise it if
> > > > it doesn't meet your style requirements :)
> > >
> > > I can believe that adding ifdef's to all is ugly. That's what I meant
> > > by "#define O_TEXT to zero on other systems" - just one thought on a
> > > possible more "elegant" approach.
> >
> > I might as well describe what I've done so you can give it a thumbs up or
> > down.  In system.h I've added a #define in the #ifdef __CYGWIN__ section of:
> > #define ORO_TEXT | O_TEXT
> > And for the #else case:
> > #define ORO_TEXT
> >
> > Then in code which needs it I have modified it to look like this:
> >
> > if ((fd = open(name, O_RDONLY ORO_TEXT)) < 0) {
>
> Oliver's way is more readable, IMO.  Remember, a|0 == a.  If it makes you
> uncomfortable to override O_TEXT, just make up another name (e.g.,
> O_TEXT_CYGWIN), and #define it to be O_TEXT on Cygwin and 0 everywhere
> else.

Ya, I will concede that it's more readable.  I'll probably end up
changing it to the more explicit form.

> > It's really just utilizing the macro ability of the compiler, and it's a
> > style judgement call.  I don't have a problem with it, obviously, but
> > others might look at it and wonder how it could possible compile if they
> > didn't look in system.h first.  If you think that might present
> > confusion, then I'll change it to be explicitly "| OR_TEXT" and have
> > #define O_TEXT to be 0 if not defined at all.
> >
> > Any thoughts on this?
>
> I thought that that was what linking with automode.o did...

Hmmm... I'm not sure it'll help.  Doesn't automode open for read in text
mode but open for write in binmode always (correct me if I'm wrong)?  If
so, that's not really what I'm looking for.  Really, I want the
attributes of the filesystem to be taken into considderation in that
reads will strip out CRs always but writes will generate CR/LFs as
needed.  I'll experiment with it, though, just to make sure.

> 	Igor

-- 
Peter A. Castro <doctor AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT com>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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