[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] stdio write problem in mintlib



I've found another problem in stdio's output.

Basically a program like this...

#include <stdio.h>
main()
{
	putchar('a');
	putchar('\n');
}

gcc -o main main.c

Then run ./main and you get the correct output.

But when outputting via no tty like this...

export TEST=`./main`

You get 

"EST="a

Notice that the linefeed has continued on and inserted into the
environment variable which is incorrect.

The __linebuf setting should be 0 in this respect as it's not line
buffered. Then somewhere later when we're writing out the buffer we
should strip out the '\n' characters but we don't in the unix/write.c
function.

I'm not sure where the best place is to fix this, so I thought I'd ask
here first.

Alan.