Fix various issues (compile warnings etc.)

The fixes include:
 * Add missing return values for some functions,
 * Initialize some variables
 * Fix data declaration to match struct's definition
 * Appropriate casting where needed
 * Forward declaration for some functions
Make sure a remote command is executed from the foreground window of a display.

If a remote command is executed from a window inside the session, and it does not pre-select a
window, and the window that issued the command is not visible in any display, and there is an
existing display for the user, then execute the command in that display's foreground window's
context.
Fix a crash when switching from altscreen after window resize.

This change fixes a crash when window is resized while in altscreen mode.
More details in the bug: http://savannah.gnu.org/bugs/?35757
Add a new escape character 'E' to indicate whether the escape character has been pressed.

This can be used to show visual notification in the hardstatus/caption that the user has pressed the
escape character.
make ^A DEL work again

It was broken because we discarded all mapped sequences. Now we
let sequences with length 1 through to ProcessInput2.
extend commit #8c1b8e45, which fixed -x but forgot about -r
Amend documentation for -X option.
Fix segfault when restoring w_alt.cursor.

This fixes a crash when the window is made too small (zero height).
The crash can be reproduced by turning on altscreen and caption, and
resizing the terminal window to height = 1. After this, if the
termianl window height is increased, screen would crash when going
out of the alt screen.
Guard against NULL returns from crypt().

crypt() can return NULL on an error. Make sure these nulls are
handled properly instead of crashing. The fix is thanks to a patch
from Lukáš Nykrýn <lnykryn@redhat.com>.
avoid compiler warning about crypt
Support non-BMP utf8 characters
fix typo, duh. Thanks to Jim Mahood for reporting this.
set fontx to null instead of 0 if the encoding is switched to non-utf8

Should fix a segfault reported by consolers.
fixed https://savannah.gnu.org/bugs/?41934
C-a C-h is a hotkey for 'prev', but C-a h is not.
prepare for v.4.2.0
incompatible protocol
fix screen to run on terminals with long $TERM

According to tic man page:
Terminal names exceeding the maximum alias length
(32 characters on systems with long filenames, 14 characters otherwise)
will  be  truncated  to  the maximum alias length and a warning message
will be printed.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
test more libraries for tgetent

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Fix bug when building without nethack commands

When building with -DNONETHACK all commands were off by 1 because of
missing nethack command in table.

Provide dummy command with info message.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
do proper checks if we are on altscreen or not

fixes screen segfaults with `altscreen on` when using applications making
use of altscreen like mc when resizing screen window

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>