Subject: Re: dos2unix program (was: Bash, history file, and Tcl)
From: [email-masked] (Jim Balter)

22 Jan 1997 14:14:05 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
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 <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

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
"[email-masked]" with one line of text: "help".