pseudoterminal functionality

much thanks to the annotated code and examples at
http://rachid.koucha.free.fr/tech_corner/pty_pdip.html

Signed-off-by: Leo Bärring <leo.barring@gmail.com>