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

Re: ?n or ?r?n?



t150315@students.cc.tut.fi%INTERNET wrote:
> 
> > > Why not just use \r\n on programs which are supposed to (= can) run
> > > under both plain TOS and MiNT?
> >
> > Because many of them would cause big big difficulties under
> > MiNT.  Perl5.004 for example doesn't use getcwd() but takes
> > the output of the pwd command to retrieve the current
> > directory.  It then discards the last character (which is
> > guaranteed to be a newline) and then expects a valid
> > pathname.  If the pathname was terminated with \r\n (like
> > the K[GE]MD pwd does) this doesn't work because the extra
> > CR messes everything up.
> 
> Ahem, I should have said "use \r\n when you *have to* run under TOS
> (too)".  Who would want to run shell or shell utils on plain TOS?

I do. Sometimes. Then, I also run shells and utilities under MagiC.

> You seem to be suggesting that /every/ libc stream function should
> /always/ check:
>         1) FILE* is not opened with the binary flag OR
>         2) isatty(FILE*) is true / terminal has suitable flags set.
>         3) scan read / written string / chars for whether threre's an \n.
>         4) It's not preceded with \r (not as nasty as it sounds as I
>            think that streams always store the last char so we don't
>            have to hit disk again if \n is first char & buffer is flushed).
> 
> Then you'll insert \r before every suitable instance of \n.
> Am I right?
> 
> Is it worth the troubles ([1] would probably break some unix programs as
> 'b' has no meaning with single-char-newline-enviroment and therefore 'b'
> might not be always used)?
> 
> Does PureC implement the \r -> \r\n conversions completely or is it just
> a broken hack?

As far as I can decide, it's everywhere and working perfectly.

Regards, jr