From: jpellegrini Date: Mon, 4 Apr 2022 00:23:55 +0000 (-0300) Subject: Make sure terminal output is unbuffered on POSIX systems (#110) X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=fa8de1fa6ddd9d3c394b851ba87db15a22505bea;p=debian%2Fpforth Make sure terminal output is unbuffered on POSIX systems (#110) Call setvbuf on terminal initialization in csrc/posix/pf_io_posix.c. At least on one platform (OpenWRT), pForth was buffering the characters while the user typed, instead of echoing them immediately; this fixes that issue. Fixes #109 Fixes #87 --- diff --git a/csrc/posix/pf_io_posix.c b/csrc/posix/pf_io_posix.c index bd0c50e..156e860 100644 --- a/csrc/posix/pf_io_posix.c +++ b/csrc/posix/pf_io_posix.c @@ -131,6 +131,10 @@ void sdTerminalInit(void) { perror("sdTerminalInit: tcsetattr"); } + if (setvbuf(stdout, NULL, _IONBF, (size_t) 0) != 0) + { + perror("sdTerminalInit: setvbuf"); + } } }