This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
_IONBF drops all newlines
- From: Nick THOMPSON <nickthompson at agere dot com>
- To: newlib at sources dot redhat dot com
- Date: Mon, 07 Jun 2004 14:32:46 +0100
- Subject: _IONBF drops all newlines
- Organization: Agere Systems
Hi all,
newlib-1.12.0, gcc 3.4 for arm-elf, custom OS.
I'm new to newlib and am trying to embed it on an ARM946. I have my code
booting nicely now with stdin/out as default settings (line buffered??).
However, my code is interactive (i.e. command line editing) and I need
stdio to be unbuffered so I can use getchar for real time char input and
putchar/printf output to control a VT100 cursor. So I added...
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
...early in my code (no output so far), but this seem to make puts not
output a \n and printf also seems to ignore any \n in the format string.
putchar('\n') works fine and my serial driver does the conversion to
CR/LR for the terminal.
I don't use crt0 and have a custom boot sequence, that sets .data and
.bss correctly. It doesn't call any kind of newlib init routines, as
there don't seem to be any (stdio initialised on the fly for example).
Have I missed something obvious?
Thanks in advance,
Nick.