Date: Sun, 16 Jul 2000 11:06:56 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp AT delorie DOT com Subject: Re: Pipe to sendmail (again) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.)