Mail Archives: cygwin/2004/04/02/20:26:14
On Thu, 1 Apr 2004, Peter A. Castro wrote:
> On Thu, 1 Apr 2004, Oliver Kiddle wrote:
>
> Warning: this is long!!
Well, this time it's short!! :)
> > "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.
Ok, forget about adding O_TEXT to the open() calls. It's not necessary.
Thanks to Corinna from the Cygwin list, I have a better solution. It's
very Cygwin specific, but very inobtrusive to the mainline code which is
something I really like about this fix. I've tested it using both
binmode and textmode mounted filesystems and it passes the Test suite
with flying colors!
So, now I need a ruling on just where to put this fix. Due to how the
fix works, it can't be placed in DLL code. It must be linked into the
main exe. Now, I know that main.c is basically just a platform wrapper
for calling zsh_main(). My question is, to the zsh developers, would it
be acceptable to put code into main.c or should I persue adding a
seperate source file which will have to be part of MAIN_OBJS. I know
I'll have to hack zsh.mdd to add it as a dependency and get the various
prototype files created correctly, but I'm willing to do that. But, do I
really need to make it a separate source file or can I add it to main?
The fix consists of a special Cygwin function which is coded and linked
into the main. The function, itself, is very small and basically is a
hook in Cygwin to allow various internal variables to be set before the
program main gets control. My version sets textmode related things for
file I/O. So, again, this is a style/placement question. Put it in
main.c or make it a separate source file (which will only be used by the
Cygwin port or possible can be a place for other ports to put such code)?
> Thanks for listening. Any suggestions are welcome.
> > Oliver
--
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 -