delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/22/17:54:57

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <001701c30919$c82c88a0$5c16989e@oemcomputer>
Reply-To: "Peter S Tillier" <peter DOT tillier AT btinternet DOT com>
From: "Peter S Tillier" <peter DOT tillier AT btinternet DOT com>
To: <cygwin AT cygwin DOT com>
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0304220859170 DOT 19398-100000 AT slinky DOT cs DOT nyu DOT edu>
Subject: Re: Erroneous line endings (cat,gawk,text mount)
Date: Tue, 22 Apr 2003 22:54:41 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

Replying to Igor Pechtchanski who wrote:
[...]
>
> Peter,
>
> FYI, pipes ("|") are controlled by the "binmode" setting in the
> CYGWIN environment variable, which is the default.  I suspect the
> BINMODE variable will simply be ignored.  Try adding "nobinmode" to
> CYGWIN and running some of the piped experiments again.
>

Thanks - I had, indeed, missed that pipes are controlled by the CYGWIN
variable's "binmode" setting.  I will run the experiments again.

> If you specify the drive (e.g., "a:bar.txt"), the mount table is
> bypassed completely, and the file is accessed directly (and the mount
> is assumed to be text, IIRC).
>

Yes, I understand that from the documentation that any path that
includes a drive letter is assumed mounted in text mode.

> Also, "cat" will not translate line endings or anything at all --
> it's just a character-by-character copy of stdin to stdout.

Fair enough (and what I expect it to be) thanks for the clarification.

> You will
> get line end translation behavior from programs that read the input
> line-by-line and then print lines out with a "\n" (awk, sed, grep,
> etc).  The only thing the mount type controls is how "\n" is
> interpreted.  If your program never prints out a "\n" (that it didn't
> read from the input), the mount type and "[no]binmode" setting won't
> matter, I think...
> Igor
[...]

Thanks for this clarification too.  It does mean that I'll have to be
more thoughtful in the future in using awk scripts that run under
Cygwin and in "MSDOS" boxes under Win9x/ME and WinNT/2K/XP. ;-)

For example, using other awk implementations on Win32 platforms, any
"\n" (whether read by the awk program or not) is normally translated on
output to "\r\n", with the reverse translation on input, unless the
BINMODE variable is used to change that behaviour.

Regards,
Peter
--
Peter S Tillier
"Who needs perl when you can write dc, sokoban,
arkanoid and an unlambda interpreter in sed?"



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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