delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/08/22/12:36:14

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <779F20BCCE5AD31186A50008C75D997917178D@silldn_mail1.sanwaint.com>
From: "Fifer, Eric" <EFifer AT sanwaint DOT com>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: RE: CR/LF and read is shell scripts
Date: Tue, 22 Aug 2000 17:34:46 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

Earnie Boyd wrote:
>Let me see if IIRC.  You, Eric Fifer, had said that cat is forcing binary
mode
>file processing regardless of the text/binary mode default settings.

Yes, see textutils-2.0/src/cat.c around line 650:

  /* We always read and write in BINARY mode, since this is the
     best way to copy the files verbatim.  Exceptions are when
     they request line numbering, squeezing of empty lines or
     marking lines' ends: then we use text I/O, because otherwise
     -b, -s and -E would surprise users on DOS/Windows where a line
     with only CR-LF is an empty line.

>Cat, IIRC, comes from the textutils package.  This implies that cat is a
text
>utility and processing of files should default to text mode processing.

This is historical usage.  The usage of `cat` is pervasive, and now
simple things like this fail if foo is on a text mount:

	x=hello
	echo $x >foo
	y=`cat foo`
	if [ "$x" != "$y" ]; then echo not equal; fi

>IIRC, you had also suggested a switch --binmode for processing binary files
>with cat.

I said --binary/-B is now in the latest version of cat, look at the source.

>I believe that this should be the case.  So given this cat should be
>changed to:
>
>Process stdin in text mode and stdout in binary mode.
>Process stdin and stdout in binary mode if --binmode is given.
>Process stdin and stdout in text mode if --textmode is given.
>Process stdin in binary if --binmode-in is given.
>Process stdout in text mode if --textmode-out is given.
>The switch --textmode-in and --binmode-out should also be supported.

The default Cygwin behavior for binmode/textmode processing
should be fine.  The way cat formerly worked was correct
(I'm actually using my old B20.1 cat to work around this
problem).  The current problems were introduced by the upgrade to
textutils-2.0 cat which added some O_BINARY handling for Win32,
and at the same time clobbered the default Cygwin textmode/binmode
processing.

Eric

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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