Make all exception classes inherit from std::exception

This refactors out a very common pattern of formatting "%s: %s" with
e.function.c_str() and strerror( e.the_errno ) into just the what()
method of NetworkException. It's also a prerequisite for making cleaner
public API for any exceptions we throw, and allows us to more easily
get exceptions passed back to us to handle.
UTF8Parser::input: size_t is unsigned, so it can't be negative
Style cleanup: "foo &x", not "foo& x"
Throw std::exception subclasses instead of std::strings

Now everything we throw or catch ourselves is a subclass of
std::exception.
macosx: Stop setting ac_cv_poll_pty, since it was removed in bb651581.
terminaldisplay: Make a for loop's boundary better match its body

Both f and frame.last_frame must have the same number of rows here, but
since we're iterating over frame.last_frame's rows, make that more
explicit.