www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/16/04:11:23

Date: Sun, 16 Jul 2000 11:06:56 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Pipe to sendmail (again)
In-Reply-To: <rlbvmscgqjnp9fh5bh50b5is84o5o4kccl@4ax.com>
Message-ID: <Pine.SUN.3.91.1000716110622.21329C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 15 Jul 2000, Damian Yerrick wrote:

> >It is not always practical to change every call to `open', `fopen',
> >`fdopen', and `popen' in a large program ported from Unix.  This is
> >when `_fmode' comes in handy.
> 
> And so does search-and-replace.

I didn't say it was impossible, I said it was not always practical.
Try search-and-replace in a large package (such as Emacs or Web2c or
even Groff) and see what I mean.

In a sufficiently large package, you don't even know in all cases
whether a given call to open a file should use text or binary mode.
You need to have a clear understanding what kind of files are handled
by each specific instance of code.  And what if the same function
handles files some of which are text and some binary?

> For instance, in Binutils one can
> mostly change "r" to "rb" and "w" to "wb".  For Textutils, change "r"
> to "rt" and "w" to "wt".

I suggest a reality check: please look in these packages and see what
the ported code *really* looks like.  You will be surprised, I think.
(For example, Textutils actually do binary I/O most of the time.)

The problems with blindly using "wt" and "rb" were already described
in this thread: "b" is not portable to pre-ANSI Unix platforms, and
"t" is an extension to ANSI that isn't widely supported outside
DOS/Windows compilers.  So a maintainer of a GNU package will most
probably reject such patches.  In contrast, adding a DOS-specific line
which sets _fmode will probably be accepted (and is IMHO much less
invasive).

The problem with _fmode is that it is most of the time inappropriate,
as Hans-Bernhard explained.  (Cygwin is an exception.)

- Raw text -


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