delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/28/14:03:23

Date: Fri, 28 Aug 92 12:12:33 -0500
From: mcastle AT cs DOT umr DOT edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: gcc (djgpp) default file mode (text vs binary) question?

Since there are so many programs that really want a binary stdin/stdout, 
maybe it would be possible to create a second crt0.o that, just before the
call to main, does a call to a function  fixIO()

where fixIO() is:

void fixIO(void) {
	setmode(fileno(stdion),O_BINARY);
	setmode(fileno(stdout),O_BINARY);
	}

just add fixIO to libc.a.  Whenever you want to do a program that really want
binary i/o, you just link with the alternative crt0.o file.

I suppose fixIO() should do a _fmode = O_BINARY as well.

Any major flaws with this plan???

(The easiest way to choose the crt0.o file would be to have one crt0text.o and
crt0bin.o and copy the appropriate one to crt0.o as necessary).  I doubt that
people would be working on simulateous projects that would require switching
back and forth between the crt0.o files often.

Just throwing out ideas,
mrc

- Raw text -


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