Add simple terminfo detection to std::term

This should be sufficient for most systems, and (according to terminfo(5)) is
SysV compliant, so... good enough?