Don't treat TMUX_TMPDIR as a potential file

The point of setting TMUX_TMPDIR is to then make any labels from -L go to
that directory.  In the case of makesocketpath() with no TMUX_TMPDIR set,
would set both the path and the default socket to a file.  The checking of
the permissions on the file worked fine in that case, but when TMUX_TMPDIR
is set, won't work on a directory.

This fixes the problem by ensuring the check on the permissions is performed
on directories only.
layout-resize-pane-mouse: Consider visible panes only

When a pane is maximized, and text is selected, we end up checking if a pane
switch is needed.  This therefore means we might end up selecting panes
which aren't visible.
First period not last for host_short, from Michael Scholz.
Restore missing key binding for %, from Chris Johnsen.
Make cmdq->client_exit a tristate (-1 means "not set") so that if explicitly
set it can be copied from child to parent cmdq by if-shell and
source-file. This fixes using attach or new. From Chris Johnsen.
Support -c for new-session, based on code from J Raynor.
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
mouse-resize-pane: Only resize on border select

The current behaviour of mouse-resize-pane is such that if the mouse button
is held down and a selection takes place within a pane, that if the mouse
pointer then hits a border edge, that pane-resize would initiate.

This seems counter-intuitive; instead, check for a resize condition if the
border of a pane is selected, and in the case of mouse selection within a
pane, no longer resize the pane if edge of the border is hit.
Use open(".")/fchdir() to save and restore current directory rather than
getcwd()/chdir().
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Fix previous not to lead fd on failure.
Add subdir-objects to shut automake up

automake 1.14 onwards has started emitting lots of warnings about this
option:

automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the
'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding
output
automake: object file(s) will be placed in the top-level directory.
However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same
subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout
your
automake: project, to avoid future incompatibilities.

So enable this in AM_INIT_AUTOMAKE.

This doesn't seem to break older automake versions.
Check setupterm() in libtinfo also

Some ncurses packages have build time configuration options to separate its
different parts into separate libraries.  Some Linux distributions in
particular separate out the terminfo routines in to libtinfo.

This change teaches configure that setupterm() can also be found there.
Ignore .dirstamp files

GNU automake 1.14+ uses these files for subdir-option detection.  We don't
want to accidentally commit these.  They're not useful to us.
Remove CMD_SENDENVIRON.
Bump protocol version and add new message types.
Merge IDENTIFY_* flags with CLIENT_* flags.
retcode -> retval for exit message.
Instead of fixed size buffers for some messages, send only the string length.
Similarly for MSG_COMMAND - allow full imsg limit not arbitrary 2048.