tty: iron out all warnings

APIs changes; implementation bugs.