I'm writing a terminal, and was trying to use steam locomotive as a test bed, and ran into an unusual problem. Even in a regular terminal like xterm or mate-terminal, the output is different if you run the application, i.e. sl
verses if you log it to a file i.e. sl > sl.txt
then cat it cat sl.txt
This is particularly pronounced on sl-h
where in the first few seconds, codes are output which would make the X/O for the railroad crossing which if catted show incorrectly putting the X/O at the beginning of the line.
It seems that there is an ioctl
that's happening that somehow changes newline behavior to advance to the next line, but not return back to the beginning. I.e. strace sl-h 2> sllog.txt
shows: ioctl(1, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig -icanon echo ...}) = 0
How would you be able to detect this as a terminal? What systems are in place? Why wouldn't ncurses just use escape sequences to convey this information? There's a lot of questions that I'm not sure how to handle in my terminal.