cterminaldebiantermios

termios default for standard terminal session


I would like to create a new pty session in Linux, like as gnome-terminal xterm and others do. Half of my task is working, I created a pty session with openpty, fork()-ed a process, child uses the slave FD, and the remaining process terminal attach to a network socket.

Through the network I can connect to "remote terminal", but it's not working correctly. There's no echo, and characters aren't sent after the enter is pressed (so I can't navigate in nano, mc, etc).

The termios struct's set up with cfmakeraw(struct termios).

The Question: what is the default termios settings in a default session like in gnome-terminal and others.


Solution

  • Pass NULL as the struct termios * argument to openpty() (or forkpty(), which you should look into!), and the resulting defaults should be reasonable for an interactive terminal.