pty: add PTY helper

The pty helper provides basic UNIX PTY management. As it requires
edge-triggered event-handling (if done correctly), we provide this small
helper to simplify usage in applications.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>