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

RE: ?n or ?r?n?



Y'know, the last time I checked, the MiNTlibs already work this way...
I.e., when you fopen a file for read, using "r" gives you \r\n -> \n
translation. Using "rb" gives you the exact contents of the file,
with no modification. Likewise for writing - open with "w" mode, and
writing \n is translated to \r\n on output. With "wb" mode, no modification
is done. What's the problem?

Under MiNT, since we have actual tty device drivers, output to the console
will be determined by the settings in the driver (termio stuff). At one
time,
(I haven't looked recently) the MiNTlib contained tty emulation code for
TOS,
that would at least keep track of echo, binary, and a couple other basic
settings, so that \n and other special characters would still be handled
as intended. If this has broken recently, then I would guess that some of
the "crufty old baggage" that was thrown out from recent library overhauls
should not have been removed...

> -----Original Message-----
> From: Julian Reschke-FJR010 [mailto:Julian_Reschke-FJR010@email.mot.com]
> Sent: Thursday, May 21, 1998 2:37 PM
> To: rincewind#064#a-tuin.dascon.de@INTERNET.email.mot.com
> Cc: stehlik#064#cas3.zlin.vutbr.cz@INTERNET.email.mot.com;
> mint#064#atari.archive.umich.edu@INTERNET.email.mot.com
> Subject: Re: ?n or ?r?n?
>
>
> rincewind@a-tuin.dascon.de%INTERNET wrote:
> >
> > On Wed, May 20, 1998 at 10:54:41PM +0100, Petr Stehlik wrote:
> > > As I pointed out: the same object code linked with PureC libs does
> > > different thing than when linked with MiNTlibs. That should
> be fixed in
> > > MiNTlibs, not by rewritting every possible source code.
> >
> > Agreed.
> >
> > PureC *does* CRLF->LF->CRLF conversion in the library unless the files
> > were opened with "b" mode ("rb", "wb+" etc.). That way,
> programs behave like
> > they should (they never get to see the CR when processing ASCII
> files), yet
> > you get correct CRLF-terminated files.
> >
> > Some MSDOS libraries seem to do the same thing. And as the
> programmer should
> > know if he is dealing with ASCII or binary files, there is no
> problem with
> > that conversion, so IMHO the Mintlib should do it, too.
>
> I think this is what ANSI defines as the correct behaviour on a system
> which has a character sequence as line termination.
>
> Regards, jr
>