delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/22/14:14:05

From: jqb AT netcom DOT com (Jim Balter)
Subject: Re: dos2unix program (was: Bash, history file, and Tcl)
22 Jan 1997 14:14:05 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <32E68104.6E1B.cygnus.gnu-win32@netcom.com>
References: <199701221720 DOT MAA05542 AT sol DOT pinebush DOT com>
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Ed Huott <huott AT pinebush DOT com>
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


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