This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: zsh and line breaks


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.

> 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...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]