I want to write a simple, dumb, X terminal emulator in C on a Linux system.
At first, I just thought I would have to popen a shell and display its output. I checked
With respect to the master/slave part of your question, from the pty(4) man page (which is referenced from the openpty(3) man page on my system):
A pseudo terminal is a pair of character devices, a master device and a slave device. The slave device provides to a process an interface identical to that described in tty(4). However, whereas all other devices which provide the interface described in tty(4) have a hardware device of some sort behind them, the slave device has, instead, another process manipulating it through the master half of the pseudo terminal. That is, anything written on the master device is given to the slave device as input and anything written on the slave device is presented as input on the master device.
Man pages are your friends.