New API and implementation for blocking and non-blocking I/O.
Add sp_input_waiting() and sp_output_waiting() functions.
Fix conversion of timeout to struct timeval.
Handle EINTR by repeating the call.
Document EINTR handling.
Fix error in documentation.
Clarify documentation regarding signals and EINTR.
Handle EINTR from tcdrain() in sp_drain().
TIOCINQ/TIOCOUTQ is not available everywhere.

E.g. on NetBSD TIOCINQ is not available, but FIONREAD seems to
do pretty much the same thing.