Subject: Re: replacement for bc(1), dc(1), diff(1), and diff(3)
To: None <phil@cs.wwu.edu>
From: Ben Harris <bjh21@netbsd.org>
List: tech-userlevel
Date: 03/28/2005 11:27:27
In article <200503270757.58262.phil@cs.wwu.edu> you write:
>On Sunday 27 March 2005 07:24, Phil Nelson wrote:
>> On Sunday 27 March 2005 04:11, you wrote:
>> > That's 68 digits, a backslash and 3 digits.
>> > Line lenght is 69
>>
>> You are right.  GNU bc is wrong.
>
>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.

-- 
Ben Harris