philburk / pforth

Portable Forth in C
BSD Zero Clause License
589 stars 94 forks source link

Make sure terminal output is unbuffered on POSIX systems (probably related to musl, and not glibc) #110

Closed jpellegrini closed 2 years ago

jpellegrini commented 2 years ago

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.

Question: I did not check the output of setvbuf. Do you think it's necessary? I could change it so it issues a warning (to stderr, so the output is flushed immediately! :grin: )

philburk commented 2 years ago

@jpellegrini - Thanks for testing removing the call to tcsetattr() in #109. It does seem to still be needed. And thanks for adding the setvbuf() call.