Subject: Re: replacement for bc(1), dc(1), diff(1), and diff(3)
To: Ben Harris <bjh21@NetBSD.org>
From: Otto Moerbeek <otto@drijf.net>
List: tech-userlevel
Date: 03/29/2005 13:00:12
On Mon, 28 Mar 2005, Ben Harris wrote:

> >Well, after thinking about this for a while, I went back to the ChangeLog and
> >found a change in March of 1995 where I changed the line length to 68
> >numbers, the backslash and then the linefeed for a total of 70 characters.  I
> >was convinced by someone else that POSIX line lengths include the linefeed.
> 
> This is correct.  In the current POSIX, section 3.205 of XBD defines a
> "line" as:
> 
> # A sequence of zero or more non- <newline>s plus a terminating <newline>.
> <http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html
>  #tag_03_205>
> 
> Thus, a line includes its terminating newline, so the newline has to be
> counted when generating the 70-character lines required by bc.

OK, I fixed OpenBSD's dc(1) (and thus bc(1)). I also made the call stack 
dynamic, so there's no more arbitrary bound on recursion depth.

	-Otto