And if TTY code was that easy to grep for, maybe it would be simple: we
have distributors who can point to such code.
But it is not. TTY users can be people who accept file descriptors via
pipes and have no idea there are TTYs at the other end: they can be people
who use the Unix98 or the old BSD pty interface (which still has users!);
every use of ioctl() has to be audited: the signal handling in TTY users
has to be checked; it ties in with process groups...
The TTY stuff introduced in the early BSD Unix is, let's be blunt, a
bloody design mess, and a pervasive one. It's not a nice simple <pty.h>
interface, by any means, although it should have been.