Package: dc
Version: 1.06.95-8

The main() function for dc has a call at the start like this:

 (void) setvbuf(stdout, NULL, _IOLBF, 0);

This should be using unbuffered I/O not Line buffered; ie:
 setbuf(stdout, NULL);

Reasoning:

dc was designed to be called as a filter on the standard out of the bc(1)
command so that the parsing of infix notations and similar could be run in
a separate process to the calculation engine that is dc. As it replaces
the standard output it must be possible to output prompts ie: "Enter a
number:" that do not have a trailing newline through it. With the output
of dc set to line buffered and the standard input set to the process
that compiles the source language into dc code this will not happen.

An alternate option would be to do a fflush() after every print like command in the same way that the stdio library has already been configured to do for the "p" command. This would (possibly) have the advantage of slightly better performance than single character writes.

As it stands gnu-dc is broken when used in an output filter chain for a bc command or any other program doing a simlar process.

--
Rob.                          (Robert de Bath <robert$ @ debath.co.uk>)
                                             <http://www.debath.co.uk/>


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to