getch2: Refactor/rewrite

Still uses termcap, but uses terminfo for loading the termcap database if
possible. Adds configure test to find terminfo; skips the termcap test
if terminfo is found since terminfo provides termcap.

Use termcap completely for special keys; if we can't get it from termcap
and it isn't one of the known fallbacks, we ignore its specialness and
treat as a sequence of UTF-8 codes.

Further hardcoded fallbacks can be added by calling keys_push_once in
load_termcap; there is no limit to the amount of keys pushed.

Uses the "ke" and "ks" capabilities to start / exit application mode, which
is necessary on vt100 emulators (including screen, xterm and all terminals
that emulate either of those) to correctly receive arrow keys.

It's now possible to compile getch2 even without termcap, though it won't
be of much use since it'll be unable to detect special keys.

Converted to 4 spaces per tab, prettified some statements.
getch2: Remove unused function, fix possible crash

If we still haven't read the full key from the input but it's regardless a
unique match in the database, we could receive a NULL keycode from
keys_search (it's not a full match after all) and proceed to use it.

Don't disable the keycode matching code if we don't have termcap as we can
still match against the hardcoded sequences.
getch2, mplayer: Always call load_termcap

getch2 now deals with the cases where we don't have termcap. Add a dummy
load_termcap to getch2-win so we don't get linking errors on mingw.
configure: Fix bad variable assignment

Bourne shell hates having spaces before or after the = sign.
Merge branch 'getch2/refactor'

* getch2/refactor:
  configure: Fix bad variable assignment
  getch2, mplayer: Always call load_termcap
  getch2: Remove unused function, fix possible crash
  getch2: Refactor/rewrite