On 10 Nov 2023 at 08:30a, Apam pondered and said...
BY: tenser (21:1/101)
I'm not sure what you mean with respect to redirection and
the blocking/buffering behavior of stdin. Can you explain
what it is precisely that you're trying to do? Generally,
On linux, most bbs systems redirect stdin/stdout to the telnet socket.
I'm trying to remove line buffering so i can read characters one at a time, and stop blocking so i can test for timeleft while waiting for input.
Gotcha. I think what this means at the system level is
that IO to the standard in, out, and error streams is
redirected to the network, which is independent of the
"standard IO" library in a lot of ways.
Given that you want to sample from both an input and test
against a timeout, you may actually have a good candidate
for using `async/await` and tokio; then you'd test between
the timeout and input arriving on the socket.
library. Indeed, if you need unbuffered/non-blocking
semantics for a particular file-like object, stdio may not
be the best abstraction.
I did try from raw fd on fd 0 and 1, while it worked for stdout, it did not work for stdin.
Looks like you found the issue by putting the tty into raw
mode. Huzzah!
I'm looking at your code: I'd definitely recommend running
`rustfmt` to start.
Cool! thanks for the tip! i imagine that's like clangformat?
Yup. `cargo fmt` early and often.
--- Mystic BBS v1.12 A48 (Linux/64)
* Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)