Improved version of the terminfo selection that should hopefully not break a standard build.