[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] stdio write problem in mintlib



My latest patch made the MiNTLib act as Cygwin regarding to the mode:

- default mode (text or binary, according to UNIXMODE) must be only used for regular files
- binmode must be used in all the other cases (including pipes)

This is good because arbitrary binary data can be used in pipes (like in UNIX), and regular files are always written in the mode requested by the user (according to UNIXMODE). Furthermore, software that is know to work on Cygwin (regarding to textmode in stdio) will work as well with the MiNTLib.

These rules work well as long as everyone respects it.
Unfortunately, this is not the case for existing MiNT software.
- Plain TOS programs always use stdout in textmode (including pipes)
- Current MiNTLib programs always use stdout in default mode (including pipes)

So if an old program is piped into a newly patched MiNTLib proram, the new program will not work correctly, because it will find trailing CRs in stdin and will not discard them.

In order to be compatible with the existing programs, the best solution would probably to not patch anything. In that case the pipes use default mode, so it is impossible to use real binary data in pipes when UNIXMODE is not set to b (is it a real problem ?). And UNIX software will have to be patched explicitly for MiNT in order to be prepared to find CR in pipes (like bash with the ` ` syntax).

Any comment is welcome.

--
Vincent Rivière