Mail Archives: cygwin/1999/02/11/20:26:33
> ----------
> From: Bruce Lilly
> Sent: 1999$BG/(J2$B7n(J12$BF|(J 5:20:50
(J> To: Luke Kendall; uwin-users AT research DOT att DOT com
> Subject: Re: sh read mis-handling CR/LF?
> Auto forwarded by a Rule
>
Luke Kendall wrote:
>
> This is under Windows NT 4.0 sp4, U/WIN 2.0b1.
>
> Surely the shell's read function should not be opening files
> in binary mode? Surely it should be stripping the CR and LF from
> the end of the input line?
>
> I think the stuff below speaks for itself. Please let me know
> if I'm confused here.
>
> ---- test-here script -----
> #!/bin/sh
> cat <<-'EOF' > test-input
> test-1
> EOF
> read f rest < test-input
> if [ "$f" = "test-1" ]
> then
> echo "Read matches"
> else
> echo "Read mis-match"
> fi
>
> echo "od of input file:"
> od -c test-input
> echo "od of input line re-echoed:"
> echo "$f$rest" | od -c
> ---------- end -----------
OK (you asked for it!) you're confused. You need to eliminate the whitespace
before the "test-1" and "EOF" lines for starters.
Having made that correction and run the script, I get the following output here
(also NT 4.0 SP4 and U/WIN 2.0Beta1, with msvcrt.dll version 6.00.8337.0):
Read matches
od of input file:
0000000 t e s t - 1 \n
0000007
od of input line re-echoed:
0000000 t e s t - 1 \n
0000007
Note that I/O results may vary with the version of msvcrt.dll on your system, as
I posted a week and a half ago (titled "\015 before newline").
The version of msvcrt.dll mentioned above is available from
http://www.microsoft.com/ntserver/nts/downloads/recommended/MFCLibrary/default.asp
(it works on NT Server or workstation or non-NT MS-Windows). Microsoft says it
"resolves an issue that can cause some third party software to behave
unexpectedly." And that pretty much sums up your experience.
____________________________________________________________
If you need help unsubscribing or using this list in
general, send mail to owner-uwin-users AT research DOT att DOT com
To unsubscribe from this list, please send the following
two-line message to majordomo AT research DOT att DOT com, in which
your_email_address should be replaced by the address you
used when you subscribed to the list:
unsubscribe uwin-users your_email_address
end
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -