Re: [cc65] A bug?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2008-07-21 20:40:51
On Mon, Jul 21, 2008 at 06:37:48PM +0200, silverdr@inet.com.pl wrote:
> Returning to this old thread... I found myself again in need of
> "proper" \r behaviour and started to look if I write my own function/
> macro/whatever or rather patch the lib, and.. I found the code for
> handling the \r sequence "properly" in many places. For example in
> cputc.s. I checked and indeed the cputc() does handle \n and \r
> differently and "properly" - meaning - \n generates newline while \r
> only returns the cursor to column zero - the way I would expect it to.

What are you talking about, conio or printf/write? Handling \r and \n
differently has always been the way conio does it. If one of the platforms
does not return to column zero for \r and advance the line without changing
the column for \n, it is broken and should be fixed.

printf/write is another case. It is implemented through low level POSIX
functions read() and write(), which are also used for file i/o. printf ist
just a shortcut for fprintf(stdout, ...) which actually does file i/o. For
these routines \r and \n are platform dependent. According to the C standard,
\n translates to whatever is used as a "newline" on the specific platform.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jul 21 20:41:02 2008

This archive was generated by hypermail 2.1.8 : 2008-07-21 20:41:04 CEST