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.
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.