[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] read-line
From: |
Joerg F. Wittenberger |
Subject: |
Re: [Chicken-users] read-line |
Date: |
11 Dec 2002 14:54:02 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
Felix Winkelmann <address@hidden> writes:
> Joerg F. Wittenberger wrote:
> > Hi,
> > I found read-line working somewhat unexpected on network streams
>
> > (where the ^M^J or the "apple" line feed rule applies): it inserts
> > empty lines in between the line feed.
> > Anybody who objects this change, which understands any of:
>
> > #\newline #\return #\return #\newline
>
> > #\newline
> > #\return as line delimiter. Sequences, though, should result in
> > empty lines.
>
> There is one little problem, though: when reading data
> interactively, and we have normal (1-byte) line-terminators,
> then your solution will have to read the next line from the user,
> before it can process the current line.
true. hm. that trap is just ahead.
> I propose to add an optional flag to `read-line' that
> states wether extra line-terminators should be consumed
> or not (defaulting to not).
I would propose a different route:
a) by default read up to #\newline, if the preceeding char in
#\return, don't include it in the result string.
b) a flag to switch the roles of #\newline and #\return from the
default behavior.
This should cover the "apple case" as exception and work just fine for
unix and network convention.
/Jörg
--
The worst of harm may often result from the best of intentions.