From: jqb@netcom.com (Jim Balter)
Subject: Re: dos2unix program (was: Bash, history file, and Tcl)
22 Jan 1997 14:14:05 -0800
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <32E68104.6E1B.cygnus.gnu-win32@netcom.com>
References: <199701221720.MAA05542@sol.pinebush.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Ed Huott <huott@pinebush.com>
Original-CC: gnu-win32@cygnus.com
Original-Sender: owner-gnu-win32@cygnus.com

Ed Huott wrote:

> Here's a DOS to Unix file filter that works a little better by leaving
> lone <cr>'s embedded in the file unmolested.

Except that it leaves CR's in lines that are exactly 998 chars long,
because fgets splits the line between the CR and the LF.
And if you think that doesn't matter, you haven't been around
text filters long enough.

> It should also run
> faster due to the buffering through the use of fgets() and fprintf().

getchar and putchar buffer quite nicely.  In most implementations
fgets and fprintf("%s") are just getchar and putchar loops.
I wouldn't make any speed claims without actually running the code;
the difference is likely to be in the noise.

> It's written using Microsoft compiler semantics, not gcc, sorry.

ANSI C is ANSI C.

--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
