Mail Archives: cygwin/2000/08/07/10:32:52
>>cygwin-1.1.4:
>>
>>1) Consider qqq goes to a directory that is mounted without the -b option (CYGWIN=binmode).
>>
>>If I issue
>>
>>sh.exe -c "tar -O -xf file.tar > qqq"
>>
>>qqq contains CRCRLF.
>>
>>If I issue
>>
>>cmd.exe /c "tar -O -xf file.tar > qqq"
>>
>>qqq contains CRLF.
>>
>>Why does output differ?
CF> It has always differed, at least for a year or two.
CF> binmode only affects stdout when running from cmd.
It's a pity :-) I'd like that programs behave in the same way
when running from sh and cmd.
CF> You've obviously figured this out from looking at the code.
Not yet, but I believe your words :-)
CF> Btw, its LF and CRLF. Not CRLF and CRCRLF.
file.tar contains files with CRLF, so output contains CRCRLF.
>>2) Why hinfo::init_std_file_from_handle doesn't use __fmode anymore?
CF> Because it is using the value set by CYGWIN=, like it always has. I
CF> made several changes in 1.1.3 to accomodate some new methods for dealing
CF> with file open modes. The change decoupled __fmode from CYGWIN=binmode.
I see.
>>3) What is the precedence of CYGWIN=binmode, Program Options, mounting
>>directories with the -b option, linking with binmode.o/textmode.o, explicit
>>opening a file in binary/text mode? And how does it affect regular
>>files and stdin/stdout?
CF> Explicitly opening a file in binary/text mode takes precedence.
CF> CYGWIN=binmode affects devices or pipes. It also affects input/output
CF> redirection from the command shell.
CF> Otherwise, disk files are controlled by the mount table.
CF> When you're using "sh", cygwin knows exactly what file has been opened
CF> for stdout and the mount table controls that. When you are using cmd,
CF> cygwin has no idea what the output file is so CYGWIN=binmode controls
CF> its behavior.
So CYGWIN=binmode and Program Options control disk files only when I'm using cmd
and don't when I'm using sh, am I right?
CF> In 1.1.3 and 1.1.4 cygwin can also read from a table of filenames to
CF> control how files are opened by default. This requires making programmatic
CF> changes, though.
CF> Programs can also set the default input/output behavior by setting the __fmode
CF> global. This is how the binmode.o and textmode.o object files work. Linking
CF> your program with these files causes the default open behavior for files to
CF> be either binmode or textmode.
Thank you for information though your explanation only mixed me up :-)
I'll look at the code sometime.
Igor
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -