terminal: Generalize character-screen code

This patch moves the further reusable parts of the terminal into public
header files. It also slightly tweaks the color table to give all colors
a similar brightness level.
libc_terminal: Support for dup2 and TIOCGWINSZ
libc: Handle dup2 with two equal arguments
ncurses: Add vt102 to builtin termcaps
Terminal multiplexer

The new terminal_mux server is able to provide multiple terminal
sessions over one terminal-client session. The user can switch
between the different sessions using the keyboard shortcut C-y,
which brings up an ncurses-based menu.