This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Erroneous line endings (cat,gawk,text mount)


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]