Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
Whoops, didn't mean to add this.
Update the man page with some recent changes to the code:

- SIGUSR1 recreates the socket;
- guesswork to work out if the terminal supports UTF-8;
- a paste key for the command prompt;
- main-horizontal layout to match main-vertical, and options to configure the
  size of the large pane;
- clear-history command;
- select-layout command.
Don't leak memory if multiple -f flags are given.

OK nicm@
Don't dereference NULL if buf winds up being empty. Can't happen
right now according to NicM but better safe than sorry.

OK nicm@
Make code clearer:
-       if (hdr->size > SIZE_MAX - 1)
+       if (hdr->size == SIZE_MAX)

OK nicm@
Don't access array[-1] if array is an empty string.

OK nicm@
spawn login shells by default, adapt manpage bits as well.
ok nicm@
sort options alphabetically.
remove unused flag; while here, make usage's output fit on 80-column displays.
Recent code to try and detect if a terminal supports UTF-8 by printing to it
fails spectacularly on (at least) sparc64, so disable it for now. Thanks to
naddy and Josh Elsasser for help and testing.
Cast char to u_char before passing to isalnum().

OK nicm@
some cleanup; ok nicm
When swapping pane positions, swap the PANE_HIDDEN flag as well, otherwise tmux
crashes when trying to find the new active pane.

While here, nuke an unused pane flag.

Fixes PR 6160, reported by and a slightly different version of diff tested by
ralf.horstmann at gmx.de.
undo a mistake found by sobrado;
Add a section summarising the status line. There are quite a number of status
line options, it is something many want to configure, and the meaning of some
bits weren't really documented.
Add missing documentation for the -a flag used to move to next/previous window
with alert.
Add a UTF-8 aware string length function and make UTF-8 in
status-left/status-right work properly. At the moment any top-bit-set
characters are assumed to be UTF-8: a status-utf8 option to configure this will
come shortly.
New session option, status-utf8, to control the interpretation of top-bit-set
characters in status-left and status-right (if on, they are treated as UTF-8;
otherwise passed through).
Do not set the window title by default (make set-titles option default to off),
wiping over the title is rude and annoying. Agreed by several.