summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--tags/TMUX_0_8/CHANGES1212
-rw-r--r--tags/TMUX_0_8/FAQ189
-rw-r--r--tags/TMUX_0_8/GNUmakefile144
-rw-r--r--tags/TMUX_0_8/Makefile158
-rw-r--r--tags/TMUX_0_8/NOTES97
-rw-r--r--tags/TMUX_0_8/TODO103
-rw-r--r--tags/TMUX_0_8/arg.c194
-rw-r--r--tags/TMUX_0_8/array.h119
-rw-r--r--tags/TMUX_0_8/attributes.c92
-rw-r--r--tags/TMUX_0_8/buffer-poll.c99
-rw-r--r--tags/TMUX_0_8/buffer.c227
-rw-r--r--tags/TMUX_0_8/cfg.c121
-rw-r--r--tags/TMUX_0_8/client-fn.c92
-rw-r--r--tags/TMUX_0_8/client-msg.c159
-rw-r--r--tags/TMUX_0_8/client.c228
-rw-r--r--tags/TMUX_0_8/clock.c161
-rw-r--r--tags/TMUX_0_8/cmd-attach-session.c80
-rw-r--r--tags/TMUX_0_8/cmd-bind-key.c157
-rw-r--r--tags/TMUX_0_8/cmd-break-pane.c92
-rw-r--r--tags/TMUX_0_8/cmd-choose-session.c107
-rw-r--r--tags/TMUX_0_8/cmd-choose-window.c106
-rw-r--r--tags/TMUX_0_8/cmd-clock-mode.c54
-rw-r--r--tags/TMUX_0_8/cmd-command-prompt.c178
-rw-r--r--tags/TMUX_0_8/cmd-copy-buffer.c222
-rw-r--r--tags/TMUX_0_8/cmd-copy-mode.c56
-rw-r--r--tags/TMUX_0_8/cmd-delete-buffer.c61
-rw-r--r--tags/TMUX_0_8/cmd-detach-client.c54
-rw-r--r--tags/TMUX_0_8/cmd-down-pane.c61
-rw-r--r--tags/TMUX_0_8/cmd-find-window.c204
-rw-r--r--tags/TMUX_0_8/cmd-generic.c694
-rw-r--r--tags/TMUX_0_8/cmd-has-session.c51
-rw-r--r--tags/TMUX_0_8/cmd-kill-pane.c72
-rw-r--r--tags/TMUX_0_8/cmd-kill-server.c51
-rw-r--r--tags/TMUX_0_8/cmd-kill-session.c68
-rw-r--r--tags/TMUX_0_8/cmd-kill-window.c69
-rw-r--r--tags/TMUX_0_8/cmd-last-window.c60
-rw-r--r--tags/TMUX_0_8/cmd-link-window.c109
-rw-r--r--tags/TMUX_0_8/cmd-list-buffers.c91
-rw-r--r--tags/TMUX_0_8/cmd-list-clients.c61
-rw-r--r--tags/TMUX_0_8/cmd-list-commands.c51
-rw-r--r--tags/TMUX_0_8/cmd-list-keys.c59
-rw-r--r--tags/TMUX_0_8/cmd-list-sessions.c67
-rw-r--r--tags/TMUX_0_8/cmd-list-windows.c87
-rw-r--r--tags/TMUX_0_8/cmd-list.c139
-rw-r--r--tags/TMUX_0_8/cmd-load-buffer.c102
-rw-r--r--tags/TMUX_0_8/cmd-lock-server.c54
-rw-r--r--tags/TMUX_0_8/cmd-move-window.c123
-rw-r--r--tags/TMUX_0_8/cmd-new-session.c248
-rw-r--r--tags/TMUX_0_8/cmd-new-window.c241
-rw-r--r--tags/TMUX_0_8/cmd-next-layout.c54
-rw-r--r--tags/TMUX_0_8/cmd-next-window.c78
-rw-r--r--tags/TMUX_0_8/cmd-paste-buffer.c78
-rw-r--r--tags/TMUX_0_8/cmd-previous-window.c78
-rw-r--r--tags/TMUX_0_8/cmd-refresh-client.c54
-rw-r--r--tags/TMUX_0_8/cmd-rename-session.c57
-rw-r--r--tags/TMUX_0_8/cmd-rename-window.c61
-rw-r--r--tags/TMUX_0_8/cmd-resize-pane-down.c122
-rw-r--r--tags/TMUX_0_8/cmd-resize-pane-up.c117
-rw-r--r--tags/TMUX_0_8/cmd-respawn-window.c87
-rw-r--r--tags/TMUX_0_8/cmd-rotate-window.c111
-rw-r--r--tags/TMUX_0_8/cmd-save-buffer.c90
-rw-r--r--tags/TMUX_0_8/cmd-scroll-mode.c72
-rw-r--r--tags/TMUX_0_8/cmd-select-pane.c69
-rw-r--r--tags/TMUX_0_8/cmd-select-prompt.c93
-rw-r--r--tags/TMUX_0_8/cmd-select-window.c71
-rw-r--r--tags/TMUX_0_8/cmd-send-keys.c184
-rw-r--r--tags/TMUX_0_8/cmd-send-prefix.c57
-rw-r--r--tags/TMUX_0_8/cmd-server-info.c182
-rw-r--r--tags/TMUX_0_8/cmd-set-buffer.c64
-rw-r--r--tags/TMUX_0_8/cmd-set-option.c169
-rw-r--r--tags/TMUX_0_8/cmd-set-password.c169
-rw-r--r--tags/TMUX_0_8/cmd-set-window-option.c168
-rw-r--r--tags/TMUX_0_8/cmd-show-buffer.c89
-rw-r--r--tags/TMUX_0_8/cmd-show-options.c110
-rw-r--r--tags/TMUX_0_8/cmd-show-window-options.c110
-rw-r--r--tags/TMUX_0_8/cmd-source-file.c147
-rw-r--r--tags/TMUX_0_8/cmd-split-window.c235
-rw-r--r--tags/TMUX_0_8/cmd-start-server.c46
-rw-r--r--tags/TMUX_0_8/cmd-string.c309
-rw-r--r--tags/TMUX_0_8/cmd-suspend-client.c64
-rw-r--r--tags/TMUX_0_8/cmd-swap-pane.c285
-rw-r--r--tags/TMUX_0_8/cmd-swap-window.c75
-rw-r--r--tags/TMUX_0_8/cmd-switch-client.c161
-rw-r--r--tags/TMUX_0_8/cmd-unbind-key.c120
-rw-r--r--tags/TMUX_0_8/cmd-unlink-window.c74
-rw-r--r--tags/TMUX_0_8/cmd-up-pane.c61
-rw-r--r--tags/TMUX_0_8/cmd.c390
-rw-r--r--tags/TMUX_0_8/colour.c124
-rw-r--r--tags/TMUX_0_8/compat/asprintf.c89
-rw-r--r--tags/TMUX_0_8/compat/bsd-poll.c123
-rw-r--r--tags/TMUX_0_8/compat/bsd-poll.h61
-rw-r--r--tags/TMUX_0_8/compat/daemon.c69
-rw-r--r--tags/TMUX_0_8/compat/fgetln.c87
-rw-r--r--tags/TMUX_0_8/compat/forkpty-aix.c94
-rw-r--r--tags/TMUX_0_8/compat/forkpty-irix.c83
-rw-r--r--tags/TMUX_0_8/compat/forkpty-sunos.c86
-rw-r--r--tags/TMUX_0_8/compat/getopt.h76
-rw-r--r--tags/TMUX_0_8/compat/getopt_long.c523
-rw-r--r--tags/TMUX_0_8/compat/queue.h528
-rw-r--r--tags/TMUX_0_8/compat/strlcat.c58
-rw-r--r--tags/TMUX_0_8/compat/strlcpy.c54
-rw-r--r--tags/TMUX_0_8/compat/strtonum.c68
-rw-r--r--tags/TMUX_0_8/compat/tree.h738
-rw-r--r--tags/TMUX_0_8/compat/vis.c219
-rw-r--r--tags/TMUX_0_8/compat/vis.h84
-rw-r--r--tags/TMUX_0_8/examples/n-marriott.conf85
-rw-r--r--tags/TMUX_0_8/examples/n-marriott.sh11
-rw-r--r--tags/TMUX_0_8/examples/screen-keys.conf187
-rw-r--r--tags/TMUX_0_8/examples/tmux.vim79
-rw-r--r--tags/TMUX_0_8/grid-view.c211
-rw-r--r--tags/TMUX_0_8/grid.c497
-rw-r--r--tags/TMUX_0_8/images/tmux1.pngbin0 -> 3813 bytes
-rw-r--r--tags/TMUX_0_8/images/tmux2.pngbin0 -> 19080 bytes
-rw-r--r--tags/TMUX_0_8/images/tmux3.pngbin0 -> 18603 bytes
-rw-r--r--tags/TMUX_0_8/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_0_8/images/tmux5.pngbin0 -> 30468 bytes
-rw-r--r--tags/TMUX_0_8/images/tmux6.pngbin0 -> 32868 bytes
-rw-r--r--tags/TMUX_0_8/index.html.in24
-rw-r--r--tags/TMUX_0_8/input-keys.c227
-rw-r--r--tags/TMUX_0_8/input.c1272
-rw-r--r--tags/TMUX_0_8/key-bindings.c232
-rw-r--r--tags/TMUX_0_8/key-string.c198
-rw-r--r--tags/TMUX_0_8/layout.c246
-rw-r--r--tags/TMUX_0_8/log.c254
-rw-r--r--tags/TMUX_0_8/mode-key.c199
-rw-r--r--tags/TMUX_0_8/names.c109
-rw-r--r--tags/TMUX_0_8/options-cmd.c182
-rw-r--r--tags/TMUX_0_8/options.c160
-rw-r--r--tags/TMUX_0_8/osdep-darwin.c51
-rw-r--r--tags/TMUX_0_8/osdep-freebsd.c125
-rw-r--r--tags/TMUX_0_8/osdep-linux.c63
-rw-r--r--tags/TMUX_0_8/osdep-netbsd.c122
-rw-r--r--tags/TMUX_0_8/osdep-openbsd.c134
-rw-r--r--tags/TMUX_0_8/osdep-unknown.c32
-rw-r--r--tags/TMUX_0_8/paste.c131
-rw-r--r--tags/TMUX_0_8/resize.c138
-rw-r--r--tags/TMUX_0_8/screen-redraw.c149
-rw-r--r--tags/TMUX_0_8/screen-write.c685
-rw-r--r--tags/TMUX_0_8/screen.c240
-rw-r--r--tags/TMUX_0_8/server-fn.c227
-rw-r--r--tags/TMUX_0_8/server-msg.c304
-rw-r--r--tags/TMUX_0_8/server.c1053
-rw-r--r--tags/TMUX_0_8/session.c374
-rw-r--r--tags/TMUX_0_8/status.c924
-rw-r--r--tags/TMUX_0_8/tmux.11320
-rw-r--r--tags/TMUX_0_8/tmux.c486
-rw-r--r--tags/TMUX_0_8/tmux.h1671
-rw-r--r--tags/TMUX_0_8/tty-keys.c414
-rw-r--r--tags/TMUX_0_8/tty-term.c399
-rw-r--r--tags/TMUX_0_8/tty-write.c91
-rw-r--r--tags/TMUX_0_8/tty.c1004
-rw-r--r--tags/TMUX_0_8/utf8.c247
-rw-r--r--tags/TMUX_0_8/util.c52
-rw-r--r--tags/TMUX_0_8/util/256colors.pl63
-rw-r--r--tags/TMUX_0_8/util/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_0_8/util/ansicode.txt779
-rw-r--r--tags/TMUX_0_8/util/fuzz.c31
-rw-r--r--tags/TMUX_0_8/window-choose.c361
-rw-r--r--tags/TMUX_0_8/window-clock.c124
-rw-r--r--tags/TMUX_0_8/window-copy.c968
-rw-r--r--tags/TMUX_0_8/window-more.c252
-rw-r--r--tags/TMUX_0_8/window-scroll.c296
-rw-r--r--tags/TMUX_0_8/window.c699
-rw-r--r--tags/TMUX_0_8/xmalloc-debug.c238
-rw-r--r--tags/TMUX_0_8/xmalloc.c182
-rw-r--r--tags/TMUX_0_9/CHANGES1330
-rw-r--r--tags/TMUX_0_9/FAQ197
-rw-r--r--tags/TMUX_0_9/GNUmakefile57
-rw-r--r--tags/TMUX_0_9/Makefile62
-rw-r--r--tags/TMUX_0_9/NOTES90
-rw-r--r--tags/TMUX_0_9/TODO92
-rw-r--r--tags/TMUX_0_9/arg.c194
-rw-r--r--tags/TMUX_0_9/array.h119
-rw-r--r--tags/TMUX_0_9/attributes.c93
-rw-r--r--tags/TMUX_0_9/buffer-poll.c56
-rw-r--r--tags/TMUX_0_9/buffer.c142
-rw-r--r--tags/TMUX_0_9/cfg.c131
-rw-r--r--tags/TMUX_0_9/client-fn.c92
-rw-r--r--tags/TMUX_0_9/client-msg.c159
-rw-r--r--tags/TMUX_0_9/client.c233
-rw-r--r--tags/TMUX_0_9/clock.c161
-rw-r--r--tags/TMUX_0_9/cmd-attach-session.c79
-rw-r--r--tags/TMUX_0_9/cmd-bind-key.c157
-rw-r--r--tags/TMUX_0_9/cmd-break-pane.c92
-rw-r--r--tags/TMUX_0_9/cmd-choose-session.c107
-rw-r--r--tags/TMUX_0_9/cmd-choose-window.c106
-rw-r--r--tags/TMUX_0_9/cmd-clear-history.c67
-rw-r--r--tags/TMUX_0_9/cmd-clock-mode.c54
-rw-r--r--tags/TMUX_0_9/cmd-command-prompt.c178
-rw-r--r--tags/TMUX_0_9/cmd-confirm-before.c141
-rw-r--r--tags/TMUX_0_9/cmd-copy-buffer.c222
-rw-r--r--tags/TMUX_0_9/cmd-copy-mode.c58
-rw-r--r--tags/TMUX_0_9/cmd-delete-buffer.c61
-rw-r--r--tags/TMUX_0_9/cmd-detach-client.c54
-rw-r--r--tags/TMUX_0_9/cmd-down-pane.c61
-rw-r--r--tags/TMUX_0_9/cmd-find-window.c165
-rw-r--r--tags/TMUX_0_9/cmd-generic.c694
-rw-r--r--tags/TMUX_0_9/cmd-has-session.c51
-rw-r--r--tags/TMUX_0_9/cmd-kill-pane.c72
-rw-r--r--tags/TMUX_0_9/cmd-kill-server.c51
-rw-r--r--tags/TMUX_0_9/cmd-kill-session.c68
-rw-r--r--tags/TMUX_0_9/cmd-kill-window.c69
-rw-r--r--tags/TMUX_0_9/cmd-last-window.c60
-rw-r--r--tags/TMUX_0_9/cmd-link-window.c109
-rw-r--r--tags/TMUX_0_9/cmd-list-buffers.c91
-rw-r--r--tags/TMUX_0_9/cmd-list-clients.c67
-rw-r--r--tags/TMUX_0_9/cmd-list-commands.c51
-rw-r--r--tags/TMUX_0_9/cmd-list-keys.c59
-rw-r--r--tags/TMUX_0_9/cmd-list-sessions.c67
-rw-r--r--tags/TMUX_0_9/cmd-list-windows.c88
-rw-r--r--tags/TMUX_0_9/cmd-list.c154
-rw-r--r--tags/TMUX_0_9/cmd-load-buffer.c106
-rw-r--r--tags/TMUX_0_9/cmd-lock-server.c52
-rw-r--r--tags/TMUX_0_9/cmd-move-window.c123
-rw-r--r--tags/TMUX_0_9/cmd-new-session.c248
-rw-r--r--tags/TMUX_0_9/cmd-new-window.c241
-rw-r--r--tags/TMUX_0_9/cmd-next-layout.c55
-rw-r--r--tags/TMUX_0_9/cmd-next-window.c78
-rw-r--r--tags/TMUX_0_9/cmd-paste-buffer.c78
-rw-r--r--tags/TMUX_0_9/cmd-previous-layout.c55
-rw-r--r--tags/TMUX_0_9/cmd-previous-window.c78
-rw-r--r--tags/TMUX_0_9/cmd-refresh-client.c54
-rw-r--r--tags/TMUX_0_9/cmd-rename-session.c57
-rw-r--r--tags/TMUX_0_9/cmd-rename-window.c61
-rw-r--r--tags/TMUX_0_9/cmd-resize-pane.c105
-rw-r--r--tags/TMUX_0_9/cmd-respawn-window.c87
-rw-r--r--tags/TMUX_0_9/cmd-rotate-window.c122
-rw-r--r--tags/TMUX_0_9/cmd-save-buffer.c90
-rw-r--r--tags/TMUX_0_9/cmd-scroll-mode.c74
-rw-r--r--tags/TMUX_0_9/cmd-select-layout.c86
-rw-r--r--tags/TMUX_0_9/cmd-select-pane.c69
-rw-r--r--tags/TMUX_0_9/cmd-select-prompt.c93
-rw-r--r--tags/TMUX_0_9/cmd-select-window.c71
-rw-r--r--tags/TMUX_0_9/cmd-send-keys.c184
-rw-r--r--tags/TMUX_0_9/cmd-send-prefix.c57
-rw-r--r--tags/TMUX_0_9/cmd-server-info.c180
-rw-r--r--tags/TMUX_0_9/cmd-set-buffer.c64
-rw-r--r--tags/TMUX_0_9/cmd-set-option.c170
-rw-r--r--tags/TMUX_0_9/cmd-set-password.c169
-rw-r--r--tags/TMUX_0_9/cmd-set-window-option.c165
-rw-r--r--tags/TMUX_0_9/cmd-show-buffer.c89
-rw-r--r--tags/TMUX_0_9/cmd-show-options.c110
-rw-r--r--tags/TMUX_0_9/cmd-show-window-options.c110
-rw-r--r--tags/TMUX_0_9/cmd-source-file.c147
-rw-r--r--tags/TMUX_0_9/cmd-split-window.c236
-rw-r--r--tags/TMUX_0_9/cmd-start-server.c46
-rw-r--r--tags/TMUX_0_9/cmd-string.c309
-rw-r--r--tags/TMUX_0_9/cmd-suspend-client.c64
-rw-r--r--tags/TMUX_0_9/cmd-swap-pane.c294
-rw-r--r--tags/TMUX_0_9/cmd-swap-window.c75
-rw-r--r--tags/TMUX_0_9/cmd-switch-client.c161
-rw-r--r--tags/TMUX_0_9/cmd-unbind-key.c120
-rw-r--r--tags/TMUX_0_9/cmd-unlink-window.c74
-rw-r--r--tags/TMUX_0_9/cmd-up-pane.c61
-rw-r--r--tags/TMUX_0_9/cmd.c395
-rw-r--r--tags/TMUX_0_9/colour.c123
-rw-r--r--tags/TMUX_0_9/compat.h228
-rw-r--r--tags/TMUX_0_9/compat/asprintf.c89
-rw-r--r--tags/TMUX_0_9/compat/bitstring.h129
-rw-r--r--tags/TMUX_0_9/compat/bsd-poll.c124
-rw-r--r--tags/TMUX_0_9/compat/bsd-poll.h59
-rw-r--r--tags/TMUX_0_9/compat/daemon.c69
-rw-r--r--tags/TMUX_0_9/compat/fgetln.c88
-rw-r--r--tags/TMUX_0_9/compat/forkpty-aix.c94
-rw-r--r--tags/TMUX_0_9/compat/forkpty-sunos.c86
-rw-r--r--tags/TMUX_0_9/compat/getopt.c117
-rw-r--r--tags/TMUX_0_9/compat/queue.h528
-rw-r--r--tags/TMUX_0_9/compat/strcasestr.c61
-rw-r--r--tags/TMUX_0_9/compat/strlcat.c58
-rw-r--r--tags/TMUX_0_9/compat/strlcpy.c54
-rw-r--r--tags/TMUX_0_9/compat/strtonum.c68
-rw-r--r--tags/TMUX_0_9/compat/tree.h739
-rw-r--r--tags/TMUX_0_9/compat/vis.c220
-rw-r--r--tags/TMUX_0_9/compat/vis.h83
-rwxr-xr-xtags/TMUX_0_9/configure216
-rw-r--r--tags/TMUX_0_9/examples/n-marriott.conf85
-rw-r--r--tags/TMUX_0_9/examples/n-marriott.sh11
-rw-r--r--tags/TMUX_0_9/examples/screen-keys.conf187
-rw-r--r--tags/TMUX_0_9/examples/tmux.vim82
-rw-r--r--tags/TMUX_0_9/grid-view.c225
-rw-r--r--tags/TMUX_0_9/grid.c519
-rw-r--r--tags/TMUX_0_9/input-keys.c227
-rw-r--r--tags/TMUX_0_9/input.c1401
-rw-r--r--tags/TMUX_0_9/key-bindings.c237
-rw-r--r--tags/TMUX_0_9/key-string.c198
-rw-r--r--tags/TMUX_0_9/layout-manual.c183
-rw-r--r--tags/TMUX_0_9/layout.c373
-rw-r--r--tags/TMUX_0_9/log.c226
-rw-r--r--tags/TMUX_0_9/mode-key.c210
-rw-r--r--tags/TMUX_0_9/names.c120
-rw-r--r--tags/TMUX_0_9/options-cmd.c182
-rw-r--r--tags/TMUX_0_9/options.c160
-rw-r--r--tags/TMUX_0_9/osdep-darwin.c47
-rw-r--r--tags/TMUX_0_9/osdep-freebsd.c123
-rw-r--r--tags/TMUX_0_9/osdep-linux.c59
-rw-r--r--tags/TMUX_0_9/osdep-netbsd.c52
-rw-r--r--tags/TMUX_0_9/osdep-openbsd.c132
-rw-r--r--tags/TMUX_0_9/osdep-unknown.c27
-rw-r--r--tags/TMUX_0_9/paste.c134
-rw-r--r--tags/TMUX_0_9/resize.c138
-rw-r--r--tags/TMUX_0_9/screen-redraw.c169
-rw-r--r--tags/TMUX_0_9/screen-write.c825
-rw-r--r--tags/TMUX_0_9/screen.c289
-rw-r--r--tags/TMUX_0_9/server-fn.c227
-rw-r--r--tags/TMUX_0_9/server-msg.c306
-rw-r--r--tags/TMUX_0_9/server.c1128
-rw-r--r--tags/TMUX_0_9/session.c378
-rw-r--r--tags/TMUX_0_9/status.c971
-rw-r--r--tags/TMUX_0_9/tmux.11498
-rw-r--r--tags/TMUX_0_9/tmux.c490
-rw-r--r--tags/TMUX_0_9/tmux.h1561
-rw-r--r--tags/TMUX_0_9/tools/256colors.pl63
-rw-r--r--tags/TMUX_0_9/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_0_9/tools/ansicode.txt779
-rw-r--r--tags/TMUX_0_9/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_0_9/tools/dist.mk33
-rw-r--r--tags/TMUX_0_9/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_0_9/tty-keys.c412
-rw-r--r--tags/TMUX_0_9/tty-term.c392
-rw-r--r--tags/TMUX_0_9/tty-write.c65
-rw-r--r--tags/TMUX_0_9/tty.c1115
-rw-r--r--tags/TMUX_0_9/utf8.c294
-rw-r--r--tags/TMUX_0_9/window-choose.c362
-rw-r--r--tags/TMUX_0_9/window-clock.c124
-rw-r--r--tags/TMUX_0_9/window-copy.c968
-rw-r--r--tags/TMUX_0_9/window-more.c244
-rw-r--r--tags/TMUX_0_9/window-scroll.c296
-rw-r--r--tags/TMUX_0_9/window.c627
-rw-r--r--tags/TMUX_0_9/www/images/tmux1.pngbin0 -> 3813 bytes
-rw-r--r--tags/TMUX_0_9/www/images/tmux2.pngbin0 -> 19080 bytes
-rw-r--r--tags/TMUX_0_9/www/images/tmux3.pngbin0 -> 18603 bytes
-rw-r--r--tags/TMUX_0_9/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_0_9/www/images/tmux5.pngbin0 -> 30468 bytes
-rw-r--r--tags/TMUX_0_9/www/images/tmux6.pngbin0 -> 32868 bytes
-rw-r--r--tags/TMUX_0_9/www/index.html.in24
-rw-r--r--tags/TMUX_0_9/xmalloc.c144
-rw-r--r--tags/TMUX_1_0/CHANGES1366
-rw-r--r--tags/TMUX_1_0/FAQ204
-rw-r--r--tags/TMUX_1_0/GNUmakefile65
-rw-r--r--tags/TMUX_1_0/Makefile68
-rw-r--r--tags/TMUX_1_0/NOTES86
-rw-r--r--tags/TMUX_1_0/TODO106
-rw-r--r--tags/TMUX_1_0/array.h119
-rw-r--r--tags/TMUX_1_0/attributes.c93
-rw-r--r--tags/TMUX_1_0/buffer-poll.c54
-rw-r--r--tags/TMUX_1_0/buffer.c139
-rw-r--r--tags/TMUX_1_0/cfg.c127
-rw-r--r--tags/TMUX_1_0/client-fn.c90
-rw-r--r--tags/TMUX_1_0/client.c330
-rw-r--r--tags/TMUX_1_0/clock.c159
-rw-r--r--tags/TMUX_1_0/cmd-attach-session.c106
-rw-r--r--tags/TMUX_1_0/cmd-bind-key.c201
-rw-r--r--tags/TMUX_1_0/cmd-break-pane.c83
-rw-r--r--tags/TMUX_1_0/cmd-choose-client.c152
-rw-r--r--tags/TMUX_1_0/cmd-choose-session.c152
-rw-r--r--tags/TMUX_1_0/cmd-choose-window.c179
-rw-r--r--tags/TMUX_1_0/cmd-clear-history.c55
-rw-r--r--tags/TMUX_1_0/cmd-clock-mode.c52
-rw-r--r--tags/TMUX_1_0/cmd-command-prompt.c266
-rw-r--r--tags/TMUX_1_0/cmd-confirm-before.c147
-rw-r--r--tags/TMUX_1_0/cmd-copy-buffer.c204
-rw-r--r--tags/TMUX_1_0/cmd-copy-mode.c54
-rw-r--r--tags/TMUX_1_0/cmd-delete-buffer.c59
-rw-r--r--tags/TMUX_1_0/cmd-detach-client.c52
-rw-r--r--tags/TMUX_1_0/cmd-display-message.c63
-rw-r--r--tags/TMUX_1_0/cmd-display-panes.c52
-rw-r--r--tags/TMUX_1_0/cmd-down-pane.c59
-rw-r--r--tags/TMUX_1_0/cmd-find-window.c162
-rw-r--r--tags/TMUX_1_0/cmd-generic.c418
-rw-r--r--tags/TMUX_1_0/cmd-has-session.c49
-rw-r--r--tags/TMUX_1_0/cmd-if-shell.c151
-rw-r--r--tags/TMUX_1_0/cmd-kill-pane.c62
-rw-r--r--tags/TMUX_1_0/cmd-kill-server.c49
-rw-r--r--tags/TMUX_1_0/cmd-kill-session.c66
-rw-r--r--tags/TMUX_1_0/cmd-kill-window.c52
-rw-r--r--tags/TMUX_1_0/cmd-last-window.c58
-rw-r--r--tags/TMUX_1_0/cmd-link-window.c98
-rw-r--r--tags/TMUX_1_0/cmd-list-buffers.c78
-rw-r--r--tags/TMUX_1_0/cmd-list-clients.c65
-rw-r--r--tags/TMUX_1_0/cmd-list-commands.c49
-rw-r--r--tags/TMUX_1_0/cmd-list-keys.c125
-rw-r--r--tags/TMUX_1_0/cmd-list-sessions.c65
-rw-r--r--tags/TMUX_1_0/cmd-list-windows.c87
-rw-r--r--tags/TMUX_1_0/cmd-list.c119
-rw-r--r--tags/TMUX_1_0/cmd-load-buffer.c100
-rw-r--r--tags/TMUX_1_0/cmd-lock-server.c50
-rw-r--r--tags/TMUX_1_0/cmd-move-window.c112
-rw-r--r--tags/TMUX_1_0/cmd-new-session.c291
-rw-r--r--tags/TMUX_1_0/cmd-new-window.c206
-rw-r--r--tags/TMUX_1_0/cmd-next-layout.c54
-rw-r--r--tags/TMUX_1_0/cmd-next-window.c76
-rw-r--r--tags/TMUX_1_0/cmd-paste-buffer.c100
-rw-r--r--tags/TMUX_1_0/cmd-previous-layout.c54
-rw-r--r--tags/TMUX_1_0/cmd-previous-window.c76
-rw-r--r--tags/TMUX_1_0/cmd-refresh-client.c52
-rw-r--r--tags/TMUX_1_0/cmd-rename-session.c57
-rw-r--r--tags/TMUX_1_0/cmd-rename-window.c59
-rw-r--r--tags/TMUX_1_0/cmd-resize-pane.c113
-rw-r--r--tags/TMUX_1_0/cmd-respawn-window.c94
-rw-r--r--tags/TMUX_1_0/cmd-rotate-window.c124
-rw-r--r--tags/TMUX_1_0/cmd-save-buffer.c88
-rw-r--r--tags/TMUX_1_0/cmd-scroll-mode.c70
-rw-r--r--tags/TMUX_1_0/cmd-select-layout.c88
-rw-r--r--tags/TMUX_1_0/cmd-select-pane.c58
-rw-r--r--tags/TMUX_1_0/cmd-select-prompt.c91
-rw-r--r--tags/TMUX_1_0/cmd-select-window.c69
-rw-r--r--tags/TMUX_1_0/cmd-send-keys.c156
-rw-r--r--tags/TMUX_1_0/cmd-send-prefix.c55
-rw-r--r--tags/TMUX_1_0/cmd-server-info.c183
-rw-r--r--tags/TMUX_1_0/cmd-set-buffer.c68
-rw-r--r--tags/TMUX_1_0/cmd-set-environment.c88
-rw-r--r--tags/TMUX_1_0/cmd-set-option.c191
-rw-r--r--tags/TMUX_1_0/cmd-set-password.c145
-rw-r--r--tags/TMUX_1_0/cmd-set-window-option.c169
-rw-r--r--tags/TMUX_1_0/cmd-show-buffer.c101
-rw-r--r--tags/TMUX_1_0/cmd-show-environment.c67
-rw-r--r--tags/TMUX_1_0/cmd-show-options.c105
-rw-r--r--tags/TMUX_1_0/cmd-show-window-options.c105
-rw-r--r--tags/TMUX_1_0/cmd-source-file.c124
-rw-r--r--tags/TMUX_1_0/cmd-split-window.c256
-rw-r--r--tags/TMUX_1_0/cmd-start-server.c44
-rw-r--r--tags/TMUX_1_0/cmd-string.c358
-rw-r--r--tags/TMUX_1_0/cmd-suspend-client.c62
-rw-r--r--tags/TMUX_1_0/cmd-swap-pane.c143
-rw-r--r--tags/TMUX_1_0/cmd-swap-window.c73
-rw-r--r--tags/TMUX_1_0/cmd-switch-client.c136
-rw-r--r--tags/TMUX_1_0/cmd-unbind-key.c142
-rw-r--r--tags/TMUX_1_0/cmd-unlink-window.c72
-rw-r--r--tags/TMUX_1_0/cmd-up-pane.c59
-rw-r--r--tags/TMUX_1_0/cmd.c902
-rw-r--r--tags/TMUX_1_0/colour.c162
-rw-r--r--tags/TMUX_1_0/compat.h221
-rw-r--r--tags/TMUX_1_0/compat/asprintf.c89
-rw-r--r--tags/TMUX_1_0/compat/bitstring.h129
-rw-r--r--tags/TMUX_1_0/compat/bsd-poll.c124
-rw-r--r--tags/TMUX_1_0/compat/bsd-poll.h59
-rw-r--r--tags/TMUX_1_0/compat/daemon.c69
-rw-r--r--tags/TMUX_1_0/compat/fgetln.c88
-rw-r--r--tags/TMUX_1_0/compat/forkpty-aix.c95
-rw-r--r--tags/TMUX_1_0/compat/forkpty-sunos.c87
-rw-r--r--tags/TMUX_1_0/compat/getopt.c117
-rw-r--r--tags/TMUX_1_0/compat/imsg-buffer.c303
-rw-r--r--tags/TMUX_1_0/compat/imsg.c271
-rw-r--r--tags/TMUX_1_0/compat/imsg.h110
-rw-r--r--tags/TMUX_1_0/compat/queue.h528
-rw-r--r--tags/TMUX_1_0/compat/strcasestr.c61
-rw-r--r--tags/TMUX_1_0/compat/strlcat.c58
-rw-r--r--tags/TMUX_1_0/compat/strlcpy.c54
-rw-r--r--tags/TMUX_1_0/compat/strsep.c72
-rw-r--r--tags/TMUX_1_0/compat/strtonum.c68
-rw-r--r--tags/TMUX_1_0/compat/tree.h739
-rw-r--r--tags/TMUX_1_0/compat/unvis.c281
-rw-r--r--tags/TMUX_1_0/compat/vis.c220
-rw-r--r--tags/TMUX_1_0/compat/vis.h83
-rwxr-xr-xtags/TMUX_1_0/configure267
-rw-r--r--tags/TMUX_1_0/environ.c145
-rw-r--r--tags/TMUX_1_0/examples/h-boetes.conf38
-rw-r--r--tags/TMUX_1_0/examples/n-marriott.conf85
-rw-r--r--tags/TMUX_1_0/examples/n-marriott.sh11
-rw-r--r--tags/TMUX_1_0/examples/screen-keys.conf102
-rw-r--r--tags/TMUX_1_0/examples/tmux.vim92
-rw-r--r--tags/TMUX_1_0/grid-view.c229
-rw-r--r--tags/TMUX_1_0/grid.c540
-rw-r--r--tags/TMUX_1_0/input-keys.c230
-rw-r--r--tags/TMUX_1_0/input.c1491
-rw-r--r--tags/TMUX_1_0/key-bindings.c268
-rw-r--r--tags/TMUX_1_0/key-string.c202
-rw-r--r--tags/TMUX_1_0/layout-set.c445
-rw-r--r--tags/TMUX_1_0/layout.c649
-rw-r--r--tags/TMUX_1_0/log.c213
-rw-r--r--tags/TMUX_1_0/mode-key.c396
-rw-r--r--tags/TMUX_1_0/names.c121
-rw-r--r--tags/TMUX_1_0/options-cmd.c193
-rw-r--r--tags/TMUX_1_0/options.c159
-rw-r--r--tags/TMUX_1_0/osdep-darwin.c47
-rw-r--r--tags/TMUX_1_0/osdep-freebsd.c129
-rw-r--r--tags/TMUX_1_0/osdep-linux.c59
-rw-r--r--tags/TMUX_1_0/osdep-netbsd.c122
-rw-r--r--tags/TMUX_1_0/osdep-openbsd.c140
-rw-r--r--tags/TMUX_1_0/osdep-unknown.c27
-rw-r--r--tags/TMUX_1_0/paste.c140
-rw-r--r--tags/TMUX_1_0/resize.c153
-rw-r--r--tags/TMUX_1_0/screen-redraw.c285
-rw-r--r--tags/TMUX_1_0/screen-write.c1103
-rw-r--r--tags/TMUX_1_0/screen.c274
-rw-r--r--tags/TMUX_1_0/server-fn.c340
-rw-r--r--tags/TMUX_1_0/server-msg.c292
-rw-r--r--tags/TMUX_1_0/server.c1307
-rw-r--r--tags/TMUX_1_0/session.c419
-rw-r--r--tags/TMUX_1_0/status.c1079
-rw-r--r--tags/TMUX_1_0/tmux.12082
-rw-r--r--tags/TMUX_1_0/tmux.c651
-rw-r--r--tags/TMUX_1_0/tmux.h1778
-rw-r--r--tags/TMUX_1_0/tools/256colors.pl63
-rw-r--r--tags/TMUX_1_0/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_1_0/tools/ansicode.txt779
-rw-r--r--tags/TMUX_1_0/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_1_0/tools/dist.mk33
-rw-r--r--tags/TMUX_1_0/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_1_0/tty-keys.c419
-rw-r--r--tags/TMUX_1_0/tty-term.c447
-rw-r--r--tags/TMUX_1_0/tty.c1129
-rw-r--r--tags/TMUX_1_0/utf8.c294
-rw-r--r--tags/TMUX_1_0/window-choose.c375
-rw-r--r--tags/TMUX_1_0/window-clock.c124
-rw-r--r--tags/TMUX_1_0/window-copy.c1259
-rw-r--r--tags/TMUX_1_0/window-more.c247
-rw-r--r--tags/TMUX_1_0/window-scroll.c323
-rw-r--r--tags/TMUX_1_0/window.c688
-rw-r--r--tags/TMUX_1_0/www/images/tmux1.pngbin0 -> 3813 bytes
-rw-r--r--tags/TMUX_1_0/www/images/tmux2.pngbin0 -> 19080 bytes
-rw-r--r--tags/TMUX_1_0/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--tags/TMUX_1_0/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_1_0/www/images/tmux5.pngbin0 -> 31798 bytes
-rw-r--r--tags/TMUX_1_0/www/images/tmux6.pngbin0 -> 32868 bytes
-rw-r--r--tags/TMUX_1_0/www/index.html.in24
-rw-r--r--tags/TMUX_1_0/xmalloc.c144
-rw-r--r--tags/TMUX_1_1/CHANGES1418
-rw-r--r--tags/TMUX_1_1/FAQ204
-rw-r--r--tags/TMUX_1_1/GNUmakefile86
-rw-r--r--tags/TMUX_1_1/Makefile83
-rw-r--r--tags/TMUX_1_1/NOTES91
-rw-r--r--tags/TMUX_1_1/TODO97
-rw-r--r--tags/TMUX_1_1/array.h119
-rw-r--r--tags/TMUX_1_1/attributes.c93
-rw-r--r--tags/TMUX_1_1/buffer-poll.c55
-rw-r--r--tags/TMUX_1_1/buffer.c139
-rw-r--r--tags/TMUX_1_1/cfg.c127
-rw-r--r--tags/TMUX_1_1/client.c325
-rw-r--r--tags/TMUX_1_1/clock.c159
-rw-r--r--tags/TMUX_1_1/cmd-attach-session.c106
-rw-r--r--tags/TMUX_1_1/cmd-bind-key.c201
-rw-r--r--tags/TMUX_1_1/cmd-break-pane.c84
-rw-r--r--tags/TMUX_1_1/cmd-choose-client.c152
-rw-r--r--tags/TMUX_1_1/cmd-choose-session.c162
-rw-r--r--tags/TMUX_1_1/cmd-choose-window.c179
-rw-r--r--tags/TMUX_1_1/cmd-clear-history.c55
-rw-r--r--tags/TMUX_1_1/cmd-clock-mode.c52
-rw-r--r--tags/TMUX_1_1/cmd-command-prompt.c266
-rw-r--r--tags/TMUX_1_1/cmd-confirm-before.c147
-rw-r--r--tags/TMUX_1_1/cmd-copy-buffer.c204
-rw-r--r--tags/TMUX_1_1/cmd-copy-mode.c70
-rw-r--r--tags/TMUX_1_1/cmd-delete-buffer.c59
-rw-r--r--tags/TMUX_1_1/cmd-detach-client.c52
-rw-r--r--tags/TMUX_1_1/cmd-display-message.c63
-rw-r--r--tags/TMUX_1_1/cmd-display-panes.c52
-rw-r--r--tags/TMUX_1_1/cmd-down-pane.c59
-rw-r--r--tags/TMUX_1_1/cmd-find-window.c162
-rw-r--r--tags/TMUX_1_1/cmd-generic.c418
-rw-r--r--tags/TMUX_1_1/cmd-has-session.c49
-rw-r--r--tags/TMUX_1_1/cmd-if-shell.c117
-rw-r--r--tags/TMUX_1_1/cmd-kill-pane.c76
-rw-r--r--tags/TMUX_1_1/cmd-kill-server.c49
-rw-r--r--tags/TMUX_1_1/cmd-kill-session.c66
-rw-r--r--tags/TMUX_1_1/cmd-kill-window.c53
-rw-r--r--tags/TMUX_1_1/cmd-last-window.c58
-rw-r--r--tags/TMUX_1_1/cmd-link-window.c66
-rw-r--r--tags/TMUX_1_1/cmd-list-buffers.c78
-rw-r--r--tags/TMUX_1_1/cmd-list-clients.c65
-rw-r--r--tags/TMUX_1_1/cmd-list-commands.c49
-rw-r--r--tags/TMUX_1_1/cmd-list-keys.c125
-rw-r--r--tags/TMUX_1_1/cmd-list-panes.c74
-rw-r--r--tags/TMUX_1_1/cmd-list-sessions.c74
-rw-r--r--tags/TMUX_1_1/cmd-list-windows.c58
-rw-r--r--tags/TMUX_1_1/cmd-list.c119
-rw-r--r--tags/TMUX_1_1/cmd-load-buffer.c101
-rw-r--r--tags/TMUX_1_1/cmd-lock-client.c53
-rw-r--r--tags/TMUX_1_1/cmd-lock-server.c51
-rw-r--r--tags/TMUX_1_1/cmd-lock-session.c53
-rw-r--r--tags/TMUX_1_1/cmd-move-window.c67
-rw-r--r--tags/TMUX_1_1/cmd-new-session.c316
-rw-r--r--tags/TMUX_1_1/cmd-new-window.c206
-rw-r--r--tags/TMUX_1_1/cmd-next-layout.c54
-rw-r--r--tags/TMUX_1_1/cmd-next-window.c76
-rw-r--r--tags/TMUX_1_1/cmd-paste-buffer.c100
-rw-r--r--tags/TMUX_1_1/cmd-pipe-pane.c125
-rw-r--r--tags/TMUX_1_1/cmd-previous-layout.c54
-rw-r--r--tags/TMUX_1_1/cmd-previous-window.c76
-rw-r--r--tags/TMUX_1_1/cmd-refresh-client.c52
-rw-r--r--tags/TMUX_1_1/cmd-rename-session.c57
-rw-r--r--tags/TMUX_1_1/cmd-rename-window.c59
-rw-r--r--tags/TMUX_1_1/cmd-resize-pane.c113
-rw-r--r--tags/TMUX_1_1/cmd-respawn-window.c94
-rw-r--r--tags/TMUX_1_1/cmd-rotate-window.c124
-rw-r--r--tags/TMUX_1_1/cmd-run-shell.c137
-rw-r--r--tags/TMUX_1_1/cmd-save-buffer.c88
-rw-r--r--tags/TMUX_1_1/cmd-select-layout.c88
-rw-r--r--tags/TMUX_1_1/cmd-select-pane.c58
-rw-r--r--tags/TMUX_1_1/cmd-select-prompt.c91
-rw-r--r--tags/TMUX_1_1/cmd-select-window.c69
-rw-r--r--tags/TMUX_1_1/cmd-send-keys.c152
-rw-r--r--tags/TMUX_1_1/cmd-send-prefix.c55
-rw-r--r--tags/TMUX_1_1/cmd-server-info.c189
-rw-r--r--tags/TMUX_1_1/cmd-set-buffer.c68
-rw-r--r--tags/TMUX_1_1/cmd-set-environment.c88
-rw-r--r--tags/TMUX_1_1/cmd-set-option.c223
-rw-r--r--tags/TMUX_1_1/cmd-set-window-option.c170
-rw-r--r--tags/TMUX_1_1/cmd-show-buffer.c101
-rw-r--r--tags/TMUX_1_1/cmd-show-environment.c67
-rw-r--r--tags/TMUX_1_1/cmd-show-options.c69
-rw-r--r--tags/TMUX_1_1/cmd-show-window-options.c69
-rw-r--r--tags/TMUX_1_1/cmd-source-file.c124
-rw-r--r--tags/TMUX_1_1/cmd-split-window.c256
-rw-r--r--tags/TMUX_1_1/cmd-start-server.c44
-rw-r--r--tags/TMUX_1_1/cmd-string.c358
-rw-r--r--tags/TMUX_1_1/cmd-suspend-client.c62
-rw-r--r--tags/TMUX_1_1/cmd-swap-pane.c143
-rw-r--r--tags/TMUX_1_1/cmd-swap-window.c85
-rw-r--r--tags/TMUX_1_1/cmd-switch-client.c136
-rw-r--r--tags/TMUX_1_1/cmd-unbind-key.c142
-rw-r--r--tags/TMUX_1_1/cmd-unlink-window.c71
-rw-r--r--tags/TMUX_1_1/cmd-up-pane.c59
-rw-r--r--tags/TMUX_1_1/cmd.c972
-rw-r--r--tags/TMUX_1_1/colour.c162
-rw-r--r--tags/TMUX_1_1/compat.h209
-rw-r--r--tags/TMUX_1_1/compat/asprintf.c89
-rw-r--r--tags/TMUX_1_1/compat/bitstring.h129
-rw-r--r--tags/TMUX_1_1/compat/bsd-poll.c124
-rw-r--r--tags/TMUX_1_1/compat/bsd-poll.h59
-rw-r--r--tags/TMUX_1_1/compat/daemon.c69
-rw-r--r--tags/TMUX_1_1/compat/fgetln.c88
-rw-r--r--tags/TMUX_1_1/compat/forkpty-aix.c95
-rw-r--r--tags/TMUX_1_1/compat/forkpty-sunos.c89
-rw-r--r--tags/TMUX_1_1/compat/getopt.c117
-rw-r--r--tags/TMUX_1_1/compat/imsg-buffer.c303
-rw-r--r--tags/TMUX_1_1/compat/imsg.c271
-rw-r--r--tags/TMUX_1_1/compat/imsg.h110
-rw-r--r--tags/TMUX_1_1/compat/queue.h528
-rw-r--r--tags/TMUX_1_1/compat/strcasestr.c61
-rw-r--r--tags/TMUX_1_1/compat/strlcat.c58
-rw-r--r--tags/TMUX_1_1/compat/strlcpy.c54
-rw-r--r--tags/TMUX_1_1/compat/strsep.c72
-rw-r--r--tags/TMUX_1_1/compat/strtonum.c68
-rw-r--r--tags/TMUX_1_1/compat/tree.h739
-rw-r--r--tags/TMUX_1_1/compat/unvis.c281
-rw-r--r--tags/TMUX_1_1/compat/vis.c220
-rw-r--r--tags/TMUX_1_1/compat/vis.h83
-rwxr-xr-xtags/TMUX_1_1/configure271
-rw-r--r--tags/TMUX_1_1/environ.c145
-rw-r--r--tags/TMUX_1_1/examples/h-boetes.conf42
-rw-r--r--tags/TMUX_1_1/examples/n-marriott.conf101
-rw-r--r--tags/TMUX_1_1/examples/screen-keys.conf104
-rw-r--r--tags/TMUX_1_1/examples/t-williams.conf104
-rw-r--r--tags/TMUX_1_1/examples/tmux.vim96
-rw-r--r--tags/TMUX_1_1/grid-view.c234
-rw-r--r--tags/TMUX_1_1/grid.c588
-rw-r--r--tags/TMUX_1_1/input-keys.c231
-rw-r--r--tags/TMUX_1_1/input.c1497
-rw-r--r--tags/TMUX_1_1/job.c196
-rw-r--r--tags/TMUX_1_1/key-bindings.c267
-rw-r--r--tags/TMUX_1_1/key-string.c205
-rw-r--r--tags/TMUX_1_1/layout-set.c445
-rw-r--r--tags/TMUX_1_1/layout.c649
-rw-r--r--tags/TMUX_1_1/log.c213
-rw-r--r--tags/TMUX_1_1/mode-key.c416
-rw-r--r--tags/TMUX_1_1/names.c127
-rw-r--r--tags/TMUX_1_1/options-cmd.c263
-rw-r--r--tags/TMUX_1_1/options.c201
-rw-r--r--tags/TMUX_1_1/osdep-darwin.c47
-rw-r--r--tags/TMUX_1_1/osdep-freebsd.c129
-rw-r--r--tags/TMUX_1_1/osdep-linux.c59
-rw-r--r--tags/TMUX_1_1/osdep-netbsd.c122
-rw-r--r--tags/TMUX_1_1/osdep-openbsd.c140
-rw-r--r--tags/TMUX_1_1/osdep-sunos.c65
-rw-r--r--tags/TMUX_1_1/osdep-unknown.c27
-rw-r--r--tags/TMUX_1_1/paste.c136
-rw-r--r--tags/TMUX_1_1/resize.c153
-rw-r--r--tags/TMUX_1_1/screen-redraw.c288
-rw-r--r--tags/TMUX_1_1/screen-write.c1180
-rw-r--r--tags/TMUX_1_1/screen.c274
-rw-r--r--tags/TMUX_1_1/server-client.c768
-rw-r--r--tags/TMUX_1_1/server-fn.c373
-rw-r--r--tags/TMUX_1_1/server-job.c73
-rw-r--r--tags/TMUX_1_1/server-window.c341
-rw-r--r--tags/TMUX_1_1/server.c640
-rw-r--r--tags/TMUX_1_1/session.c594
-rw-r--r--tags/TMUX_1_1/status.c1068
-rw-r--r--tags/TMUX_1_1/tmux.12219
-rw-r--r--tags/TMUX_1_1/tmux.c681
-rw-r--r--tags/TMUX_1_1/tmux.h1961
-rw-r--r--tags/TMUX_1_1/tools/256colors.pl63
-rw-r--r--tags/TMUX_1_1/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_1_1/tools/ansicode.txt779
-rw-r--r--tags/TMUX_1_1/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_1_1/tools/dist.mk33
-rw-r--r--tags/TMUX_1_1/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_1_1/tty-keys.c418
-rw-r--r--tags/TMUX_1_1/tty-term.c501
-rw-r--r--tags/TMUX_1_1/tty.c1359
-rw-r--r--tags/TMUX_1_1/utf8.c340
-rw-r--r--tags/TMUX_1_1/window-choose.c375
-rw-r--r--tags/TMUX_1_1/window-clock.c124
-rw-r--r--tags/TMUX_1_1/window-copy.c1290
-rw-r--r--tags/TMUX_1_1/window-more.c247
-rw-r--r--tags/TMUX_1_1/window.c737
-rw-r--r--tags/TMUX_1_1/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--tags/TMUX_1_1/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_1_1/www/images/tmux5.pngbin0 -> 31798 bytes
-rw-r--r--tags/TMUX_1_1/www/index.html.in74
-rw-r--r--tags/TMUX_1_1/www/main.css50
-rw-r--r--tags/TMUX_1_1/xmalloc.c145
-rw-r--r--tags/TMUX_1_1/xterm-keys.c201
-rw-r--r--tags/TMUX_1_2/CHANGES1475
-rw-r--r--tags/TMUX_1_2/FAQ242
-rw-r--r--tags/TMUX_1_2/GNUmakefile86
-rw-r--r--tags/TMUX_1_2/Makefile83
-rw-r--r--tags/TMUX_1_2/NOTES89
-rw-r--r--tags/TMUX_1_2/TODO135
-rw-r--r--tags/TMUX_1_2/array.h121
-rw-r--r--tags/TMUX_1_2/attributes.c93
-rw-r--r--tags/TMUX_1_2/cfg.c143
-rw-r--r--tags/TMUX_1_2/client.c359
-rw-r--r--tags/TMUX_1_2/clock.c159
-rw-r--r--tags/TMUX_1_2/cmd-attach-session.c110
-rw-r--r--tags/TMUX_1_2/cmd-bind-key.c202
-rw-r--r--tags/TMUX_1_2/cmd-break-pane.c84
-rw-r--r--tags/TMUX_1_2/cmd-capture-pane.c83
-rw-r--r--tags/TMUX_1_2/cmd-choose-client.c152
-rw-r--r--tags/TMUX_1_2/cmd-choose-session.c162
-rw-r--r--tags/TMUX_1_2/cmd-choose-window.c179
-rw-r--r--tags/TMUX_1_2/cmd-clear-history.c55
-rw-r--r--tags/TMUX_1_2/cmd-clock-mode.c52
-rw-r--r--tags/TMUX_1_2/cmd-command-prompt.c266
-rw-r--r--tags/TMUX_1_2/cmd-confirm-before.c147
-rw-r--r--tags/TMUX_1_2/cmd-copy-buffer.c205
-rw-r--r--tags/TMUX_1_2/cmd-copy-mode.c70
-rw-r--r--tags/TMUX_1_2/cmd-delete-buffer.c59
-rw-r--r--tags/TMUX_1_2/cmd-detach-client.c52
-rw-r--r--tags/TMUX_1_2/cmd-display-message.c66
-rw-r--r--tags/TMUX_1_2/cmd-display-panes.c52
-rw-r--r--tags/TMUX_1_2/cmd-down-pane.c60
-rw-r--r--tags/TMUX_1_2/cmd-find-window.c162
-rw-r--r--tags/TMUX_1_2/cmd-generic.c423
-rw-r--r--tags/TMUX_1_2/cmd-has-session.c49
-rw-r--r--tags/TMUX_1_2/cmd-if-shell.c117
-rw-r--r--tags/TMUX_1_2/cmd-join-pane.c256
-rw-r--r--tags/TMUX_1_2/cmd-kill-pane.c76
-rw-r--r--tags/TMUX_1_2/cmd-kill-server.c50
-rw-r--r--tags/TMUX_1_2/cmd-kill-session.c66
-rw-r--r--tags/TMUX_1_2/cmd-kill-window.c53
-rw-r--r--tags/TMUX_1_2/cmd-last-window.c58
-rw-r--r--tags/TMUX_1_2/cmd-link-window.c66
-rw-r--r--tags/TMUX_1_2/cmd-list-buffers.c78
-rw-r--r--tags/TMUX_1_2/cmd-list-clients.c66
-rw-r--r--tags/TMUX_1_2/cmd-list-commands.c50
-rw-r--r--tags/TMUX_1_2/cmd-list-keys.c129
-rw-r--r--tags/TMUX_1_2/cmd-list-panes.c74
-rw-r--r--tags/TMUX_1_2/cmd-list-sessions.c75
-rw-r--r--tags/TMUX_1_2/cmd-list-windows.c58
-rw-r--r--tags/TMUX_1_2/cmd-list.c138
-rw-r--r--tags/TMUX_1_2/cmd-load-buffer.c99
-rw-r--r--tags/TMUX_1_2/cmd-lock-client.c53
-rw-r--r--tags/TMUX_1_2/cmd-lock-server.c52
-rw-r--r--tags/TMUX_1_2/cmd-lock-session.c53
-rw-r--r--tags/TMUX_1_2/cmd-move-window.c67
-rw-r--r--tags/TMUX_1_2/cmd-new-session.c336
-rw-r--r--tags/TMUX_1_2/cmd-new-window.c205
-rw-r--r--tags/TMUX_1_2/cmd-next-layout.c54
-rw-r--r--tags/TMUX_1_2/cmd-next-window.c76
-rw-r--r--tags/TMUX_1_2/cmd-paste-buffer.c100
-rw-r--r--tags/TMUX_1_2/cmd-pipe-pane.c141
-rw-r--r--tags/TMUX_1_2/cmd-previous-layout.c54
-rw-r--r--tags/TMUX_1_2/cmd-previous-window.c76
-rw-r--r--tags/TMUX_1_2/cmd-refresh-client.c52
-rw-r--r--tags/TMUX_1_2/cmd-rename-session.c57
-rw-r--r--tags/TMUX_1_2/cmd-rename-window.c59
-rw-r--r--tags/TMUX_1_2/cmd-resize-pane.c111
-rw-r--r--tags/TMUX_1_2/cmd-respawn-window.c95
-rw-r--r--tags/TMUX_1_2/cmd-rotate-window.c124
-rw-r--r--tags/TMUX_1_2/cmd-run-shell.c139
-rw-r--r--tags/TMUX_1_2/cmd-save-buffer.c88
-rw-r--r--tags/TMUX_1_2/cmd-select-layout.c88
-rw-r--r--tags/TMUX_1_2/cmd-select-pane.c59
-rw-r--r--tags/TMUX_1_2/cmd-select-prompt.c91
-rw-r--r--tags/TMUX_1_2/cmd-select-window.c69
-rw-r--r--tags/TMUX_1_2/cmd-send-keys.c152
-rw-r--r--tags/TMUX_1_2/cmd-send-prefix.c55
-rw-r--r--tags/TMUX_1_2/cmd-server-info.c190
-rw-r--r--tags/TMUX_1_2/cmd-set-buffer.c68
-rw-r--r--tags/TMUX_1_2/cmd-set-environment.c88
-rw-r--r--tags/TMUX_1_2/cmd-set-option.c558
-rw-r--r--tags/TMUX_1_2/cmd-set-window-option.c47
-rw-r--r--tags/TMUX_1_2/cmd-show-buffer.c101
-rw-r--r--tags/TMUX_1_2/cmd-show-environment.c67
-rw-r--r--tags/TMUX_1_2/cmd-show-messages.c65
-rw-r--r--tags/TMUX_1_2/cmd-show-options.c88
-rw-r--r--tags/TMUX_1_2/cmd-show-window-options.c50
-rw-r--r--tags/TMUX_1_2/cmd-source-file.c131
-rw-r--r--tags/TMUX_1_2/cmd-split-window.c263
-rw-r--r--tags/TMUX_1_2/cmd-start-server.c45
-rw-r--r--tags/TMUX_1_2/cmd-string.c342
-rw-r--r--tags/TMUX_1_2/cmd-suspend-client.c62
-rw-r--r--tags/TMUX_1_2/cmd-swap-pane.c144
-rw-r--r--tags/TMUX_1_2/cmd-swap-window.c85
-rw-r--r--tags/TMUX_1_2/cmd-switch-client.c138
-rw-r--r--tags/TMUX_1_2/cmd-unbind-key.c143
-rw-r--r--tags/TMUX_1_2/cmd-unlink-window.c71
-rw-r--r--tags/TMUX_1_2/cmd-up-pane.c60
-rw-r--r--tags/TMUX_1_2/cmd.c1035
-rw-r--r--tags/TMUX_1_2/colour.c162
-rw-r--r--tags/TMUX_1_2/compat.h201
-rw-r--r--tags/TMUX_1_2/compat/asprintf.c89
-rw-r--r--tags/TMUX_1_2/compat/bitstring.h129
-rw-r--r--tags/TMUX_1_2/compat/daemon.c69
-rw-r--r--tags/TMUX_1_2/compat/fgetln.c88
-rw-r--r--tags/TMUX_1_2/compat/forkpty-aix.c95
-rw-r--r--tags/TMUX_1_2/compat/forkpty-sunos.c89
-rw-r--r--tags/TMUX_1_2/compat/getopt.c117
-rw-r--r--tags/TMUX_1_2/compat/imsg-buffer.c303
-rw-r--r--tags/TMUX_1_2/compat/imsg.c271
-rw-r--r--tags/TMUX_1_2/compat/imsg.h110
-rw-r--r--tags/TMUX_1_2/compat/queue.h528
-rw-r--r--tags/TMUX_1_2/compat/strcasestr.c61
-rw-r--r--tags/TMUX_1_2/compat/strlcat.c58
-rw-r--r--tags/TMUX_1_2/compat/strlcpy.c54
-rw-r--r--tags/TMUX_1_2/compat/strsep.c72
-rw-r--r--tags/TMUX_1_2/compat/strtonum.c68
-rw-r--r--tags/TMUX_1_2/compat/tree.h739
-rw-r--r--tags/TMUX_1_2/compat/unvis.c281
-rw-r--r--tags/TMUX_1_2/compat/vis.c220
-rw-r--r--tags/TMUX_1_2/compat/vis.h83
-rwxr-xr-xtags/TMUX_1_2/configure271
-rw-r--r--tags/TMUX_1_2/environ.c145
-rw-r--r--tags/TMUX_1_2/examples/h-boetes.conf42
-rw-r--r--tags/TMUX_1_2/examples/n-marriott.conf110
-rw-r--r--tags/TMUX_1_2/examples/screen-keys.conf102
-rw-r--r--tags/TMUX_1_2/examples/t-williams.conf104
-rw-r--r--tags/TMUX_1_2/examples/tmux.vim102
-rw-r--r--tags/TMUX_1_2/examples/vim-keys.conf35
-rw-r--r--tags/TMUX_1_2/grid-utf8.c96
-rw-r--r--tags/TMUX_1_2/grid-view.c234
-rw-r--r--tags/TMUX_1_2/grid.c586
-rw-r--r--tags/TMUX_1_2/input-keys.c212
-rw-r--r--tags/TMUX_1_2/input.c1506
-rw-r--r--tags/TMUX_1_2/job.c235
-rw-r--r--tags/TMUX_1_2/key-bindings.c266
-rw-r--r--tags/TMUX_1_2/key-string.c245
-rw-r--r--tags/TMUX_1_2/layout-set.c449
-rw-r--r--tags/TMUX_1_2/layout-string.c169
-rw-r--r--tags/TMUX_1_2/layout.c655
-rw-r--r--tags/TMUX_1_2/log.c213
-rw-r--r--tags/TMUX_1_2/mode-key.c452
-rw-r--r--tags/TMUX_1_2/names.c125
-rw-r--r--tags/TMUX_1_2/options.c201
-rw-r--r--tags/TMUX_1_2/osdep-darwin.c47
-rw-r--r--tags/TMUX_1_2/osdep-freebsd.c129
-rw-r--r--tags/TMUX_1_2/osdep-linux.c59
-rw-r--r--tags/TMUX_1_2/osdep-netbsd.c122
-rw-r--r--tags/TMUX_1_2/osdep-openbsd.c132
-rw-r--r--tags/TMUX_1_2/osdep-sunos.c65
-rw-r--r--tags/TMUX_1_2/osdep-unknown.c27
-rw-r--r--tags/TMUX_1_2/paste.c158
-rw-r--r--tags/TMUX_1_2/resize.c153
-rw-r--r--tags/TMUX_1_2/screen-redraw.c328
-rw-r--r--tags/TMUX_1_2/screen-write.c1176
-rw-r--r--tags/TMUX_1_2/screen.c335
-rw-r--r--tags/TMUX_1_2/server-client.c755
-rw-r--r--tags/TMUX_1_2/server-fn.c434
-rw-r--r--tags/TMUX_1_2/server-window.c229
-rw-r--r--tags/TMUX_1_2/server.c604
-rw-r--r--tags/TMUX_1_2/session.c593
-rw-r--r--tags/TMUX_1_2/status.c1179
-rw-r--r--tags/TMUX_1_2/tmux.12508
-rw-r--r--tags/TMUX_1_2/tmux.c721
-rw-r--r--tags/TMUX_1_2/tmux.h1961
-rw-r--r--tags/TMUX_1_2/tools/256colors.pl63
-rw-r--r--tags/TMUX_1_2/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_1_2/tools/ansicode.txt779
-rw-r--r--tags/TMUX_1_2/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_1_2/tools/dist.mk33
-rw-r--r--tags/TMUX_1_2/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_1_2/tools/putty-utf8.sh1
-rw-r--r--tags/TMUX_1_2/tty-keys.c626
-rw-r--r--tags/TMUX_1_2/tty-term.c490
-rw-r--r--tags/TMUX_1_2/tty.c1446
-rw-r--r--tags/TMUX_1_2/utf8.c340
-rw-r--r--tags/TMUX_1_2/window-choose.c457
-rw-r--r--tags/TMUX_1_2/window-clock.c124
-rw-r--r--tags/TMUX_1_2/window-copy.c1581
-rw-r--r--tags/TMUX_1_2/window-more.c260
-rw-r--r--tags/TMUX_1_2/window.c761
-rw-r--r--tags/TMUX_1_2/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--tags/TMUX_1_2/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_1_2/www/images/tmux5.pngbin0 -> 39923 bytes
-rw-r--r--tags/TMUX_1_2/www/index.html.in75
-rw-r--r--tags/TMUX_1_2/www/main.css50
-rw-r--r--tags/TMUX_1_2/xmalloc.c145
-rw-r--r--tags/TMUX_1_2/xterm-keys.c214
-rw-r--r--tags/TMUX_1_3/CHANGES1521
-rw-r--r--tags/TMUX_1_3/FAQ242
-rw-r--r--tags/TMUX_1_3/GNUmakefile87
-rw-r--r--tags/TMUX_1_3/Makefile84
-rw-r--r--tags/TMUX_1_3/NOTES89
-rw-r--r--tags/TMUX_1_3/TODO152
-rw-r--r--tags/TMUX_1_3/array.h121
-rw-r--r--tags/TMUX_1_3/attributes.c93
-rw-r--r--tags/TMUX_1_3/cfg.c143
-rw-r--r--tags/TMUX_1_3/client.c351
-rw-r--r--tags/TMUX_1_3/clock.c159
-rw-r--r--tags/TMUX_1_3/cmd-attach-session.c110
-rw-r--r--tags/TMUX_1_3/cmd-bind-key.c211
-rw-r--r--tags/TMUX_1_3/cmd-break-pane.c84
-rw-r--r--tags/TMUX_1_3/cmd-capture-pane.c83
-rw-r--r--tags/TMUX_1_3/cmd-choose-buffer.c146
-rw-r--r--tags/TMUX_1_3/cmd-choose-client.c152
-rw-r--r--tags/TMUX_1_3/cmd-choose-session.c162
-rw-r--r--tags/TMUX_1_3/cmd-choose-window.c180
-rw-r--r--tags/TMUX_1_3/cmd-clear-history.c55
-rw-r--r--tags/TMUX_1_3/cmd-clock-mode.c52
-rw-r--r--tags/TMUX_1_3/cmd-command-prompt.c270
-rw-r--r--tags/TMUX_1_3/cmd-confirm-before.c147
-rw-r--r--tags/TMUX_1_3/cmd-copy-buffer.c205
-rw-r--r--tags/TMUX_1_3/cmd-copy-mode.c71
-rw-r--r--tags/TMUX_1_3/cmd-delete-buffer.c59
-rw-r--r--tags/TMUX_1_3/cmd-detach-client.c52
-rw-r--r--tags/TMUX_1_3/cmd-display-message.c66
-rw-r--r--tags/TMUX_1_3/cmd-display-panes.c52
-rw-r--r--tags/TMUX_1_3/cmd-find-window.c162
-rw-r--r--tags/TMUX_1_3/cmd-generic.c423
-rw-r--r--tags/TMUX_1_3/cmd-has-session.c49
-rw-r--r--tags/TMUX_1_3/cmd-if-shell.c120
-rw-r--r--tags/TMUX_1_3/cmd-join-pane.c257
-rw-r--r--tags/TMUX_1_3/cmd-kill-pane.c76
-rw-r--r--tags/TMUX_1_3/cmd-kill-server.c50
-rw-r--r--tags/TMUX_1_3/cmd-kill-session.c56
-rw-r--r--tags/TMUX_1_3/cmd-kill-window.c53
-rw-r--r--tags/TMUX_1_3/cmd-last-window.c58
-rw-r--r--tags/TMUX_1_3/cmd-link-window.c66
-rw-r--r--tags/TMUX_1_3/cmd-list-buffers.c63
-rw-r--r--tags/TMUX_1_3/cmd-list-clients.c66
-rw-r--r--tags/TMUX_1_3/cmd-list-commands.c50
-rw-r--r--tags/TMUX_1_3/cmd-list-keys.c129
-rw-r--r--tags/TMUX_1_3/cmd-list-panes.c74
-rw-r--r--tags/TMUX_1_3/cmd-list-sessions.c75
-rw-r--r--tags/TMUX_1_3/cmd-list-windows.c62
-rw-r--r--tags/TMUX_1_3/cmd-list.c146
-rw-r--r--tags/TMUX_1_3/cmd-load-buffer.c118
-rw-r--r--tags/TMUX_1_3/cmd-lock-client.c53
-rw-r--r--tags/TMUX_1_3/cmd-lock-server.c52
-rw-r--r--tags/TMUX_1_3/cmd-lock-session.c53
-rw-r--r--tags/TMUX_1_3/cmd-move-window.c67
-rw-r--r--tags/TMUX_1_3/cmd-new-session.c345
-rw-r--r--tags/TMUX_1_3/cmd-new-window.c236
-rw-r--r--tags/TMUX_1_3/cmd-next-layout.c54
-rw-r--r--tags/TMUX_1_3/cmd-next-window.c76
-rw-r--r--tags/TMUX_1_3/cmd-paste-buffer.c222
-rw-r--r--tags/TMUX_1_3/cmd-pipe-pane.c148
-rw-r--r--tags/TMUX_1_3/cmd-previous-layout.c54
-rw-r--r--tags/TMUX_1_3/cmd-previous-window.c76
-rw-r--r--tags/TMUX_1_3/cmd-refresh-client.c52
-rw-r--r--tags/TMUX_1_3/cmd-rename-session.c57
-rw-r--r--tags/TMUX_1_3/cmd-rename-window.c59
-rw-r--r--tags/TMUX_1_3/cmd-resize-pane.c111
-rw-r--r--tags/TMUX_1_3/cmd-respawn-window.c95
-rw-r--r--tags/TMUX_1_3/cmd-rotate-window.c124
-rw-r--r--tags/TMUX_1_3/cmd-run-shell.c147
-rw-r--r--tags/TMUX_1_3/cmd-save-buffer.c99
-rw-r--r--tags/TMUX_1_3/cmd-select-layout.c94
-rw-r--r--tags/TMUX_1_3/cmd-select-pane.c94
-rw-r--r--tags/TMUX_1_3/cmd-select-window.c69
-rw-r--r--tags/TMUX_1_3/cmd-send-keys.c153
-rw-r--r--tags/TMUX_1_3/cmd-send-prefix.c55
-rw-r--r--tags/TMUX_1_3/cmd-server-info.c190
-rw-r--r--tags/TMUX_1_3/cmd-set-buffer.c68
-rw-r--r--tags/TMUX_1_3/cmd-set-environment.c88
-rw-r--r--tags/TMUX_1_3/cmd-set-option.c562
-rw-r--r--tags/TMUX_1_3/cmd-set-window-option.c47
-rw-r--r--tags/TMUX_1_3/cmd-show-buffer.c101
-rw-r--r--tags/TMUX_1_3/cmd-show-environment.c67
-rw-r--r--tags/TMUX_1_3/cmd-show-messages.c65
-rw-r--r--tags/TMUX_1_3/cmd-show-options.c88
-rw-r--r--tags/TMUX_1_3/cmd-show-window-options.c50
-rw-r--r--tags/TMUX_1_3/cmd-source-file.c131
-rw-r--r--tags/TMUX_1_3/cmd-split-window.c266
-rw-r--r--tags/TMUX_1_3/cmd-start-server.c45
-rw-r--r--tags/TMUX_1_3/cmd-string.c342
-rw-r--r--tags/TMUX_1_3/cmd-suspend-client.c62
-rw-r--r--tags/TMUX_1_3/cmd-swap-pane.c144
-rw-r--r--tags/TMUX_1_3/cmd-swap-window.c85
-rw-r--r--tags/TMUX_1_3/cmd-switch-client.c138
-rw-r--r--tags/TMUX_1_3/cmd-unbind-key.c143
-rw-r--r--tags/TMUX_1_3/cmd-unlink-window.c71
-rw-r--r--tags/TMUX_1_3/cmd.c1105
-rw-r--r--tags/TMUX_1_3/colour.c162
-rw-r--r--tags/TMUX_1_3/compat.h226
-rw-r--r--tags/TMUX_1_3/compat/asprintf.c89
-rw-r--r--tags/TMUX_1_3/compat/bitstring.h129
-rw-r--r--tags/TMUX_1_3/compat/daemon.c69
-rw-r--r--tags/TMUX_1_3/compat/fgetln.c88
-rw-r--r--tags/TMUX_1_3/compat/forkpty-aix.c95
-rw-r--r--tags/TMUX_1_3/compat/forkpty-sunos.c89
-rw-r--r--tags/TMUX_1_3/compat/getopt.c117
-rw-r--r--tags/TMUX_1_3/compat/imsg-buffer.c303
-rw-r--r--tags/TMUX_1_3/compat/imsg.c271
-rw-r--r--tags/TMUX_1_3/compat/imsg.h110
-rw-r--r--tags/TMUX_1_3/compat/queue.h528
-rw-r--r--tags/TMUX_1_3/compat/setenv.c49
-rw-r--r--tags/TMUX_1_3/compat/strcasestr.c61
-rw-r--r--tags/TMUX_1_3/compat/strlcat.c58
-rw-r--r--tags/TMUX_1_3/compat/strlcpy.c54
-rw-r--r--tags/TMUX_1_3/compat/strsep.c72
-rw-r--r--tags/TMUX_1_3/compat/strtonum.c68
-rw-r--r--tags/TMUX_1_3/compat/tree.h739
-rw-r--r--tags/TMUX_1_3/compat/unvis.c281
-rw-r--r--tags/TMUX_1_3/compat/vis.c220
-rw-r--r--tags/TMUX_1_3/compat/vis.h83
-rwxr-xr-xtags/TMUX_1_3/configure290
-rw-r--r--tags/TMUX_1_3/environ.c181
-rw-r--r--tags/TMUX_1_3/examples/h-boetes.conf42
-rw-r--r--tags/TMUX_1_3/examples/n-marriott.conf110
-rw-r--r--tags/TMUX_1_3/examples/screen-keys.conf102
-rw-r--r--tags/TMUX_1_3/examples/t-williams.conf104
-rw-r--r--tags/TMUX_1_3/examples/tmux.vim103
-rw-r--r--tags/TMUX_1_3/examples/vim-keys.conf35
-rw-r--r--tags/TMUX_1_3/grid-utf8.c96
-rw-r--r--tags/TMUX_1_3/grid-view.c234
-rw-r--r--tags/TMUX_1_3/grid.c545
-rw-r--r--tags/TMUX_1_3/input-keys.c212
-rw-r--r--tags/TMUX_1_3/input.c1497
-rw-r--r--tags/TMUX_1_3/job.c236
-rw-r--r--tags/TMUX_1_3/key-bindings.c273
-rw-r--r--tags/TMUX_1_3/key-string.c231
-rw-r--r--tags/TMUX_1_3/layout-custom.c264
-rw-r--r--tags/TMUX_1_3/layout-set.c550
-rw-r--r--tags/TMUX_1_3/layout-string.c168
-rw-r--r--tags/TMUX_1_3/layout.c683
-rw-r--r--tags/TMUX_1_3/log.c213
-rw-r--r--tags/TMUX_1_3/mode-key.c465
-rw-r--r--tags/TMUX_1_3/names.c125
-rw-r--r--tags/TMUX_1_3/options.c201
-rw-r--r--tags/TMUX_1_3/osdep-darwin.c47
-rw-r--r--tags/TMUX_1_3/osdep-freebsd.c129
-rw-r--r--tags/TMUX_1_3/osdep-linux.c59
-rw-r--r--tags/TMUX_1_3/osdep-netbsd.c122
-rw-r--r--tags/TMUX_1_3/osdep-openbsd.c132
-rw-r--r--tags/TMUX_1_3/osdep-sunos.c65
-rw-r--r--tags/TMUX_1_3/osdep-unknown.c27
-rw-r--r--tags/TMUX_1_3/paste.c182
-rw-r--r--tags/TMUX_1_3/resize.c153
-rw-r--r--tags/TMUX_1_3/screen-redraw.c328
-rw-r--r--tags/TMUX_1_3/screen-write.c1163
-rw-r--r--tags/TMUX_1_3/screen.c341
-rw-r--r--tags/TMUX_1_3/server-client.c802
-rw-r--r--tags/TMUX_1_3/server-fn.c458
-rw-r--r--tags/TMUX_1_3/server-window.c228
-rw-r--r--tags/TMUX_1_3/server.c535
-rw-r--r--tags/TMUX_1_3/session.c515
-rw-r--r--tags/TMUX_1_3/signal.c88
-rw-r--r--tags/TMUX_1_3/status.c1151
-rw-r--r--tags/TMUX_1_3/tmux.12701
-rw-r--r--tags/TMUX_1_3/tmux.c665
-rw-r--r--tags/TMUX_1_3/tmux.h2005
-rw-r--r--tags/TMUX_1_3/tools/256colors.pl63
-rw-r--r--tags/TMUX_1_3/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_1_3/tools/ansicode.txt779
-rw-r--r--tags/TMUX_1_3/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_1_3/tools/dist.mk33
-rw-r--r--tags/TMUX_1_3/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_1_3/tools/putty-utf8.sh1
-rw-r--r--tags/TMUX_1_3/tty-keys.c627
-rw-r--r--tags/TMUX_1_3/tty-term.c490
-rw-r--r--tags/TMUX_1_3/tty.c1474
-rw-r--r--tags/TMUX_1_3/utf8.c340
-rw-r--r--tags/TMUX_1_3/window-choose.c457
-rw-r--r--tags/TMUX_1_3/window-clock.c124
-rw-r--r--tags/TMUX_1_3/window-copy.c1860
-rw-r--r--tags/TMUX_1_3/window.c968
-rw-r--r--tags/TMUX_1_3/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--tags/TMUX_1_3/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_1_3/www/images/tmux5.pngbin0 -> 39923 bytes
-rw-r--r--tags/TMUX_1_3/www/index.html.in78
-rw-r--r--tags/TMUX_1_3/www/main.css50
-rw-r--r--tags/TMUX_1_3/xmalloc.c145
-rw-r--r--tags/TMUX_1_3/xterm-keys.c214
-rw-r--r--tags/TMUX_1_4/CHANGES1562
-rw-r--r--tags/TMUX_1_4/FAQ375
-rw-r--r--tags/TMUX_1_4/GNUmakefile87
-rw-r--r--tags/TMUX_1_4/Makefile84
-rw-r--r--tags/TMUX_1_4/NOTES66
-rw-r--r--tags/TMUX_1_4/TODO130
-rw-r--r--tags/TMUX_1_4/array.h121
-rw-r--r--tags/TMUX_1_4/attributes.c93
-rw-r--r--tags/TMUX_1_4/cfg.c143
-rw-r--r--tags/TMUX_1_4/client.c498
-rw-r--r--tags/TMUX_1_4/clock.c159
-rw-r--r--tags/TMUX_1_4/cmd-attach-session.c110
-rw-r--r--tags/TMUX_1_4/cmd-bind-key.c211
-rw-r--r--tags/TMUX_1_4/cmd-break-pane.c84
-rw-r--r--tags/TMUX_1_4/cmd-capture-pane.c83
-rw-r--r--tags/TMUX_1_4/cmd-choose-buffer.c146
-rw-r--r--tags/TMUX_1_4/cmd-choose-client.c152
-rw-r--r--tags/TMUX_1_4/cmd-choose-session.c157
-rw-r--r--tags/TMUX_1_4/cmd-choose-window.c181
-rw-r--r--tags/TMUX_1_4/cmd-clear-history.c55
-rw-r--r--tags/TMUX_1_4/cmd-clock-mode.c52
-rw-r--r--tags/TMUX_1_4/cmd-command-prompt.c270
-rw-r--r--tags/TMUX_1_4/cmd-confirm-before.c147
-rw-r--r--tags/TMUX_1_4/cmd-copy-buffer.c205
-rw-r--r--tags/TMUX_1_4/cmd-copy-mode.c72
-rw-r--r--tags/TMUX_1_4/cmd-delete-buffer.c59
-rw-r--r--tags/TMUX_1_4/cmd-detach-client.c52
-rw-r--r--tags/TMUX_1_4/cmd-display-message.c66
-rw-r--r--tags/TMUX_1_4/cmd-display-panes.c52
-rw-r--r--tags/TMUX_1_4/cmd-find-window.c175
-rw-r--r--tags/TMUX_1_4/cmd-generic.c423
-rw-r--r--tags/TMUX_1_4/cmd-has-session.c49
-rw-r--r--tags/TMUX_1_4/cmd-if-shell.c119
-rw-r--r--tags/TMUX_1_4/cmd-join-pane.c257
-rw-r--r--tags/TMUX_1_4/cmd-kill-pane.c76
-rw-r--r--tags/TMUX_1_4/cmd-kill-server.c50
-rw-r--r--tags/TMUX_1_4/cmd-kill-session.c56
-rw-r--r--tags/TMUX_1_4/cmd-kill-window.c53
-rw-r--r--tags/TMUX_1_4/cmd-last-pane.c58
-rw-r--r--tags/TMUX_1_4/cmd-last-window.c58
-rw-r--r--tags/TMUX_1_4/cmd-link-window.c66
-rw-r--r--tags/TMUX_1_4/cmd-list-buffers.c63
-rw-r--r--tags/TMUX_1_4/cmd-list-clients.c66
-rw-r--r--tags/TMUX_1_4/cmd-list-commands.c50
-rw-r--r--tags/TMUX_1_4/cmd-list-keys.c134
-rw-r--r--tags/TMUX_1_4/cmd-list-panes.c76
-rw-r--r--tags/TMUX_1_4/cmd-list-sessions.c71
-rw-r--r--tags/TMUX_1_4/cmd-list-windows.c62
-rw-r--r--tags/TMUX_1_4/cmd-list.c150
-rw-r--r--tags/TMUX_1_4/cmd-load-buffer.c185
-rw-r--r--tags/TMUX_1_4/cmd-lock-client.c53
-rw-r--r--tags/TMUX_1_4/cmd-lock-server.c52
-rw-r--r--tags/TMUX_1_4/cmd-lock-session.c53
-rw-r--r--tags/TMUX_1_4/cmd-move-window.c67
-rw-r--r--tags/TMUX_1_4/cmd-new-session.c352
-rw-r--r--tags/TMUX_1_4/cmd-new-window.c236
-rw-r--r--tags/TMUX_1_4/cmd-next-layout.c54
-rw-r--r--tags/TMUX_1_4/cmd-next-window.c76
-rw-r--r--tags/TMUX_1_4/cmd-paste-buffer.c222
-rw-r--r--tags/TMUX_1_4/cmd-pipe-pane.c148
-rw-r--r--tags/TMUX_1_4/cmd-previous-layout.c54
-rw-r--r--tags/TMUX_1_4/cmd-previous-window.c76
-rw-r--r--tags/TMUX_1_4/cmd-refresh-client.c52
-rw-r--r--tags/TMUX_1_4/cmd-rename-session.c64
-rw-r--r--tags/TMUX_1_4/cmd-rename-window.c59
-rw-r--r--tags/TMUX_1_4/cmd-resize-pane.c111
-rw-r--r--tags/TMUX_1_4/cmd-respawn-window.c95
-rw-r--r--tags/TMUX_1_4/cmd-rotate-window.c124
-rw-r--r--tags/TMUX_1_4/cmd-run-shell.c144
-rw-r--r--tags/TMUX_1_4/cmd-save-buffer.c95
-rw-r--r--tags/TMUX_1_4/cmd-select-layout.c94
-rw-r--r--tags/TMUX_1_4/cmd-select-pane.c94
-rw-r--r--tags/TMUX_1_4/cmd-select-window.c69
-rw-r--r--tags/TMUX_1_4/cmd-send-keys.c153
-rw-r--r--tags/TMUX_1_4/cmd-send-prefix.c55
-rw-r--r--tags/TMUX_1_4/cmd-server-info.c183
-rw-r--r--tags/TMUX_1_4/cmd-set-buffer.c68
-rw-r--r--tags/TMUX_1_4/cmd-set-environment.c88
-rw-r--r--tags/TMUX_1_4/cmd-set-option.c569
-rw-r--r--tags/TMUX_1_4/cmd-set-window-option.c47
-rw-r--r--tags/TMUX_1_4/cmd-show-buffer.c101
-rw-r--r--tags/TMUX_1_4/cmd-show-environment.c67
-rw-r--r--tags/TMUX_1_4/cmd-show-messages.c65
-rw-r--r--tags/TMUX_1_4/cmd-show-options.c88
-rw-r--r--tags/TMUX_1_4/cmd-show-window-options.c50
-rw-r--r--tags/TMUX_1_4/cmd-source-file.c131
-rw-r--r--tags/TMUX_1_4/cmd-split-window.c266
-rw-r--r--tags/TMUX_1_4/cmd-start-server.c45
-rw-r--r--tags/TMUX_1_4/cmd-string.c344
-rw-r--r--tags/TMUX_1_4/cmd-suspend-client.c62
-rw-r--r--tags/TMUX_1_4/cmd-swap-pane.c144
-rw-r--r--tags/TMUX_1_4/cmd-swap-window.c85
-rw-r--r--tags/TMUX_1_4/cmd-switch-client.c216
-rw-r--r--tags/TMUX_1_4/cmd-unbind-key.c163
-rw-r--r--tags/TMUX_1_4/cmd-unlink-window.c71
-rw-r--r--tags/TMUX_1_4/cmd.c1127
-rw-r--r--tags/TMUX_1_4/colour.c162
-rw-r--r--tags/TMUX_1_4/compat.h245
-rw-r--r--tags/TMUX_1_4/compat/asprintf.c89
-rw-r--r--tags/TMUX_1_4/compat/bitstring.h129
-rw-r--r--tags/TMUX_1_4/compat/closefrom.c111
-rw-r--r--tags/TMUX_1_4/compat/daemon.c65
-rw-r--r--tags/TMUX_1_4/compat/fgetln.c88
-rw-r--r--tags/TMUX_1_4/compat/forkpty-aix.c95
-rw-r--r--tags/TMUX_1_4/compat/forkpty-sunos.c89
-rw-r--r--tags/TMUX_1_4/compat/getopt.c117
-rw-r--r--tags/TMUX_1_4/compat/imsg-buffer.c303
-rw-r--r--tags/TMUX_1_4/compat/imsg.c271
-rw-r--r--tags/TMUX_1_4/compat/imsg.h110
-rw-r--r--tags/TMUX_1_4/compat/queue.h528
-rw-r--r--tags/TMUX_1_4/compat/setenv.c49
-rw-r--r--tags/TMUX_1_4/compat/strcasestr.c61
-rw-r--r--tags/TMUX_1_4/compat/strlcat.c58
-rw-r--r--tags/TMUX_1_4/compat/strlcpy.c54
-rw-r--r--tags/TMUX_1_4/compat/strsep.c72
-rw-r--r--tags/TMUX_1_4/compat/strtonum.c68
-rw-r--r--tags/TMUX_1_4/compat/tree.h739
-rw-r--r--tags/TMUX_1_4/compat/unvis.c281
-rw-r--r--tags/TMUX_1_4/compat/vis.c220
-rw-r--r--tags/TMUX_1_4/compat/vis.h83
-rwxr-xr-xtags/TMUX_1_4/configure308
-rw-r--r--tags/TMUX_1_4/environ.c181
-rw-r--r--tags/TMUX_1_4/examples/bash_completion_tmux.sh105
-rw-r--r--tags/TMUX_1_4/examples/h-boetes.conf42
-rw-r--r--tags/TMUX_1_4/examples/n-marriott.conf110
-rw-r--r--tags/TMUX_1_4/examples/screen-keys.conf102
-rw-r--r--tags/TMUX_1_4/examples/t-williams.conf104
-rw-r--r--tags/TMUX_1_4/examples/tmux.vim104
-rw-r--r--tags/TMUX_1_4/examples/vim-keys.conf36
-rw-r--r--tags/TMUX_1_4/grid-utf8.c96
-rw-r--r--tags/TMUX_1_4/grid-view.c234
-rw-r--r--tags/TMUX_1_4/grid.c545
-rw-r--r--tags/TMUX_1_4/input-keys.c211
-rw-r--r--tags/TMUX_1_4/input.c1499
-rw-r--r--tags/TMUX_1_4/job.c236
-rw-r--r--tags/TMUX_1_4/key-bindings.c277
-rw-r--r--tags/TMUX_1_4/key-string.c231
-rw-r--r--tags/TMUX_1_4/layout-custom.c264
-rw-r--r--tags/TMUX_1_4/layout-set.c569
-rw-r--r--tags/TMUX_1_4/layout-string.c168
-rw-r--r--tags/TMUX_1_4/layout.c683
-rw-r--r--tags/TMUX_1_4/log.c213
-rw-r--r--tags/TMUX_1_4/mode-key.c465
-rw-r--r--tags/TMUX_1_4/names.c125
-rw-r--r--tags/TMUX_1_4/options.c201
-rw-r--r--tags/TMUX_1_4/osdep-darwin.c47
-rw-r--r--tags/TMUX_1_4/osdep-freebsd.c129
-rw-r--r--tags/TMUX_1_4/osdep-linux.c59
-rw-r--r--tags/TMUX_1_4/osdep-netbsd.c122
-rw-r--r--tags/TMUX_1_4/osdep-openbsd.c132
-rw-r--r--tags/TMUX_1_4/osdep-sunos.c65
-rw-r--r--tags/TMUX_1_4/osdep-unknown.c27
-rw-r--r--tags/TMUX_1_4/paste.c182
-rw-r--r--tags/TMUX_1_4/resize.c145
-rw-r--r--tags/TMUX_1_4/screen-redraw.c319
-rw-r--r--tags/TMUX_1_4/screen-write.c1163
-rw-r--r--tags/TMUX_1_4/screen.c342
-rw-r--r--tags/TMUX_1_4/server-client.c936
-rw-r--r--tags/TMUX_1_4/server-fn.c473
-rw-r--r--tags/TMUX_1_4/server-window.c238
-rw-r--r--tags/TMUX_1_4/server.c532
-rw-r--r--tags/TMUX_1_4/session.c553
-rw-r--r--tags/TMUX_1_4/signal.c103
-rw-r--r--tags/TMUX_1_4/status.c1186
-rw-r--r--tags/TMUX_1_4/tmux.12778
-rw-r--r--tags/TMUX_1_4/tmux.c514
-rw-r--r--tags/TMUX_1_4/tmux.h2032
-rw-r--r--tags/TMUX_1_4/tools/256colors.pl63
-rw-r--r--tags/TMUX_1_4/tools/UTF-8-demo.txt212
-rw-r--r--tags/TMUX_1_4/tools/ansicode.txt779
-rw-r--r--tags/TMUX_1_4/tools/check-compat.sh5
-rw-r--r--tags/TMUX_1_4/tools/cmp-cvs.sh12
-rw-r--r--tags/TMUX_1_4/tools/dist.mk33
-rw-r--r--tags/TMUX_1_4/tools/fix-ids.sh8
-rw-r--r--tags/TMUX_1_4/tools/fuzz.c31
-rw-r--r--tags/TMUX_1_4/tools/putty-utf8.sh1
-rw-r--r--tags/TMUX_1_4/tty-acs.c97
-rw-r--r--tags/TMUX_1_4/tty-keys.c627
-rw-r--r--tags/TMUX_1_4/tty-term.c501
-rw-r--r--tags/TMUX_1_4/tty.c1456
-rw-r--r--tags/TMUX_1_4/utf8.c340
-rw-r--r--tags/TMUX_1_4/window-choose.c457
-rw-r--r--tags/TMUX_1_4/window-clock.c124
-rw-r--r--tags/TMUX_1_4/window-copy.c1866
-rw-r--r--tags/TMUX_1_4/window.c986
-rw-r--r--tags/TMUX_1_4/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--tags/TMUX_1_4/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--tags/TMUX_1_4/www/images/tmux5.pngbin0 -> 39923 bytes
-rw-r--r--tags/TMUX_1_4/www/index.html.in78
-rw-r--r--tags/TMUX_1_4/www/main.css50
-rw-r--r--tags/TMUX_1_4/xmalloc.c144
-rw-r--r--tags/TMUX_1_4/xterm-keys.c201
-rw-r--r--trunk/CHANGES1562
-rw-r--r--trunk/FAQ414
-rw-r--r--trunk/Makefile.am243
-rw-r--r--trunk/NOTES65
-rw-r--r--trunk/TODO149
-rw-r--r--trunk/arguments.c222
-rw-r--r--trunk/array.h121
-rw-r--r--trunk/attributes.c93
-rwxr-xr-xtrunk/autogen.sh16
-rw-r--r--trunk/cfg.c143
-rw-r--r--trunk/client.c508
-rw-r--r--trunk/clock.c159
-rw-r--r--trunk/cmd-attach-session.c112
-rw-r--r--trunk/cmd-bind-key.c120
-rw-r--r--trunk/cmd-break-pane.c89
-rw-r--r--trunk/cmd-capture-pane.c123
-rw-r--r--trunk/cmd-choose-buffer.c143
-rw-r--r--trunk/cmd-choose-client.c151
-rw-r--r--trunk/cmd-choose-session.c156
-rw-r--r--trunk/cmd-choose-window.c169
-rw-r--r--trunk/cmd-clear-history.c54
-rw-r--r--trunk/cmd-clock-mode.c51
-rw-r--r--trunk/cmd-command-prompt.c197
-rw-r--r--trunk/cmd-confirm-before.c144
-rw-r--r--trunk/cmd-copy-mode.c64
-rw-r--r--trunk/cmd-delete-buffer.c66
-rw-r--r--trunk/cmd-detach-client.c72
-rw-r--r--trunk/cmd-display-message.c78
-rw-r--r--trunk/cmd-display-panes.c51
-rw-r--r--trunk/cmd-find-window.c176
-rw-r--r--trunk/cmd-has-session.c48
-rw-r--r--trunk/cmd-if-shell.c112
-rw-r--r--trunk/cmd-join-pane.c145
-rw-r--r--trunk/cmd-kill-pane.c75
-rw-r--r--trunk/cmd-kill-server.c49
-rw-r--r--trunk/cmd-kill-session.c55
-rw-r--r--trunk/cmd-kill-window.c52
-rw-r--r--trunk/cmd-link-window.c65
-rw-r--r--trunk/cmd-list-buffers.c58
-rw-r--r--trunk/cmd-list-clients.c77
-rw-r--r--trunk/cmd-list-commands.c49
-rw-r--r--trunk/cmd-list-keys.c135
-rw-r--r--trunk/cmd-list-panes.c115
-rw-r--r--trunk/cmd-list-sessions.c71
-rw-r--r--trunk/cmd-list-windows.c84
-rw-r--r--trunk/cmd-list.c150
-rw-r--r--trunk/cmd-load-buffer.c174
-rw-r--r--trunk/cmd-lock-server.c85
-rw-r--r--trunk/cmd-move-window.c66
-rw-r--r--trunk/cmd-new-session.c277
-rw-r--r--trunk/cmd-new-window.c126
-rw-r--r--trunk/cmd-paste-buffer.c121
-rw-r--r--trunk/cmd-pipe-pane.c145
-rw-r--r--trunk/cmd-refresh-client.c51
-rw-r--r--trunk/cmd-rename-session.c69
-rw-r--r--trunk/cmd-rename-window.c58
-rw-r--r--trunk/cmd-resize-pane.c117
-rw-r--r--trunk/cmd-respawn-window.c98
-rw-r--r--trunk/cmd-rotate-window.c119
-rw-r--r--trunk/cmd-run-shell.c141
-rw-r--r--trunk/cmd-save-buffer.c102
-rw-r--r--trunk/cmd-select-layout.c133
-rw-r--r--trunk/cmd-select-pane.c116
-rw-r--r--trunk/cmd-select-window.c139
-rw-r--r--trunk/cmd-send-keys.c65
-rw-r--r--trunk/cmd-send-prefix.c54
-rw-r--r--trunk/cmd-server-info.c183
-rw-r--r--trunk/cmd-set-buffer.c75
-rw-r--r--trunk/cmd-set-environment.c94
-rw-r--r--trunk/cmd-set-option.c411
-rw-r--r--trunk/cmd-show-buffer.c109
-rw-r--r--trunk/cmd-show-environment.c66
-rw-r--r--trunk/cmd-show-messages.c64
-rw-r--r--trunk/cmd-show-options.c97
-rw-r--r--trunk/cmd-source-file.c74
-rw-r--r--trunk/cmd-split-window.c152
-rw-r--r--trunk/cmd-start-server.c44
-rw-r--r--trunk/cmd-string.c344
-rw-r--r--trunk/cmd-suspend-client.c56
-rw-r--r--trunk/cmd-swap-pane.c142
-rw-r--r--trunk/cmd-swap-window.c87
-rw-r--r--trunk/cmd-switch-client.c103
-rw-r--r--trunk/cmd-unbind-key.c105
-rw-r--r--trunk/cmd-unlink-window.c70
-rw-r--r--trunk/cmd.c1217
-rw-r--r--trunk/colour.c277
-rw-r--r--trunk/compat.h240
-rw-r--r--trunk/compat/asprintf.c62
-rw-r--r--trunk/compat/bitstring.h129
-rw-r--r--trunk/compat/closefrom.c111
-rw-r--r--trunk/compat/daemon.c65
-rw-r--r--trunk/compat/fgetln.c88
-rw-r--r--trunk/compat/forkpty-aix.c95
-rw-r--r--trunk/compat/forkpty-hpux.c89
-rw-r--r--trunk/compat/forkpty-sunos.c89
-rw-r--r--trunk/compat/getopt.c117
-rw-r--r--trunk/compat/imsg-buffer.c303
-rw-r--r--trunk/compat/imsg.c271
-rw-r--r--trunk/compat/imsg.h110
-rw-r--r--trunk/compat/queue.h528
-rw-r--r--trunk/compat/setenv.c49
-rw-r--r--trunk/compat/strcasestr.c61
-rw-r--r--trunk/compat/strlcat.c58
-rw-r--r--trunk/compat/strlcpy.c54
-rw-r--r--trunk/compat/strsep.c72
-rw-r--r--trunk/compat/strtonum.c68
-rw-r--r--trunk/compat/tree.h739
-rw-r--r--trunk/compat/unvis.c281
-rw-r--r--trunk/compat/vis.c220
-rw-r--r--trunk/compat/vis.h83
-rw-r--r--trunk/configure.ac429
-rw-r--r--trunk/environ.c181
-rw-r--r--trunk/examples/bash_completion_tmux.sh105
-rw-r--r--trunk/examples/h-boetes.conf42
-rw-r--r--trunk/examples/n-marriott.conf110
-rw-r--r--trunk/examples/screen-keys.conf102
-rw-r--r--trunk/examples/t-williams.conf104
-rw-r--r--trunk/examples/tmux.vim104
-rw-r--r--trunk/examples/tmux_backup.sh81
-rw-r--r--trunk/examples/vim-keys.conf36
-rw-r--r--trunk/grid-utf8.c96
-rw-r--r--trunk/grid-view.c258
-rw-r--r--trunk/grid.c545
-rw-r--r--trunk/input-keys.c230
-rw-r--r--trunk/input.c1572
-rw-r--r--trunk/job.c168
-rw-r--r--trunk/key-bindings.c278
-rw-r--r--trunk/key-string.c233
-rw-r--r--trunk/layout-custom.c264
-rw-r--r--trunk/layout-set.c569
-rw-r--r--trunk/layout-string.c168
-rw-r--r--trunk/layout.c730
-rw-r--r--trunk/log.c213
-rw-r--r--trunk/mode-key.c471
-rw-r--r--trunk/names.c125
-rw-r--r--trunk/options-table.c661
-rw-r--r--trunk/options.c201
-rw-r--r--trunk/osdep-aix.c35
-rw-r--r--trunk/osdep-darwin.c61
-rw-r--r--trunk/osdep-freebsd.c142
-rw-r--r--trunk/osdep-hpux.c35
-rw-r--r--trunk/osdep-linux.c76
-rw-r--r--trunk/osdep-netbsd.c130
-rw-r--r--trunk/osdep-openbsd.c140
-rw-r--r--trunk/osdep-sunos.c72
-rw-r--r--trunk/osdep-unknown.c35
-rw-r--r--trunk/paste.c169
-rw-r--r--trunk/resize.c145
-rw-r--r--trunk/screen-redraw.c319
-rw-r--r--trunk/screen-write.c1219
-rw-r--r--trunk/screen.c361
-rw-r--r--trunk/server-client.c1001
-rw-r--r--trunk/server-fn.c480
-rw-r--r--trunk/server-window.c237
-rw-r--r--trunk/server.c524
-rw-r--r--trunk/session.c573
-rw-r--r--trunk/signal.c103
-rw-r--r--trunk/status.c1275
-rw-r--r--trunk/tmux.12971
-rw-r--r--trunk/tmux.c396
-rw-r--r--trunk/tmux.h2071
-rw-r--r--trunk/tools/256colors.pl63
-rw-r--r--trunk/tools/UTF-8-demo.txt212
-rw-r--r--trunk/tools/ansicode.txt779
-rw-r--r--trunk/tools/check-compat.sh5
-rw-r--r--trunk/tools/cmp-cvs.sh12
-rw-r--r--trunk/tools/fix-ids.sh8
-rw-r--r--trunk/tools/fuzz.c31
-rw-r--r--trunk/tools/putty-utf8.sh1
-rw-r--r--trunk/tty-acs.c97
-rw-r--r--trunk/tty-keys.c657
-rw-r--r--trunk/tty-term.c535
-rw-r--r--trunk/tty.c1548
-rw-r--r--trunk/utf8.c353
-rw-r--r--trunk/window-choose.c457
-rw-r--r--trunk/window-clock.c124
-rw-r--r--trunk/window-copy.c1912
-rw-r--r--trunk/window.c1045
-rw-r--r--trunk/www/images/tmux3.pngbin0 -> 37945 bytes
-rw-r--r--trunk/www/images/tmux4.pngbin0 -> 6175 bytes
-rw-r--r--trunk/www/images/tmux5.pngbin0 -> 39923 bytes
-rw-r--r--trunk/www/index.html.in86
-rw-r--r--trunk/www/main.css50
-rw-r--r--trunk/xmalloc.c144
-rw-r--r--trunk/xterm-keys.c199
1452 files changed, 329227 insertions, 4 deletions
diff --git a/TODO b/TODO
index e51e5172..57d852ac 100644
--- a/TODO
+++ b/TODO
@@ -101,8 +101,6 @@
- a history of commands that can be reversed (reverse member of each command,
and a buffer) info() when changing to same window
- don't pass UTF-8 through vis for titles
-- add a unique ever-increasing pane id to each pane, export it in $TMUX_PANE
- (as %1, %2 etc) and allow it to be used as a target
- way to add dest for break-pane; maybe some easier way to unbreak-pane
- case insensitive searching
- pane-index option like base-index
@@ -117,8 +115,6 @@
key is looked up in that table
- pass shell commands as argv rather than strings, allow them to be specified
in commands without quotes
-- combine all options into 1 table (inc defaults) - can use C99 .foo = blah
- syntax
- a command to choose from a generic list, so you can do eg
choose-list -l Abc,Moo,Blah "run-shell 'sh /my/choose/script %%'"
- else part for if-shell
@@ -126,3 +122,5 @@
- add general internal format for lists (key=value) and a way to output them in
different representations, use for list-windows, etc etc. see message id
20110221205346.GA1580@yelena.nicm.ath.cx
+- numeric prefix in copy mode should be paste buffer for C-w
+- named buffers and allow gaps in the stack
diff --git a/tags/TMUX_0_8/CHANGES b/tags/TMUX_0_8/CHANGES
new file mode 100644
index 00000000..ac310676
--- /dev/null
+++ b/tags/TMUX_0_8/CHANGES
@@ -0,0 +1,1212 @@
+17 April 2009
+
+* Remove the right number of characters from the buffer when escape then
+ a cursor key (or other key prefixed by \033) is pressed. Reported by
+ Stuart Henderson.
+
+03 April 2009
+
+* rotate-window command. -U flag (default) for up, -D flag for down.
+
+02 April 2009
+
+* Change scroll/pane redraws to only redraw the single pane affected rather
+ than the entire window.
+* If redrawing the region would mean redrawing > half the pane, just schedule
+ to redraw the entire window. Also add a flag to skip updating the window any
+ further if it is scheduled to be redrawn. This has the effect of batching
+ multiple redraws together.
+
+01 April 2009
+
+* Basic horizontal splitting and layout management. Still some redraw and other
+ issues - particularly, don't mix with manual pane resizing, be careful when
+ viewing from multiple clients and don't expect shell windows to redraw very
+ well after the layout is changed; generally cycling the layout a few times
+ will fix most problems. Getting this in for testing while I think about how
+ to deal with manual mode.
+
+ Split window as normal and cycle the layouts with C-b space. Some of the
+ layouts will work better when swap-pane comes along.
+
+31 March 2009
+
+* AIX port, thanks to cmihai for access to a box. Only tested on 6.1 with xlc
+ 10.1 (make sure CC is set). Needs GNU make and probably ncurses (didn't try
+ plain curses). Also won't build with DEBUG, so comment the FDEBUG=1 line in
+ GNUmakefile.
+* Draw a vertical line on the right when the window size is less than the
+ terminal size. This is partly to shake out any horizontal limit bugs on the
+ way to horizontal splitting/pane tiling. Currently a bit slow since it has to
+ do a lot of redrawing but hopefully that will improve as I get some better
+ ideas for how to do it.
+* Fix remaining problems with copy and paste and UTF-8.
+
+28 March 2009
+
+* Better UTF-8 support, including combined characters. Unicode data is now
+ stored as UTF-8 in a separate array, the code does a lookup into this every
+ time it gets to a UTF-8 cell. Zero width characters are just appended onto
+ the UTF-8 data for the previous cell. This also means that almost no bytes
+ extra are wasted non-Unicode data (yay).
+
+ Still some oddities, such as copy mode skips over wide characters in a
+ strange way, and the code could do with some tidying.
+* Key repeating is now a property of the key binding not of the command.
+ Repeat is turned on when the key is bound with the -r flag to bind-key.
+ next/previous-window no longer repeat by default as it turned out to annoy
+ me.
+
+27 March 2009
+
+* Clear using ED when redrawing the screen. I foolishly assumed using spaces
+ would be equivalent and terminals would pick up on this, but apparently not.
+ This fixes copy and paste in xterm/rxvt.
+* Sockets in /tmp are now created in a subdirectory named, tmux-UID, eg
+ tmux-1000. The default socket is thus /tmp/tmux-UID/default. To start a
+ separate server, the new -L command line option should be used: this creates
+ a socket in the same directory with a different name ("-L main" will create
+ socket called "main"). -S should only be used to place the socket outside
+ /tmp. This makes sockets a little more secure and a bit more convenient to
+ use multiple servers.
+
+21 March 2009
+
+* New session flag "set-remain-on-exit" to set remain-on-exit flag for new
+ windows created in that session (like "remain-by-default" used to do). Not
+ perfectly happy about this, but until I can think of a good way to introduce
+ it generically (maybe a set of options in the session) this will do. Fixes
+ SF request 2527847.
+
+07 March 2009
+
+* Support for 88 colour terminals.
+* break-pane command to create a new window using an existing pane.
+
+02 March 2009
+
+* Make escape key timer work properly so escape+key can be used without
+ lightning fast key presses.
+
+13 February 2009
+
+* Redo mode keys slightly more cleanly and apply them to command prompt
+ editing. vi or emacs mode is controlled by the session option status-keys.
+
+12 February 2009
+
+* Looking up argv[0] is expensive, so just use p_comm for the window name which
+ is good enough. Also increase name update time to 500 ms.
+
+11 February 2009
+
+* Only use ri when actually at the top of the screen; just move the cursor up
+ otherwise.
+* FreeBSD's console wraps lines at $COLUMNS - 1 rather than $COLUMNS (the
+ cursor can never be beyond $COLUMNS - 1) and does not appear to support
+ changing this behaviour, or any of the obvious possibilities (turning off
+ right margin wrapping, insert mode). This is irritating, most notably because
+ it impossible to write to the very bottom-right of the screen without
+ scrolling. To work around this, if built on FreeBSD and run with a "cons"
+ $TERM, the bottom-right cell on the screen is omitted.
+* Emulate scroll regions (slowly) to support the few terminals which don't have
+ it (some of which don't really have any excuse).
+
+10 February 2009
+
+* No longer redraw the status line every status-interval unless it has actually
+ changed.
+
+08 February 2009
+
+* Don't treat empty arguments ("") differently when parsing configuration
+ file/command prompt rather than command line.
+* tmux 0.7 released.
+
+03 February 2009
+
+* New command, copy-buffer (alias copyb), to copy a session paste buffer to
+ another session.
+
+01 February 2009
+
+* The character pair #(command) may now contain (escaped) right parenthesis.
+
+30 January 2009
+
+* . now bound to "command-prompt 'move-window %%'" by default, from joshe.
+
+29 January 2009
+
+* Window options to set status line fg, bg and attributes for a single
+ window. Options are: window-status-fg, window-status-bg,
+ window-status-attr. Set to "default" to use the session status colours.
+
+ This allows quite neat things like:
+
+ $ cat ~/bin/xssh
+ #!/bin/sh
+
+ if [ ! -z "$TMUX" ]; then
+ case "$1" in
+ natalya)
+ tmux setw window-status-fg red >/dev/null
+ ;;
+ natasha)
+ tmux setw window-status-fg yellow >/dev/null
+ ;;
+ esac
+ fi
+ ssh "$@"
+ [ ! -z "$TMUX" ] && tmux setw -u window-status-fg >/dev/null
+ $ alias ssh="~/bin/xssh"
+
+* Support #(command) in status-left, and status-right, which is displayed as
+ the first line of command's output (e.g. set -g status-right
+ "#(whoami)@#(hostname -s)"). Commands with )s aren't supported.
+
+28 January 2009
+
+* Support mouse in copy mode to move cursor. Can't do anything else at the
+ moment until other mouse modes are handled.
+* Better support for at least the most common variant of mouse input: parse it
+ and adjust for different panes. Also support mouse in window/session choice
+ mode.
+
+27 January 2009
+
+* Bring back the fancy window titles with session/window names: it is easy to
+ work around problems with elinks (see FAQ).
+* -u flag to scroll-mode and copy-mode to start scrolled one page
+ up. scroll-mode -u is bound to prefix,page-up (ppage) by default.
+* Allow status, mode and message attributes to be changed by three new options:
+ status-attr, mode-attr, message-attr. A comma-separataed list is accepted
+ containing: bright, dim, underscore, blink, reverse, hidden, italics, for
+ example:
+
+ set -g status-attr bright,blink
+
+ From Josh Elsasser, thanks!
+
+26 January 2009
+
+* Be more clever about picking the right process to create the window name.
+* Don't balls up the terminal on UTF-8 combined characters. Don't support them
+ properly either - they are just discarded for the moment.
+
+25 January 2009
+
+* load-buffer command
+
+23 January 2009
+
+* Use reverse colours rather than swapping fg and bg for message, mode and
+ status line. This makes these usable on black and white terminals.
+* Better error messages when creating a session or window fails.
+* Oops. Return non-zero on error. Reported by Will Maier.
+
+21 January 2009
+
+* Handle SIGTERM (and kill-server which uses it), a bit more neatly - tidy
+ up properly and print a nicer message. Same effect though :-).
+* new-window now supports -k to kill target window if it exists.
+* Bring back split-window -p and -l options to specify the height a percentage
+ or as a number of lines.
+* Make window and session choice modes allow you to choose items in vi keys
+ mode (doh!). As a side-effect, this makes enter copy selection (as well
+ as C-w/M-w) when using emacs keys in copy mode. Reported by merdely.
+
+20 January 2009
+
+* Darwin support for automatic-rename from joshe; Darwin doesn't seem to have
+ a sane method of getting argv[0] and searching for the precise insane way
+ is too frustrating, so this just uses the executable name.
+* Try to change the window title to match the command running it in. This is
+ done by reading argv[0] from the process group leader of the group that owns
+ the tty (tcgetpgrp()). This can't be done portably so some OS-dependent code
+ is introduced (ugh); OpenBSD, FreeBSD and Linux are supported at the moment.
+
+ A new window flag, automatic-rename, is available: if this is set to off, the
+ window name is not changed. Specifying a name with the new-window,
+ new-session or rename-window commands will automatically set this flag to off
+ for the window in question. To disable it entirely set the option to off
+ globally (setw -g automatic-rename off).
+
+19 January 2009
+
+* Fix various stupid issues when the status line is turned off. Grr.
+* Use reverse attributes for clock and cursor, otherwise they do not
+ appear on black and white terminals.
+* An error in a command sequence now stops execution of that sequence.
+ Internally, each command code now passes a return code back rather than
+ talking to the calling client (if any) directly.
+* attach-session now tries to start the server if it isn't already started - if
+ no sessions are created in .tmux.conf this will cause an error.
+* Clean up starting server by making initial client get a special socketpair.
+
+18 January 2009
+
+* Unbreak UTF-8.
+* -a flag to next-window and previous-window to select the next or previous
+ window with activity or bell. Bound to M-n and M-p.
+* find-window command to search window names, titles and visible content (but
+ not history) for a string. If only one is found, the window is selected
+ otherwise a choice list is shown. This (as with the other choice commands)
+ only works from a key. Bound to "f" by default.
+* Cleaned up command printing code, also enclose arguments with spaces in "s.
+* Added command sequences. These are entered by separating each argument by a ;
+ argument (spaces on both sides), for example:
+
+ lsk ; lsc
+
+ To use a literal ; as the argument prefix it with \, for example:
+
+ bind x lsk \; lsc
+
+ Commands are executed from left to right. Also note that command sequences do
+ not support repeat-time repetition unless all commands making up the sequence
+ support it.
+* suspend-client command to suspend a client. Don't try to background it
+ though...
+* Mark attached sessions in sessions lists. Suggested by Simon Kuhnle.
+
+17 January 2009
+
+* tmux 0.6 released.
+
+15 January 2009
+
+* Support #H for hostname and #S for session name in status-left/right.
+* Two new commands, choose-window and choose-session which work only when bound
+ to a key and allow the window or session to be selected from a list. These
+ are now bound to "w" and "s" instead of the list commands.
+
+14 January 2009
+
+* Rework the prefix-time stuff. The option is now called repeat-time and
+ defaults to 500 ms. It only applies to a small subset of commands, currently:
+ up-pane, down-pane, next-window, previous-window, resize-pane-up,
+ resize-pane-down. These are the commands for which it is obviously useful,
+ having it for everything else was just bloody annoying.
+* The alt-up and alt-down keys now resize a pane by five lines at a time.
+* switch-pane is now select-pane and requires -p to select a pane. The
+ "o" key binding is changed to down-pane.
+* up-pane and down-pane commands, bound to arrow up and down by default.
+* Multiple vertical window splitting. Minimum pane size is four lines, an
+ (unhelpful) error will be shown if attempting to split a window with less
+ that eight lines. If the window is resized, as many panes are shown as can
+ fit without reducing them below four lines. There is (currently!) not a way
+ to show a hidden pane without making the window larger.
+
+ Note the -p and -l options to split-window are now gone, these may reappear
+ once I think them through again.
+* Server locking on inactivity (lock-after-time) is now disabled by default.
+
+13 January 2009
+
+* kill-pane command.
+
+12 January 2009
+
+* command-prompt now accepts a single argument, a template string. Any
+ occurrences of %% in this string are replaced by whatever is entered at the
+ prompt and the result is executed as a command. This allows things like (now
+ bound by default):
+
+ bind , command-prompt "rename-window %%"
+
+ Or my favourite:
+
+ bind x command-prompt "split-window 'man %%'"
+
+* Option to set prefix time, allowing multiple commands to be entered without
+ pressing the prefix key again, so long as they each typed within this time of
+ each other.
+* Yet more hacks for key handling. Think it is just about working now.
+* Two commands, resize-pane-up and resize-pane-down to resize a pane.
+* Make the window pane code handle panes of different sizes, and add a -l
+ and -p arguments to split-window to specify the new window size in lines
+ or as a percentage.
+
+11 January 2009
+
+* Vertical window splitting. Currently can only split a window into two panes.
+ New split-window command splits (bound to ") and switch-pane command (bound to
+ o) switches between panes.
+
+ close-pane, swap-pane commands are to follow. Also to come are pane resizing,
+ >2 panes, the ability to break a pane out to a full window and vice versa and
+ possibly horizontal splitting.
+
+ Panes are subelements of windows rather than being windows in their own
+ right. I tried to make them windows (so the splitting was at the session or
+ client level) but this rapidly became very complex and invasive. So in the
+ interests of having something working, I just made it so each window can have
+ two child processes instead of one (and it still took me 12 hours straight
+ coding). Now the concept is proven and much of the support code is there,
+ this may change in future if more flexibility is needed.
+* save-buffer command, from Tiago Cunha.
+
+10 January 2009
+
+* New option, lock-after-time. If there is no activity in the period specified
+ by this option (in seconds), tmux will lock the server. Default is 1800 (30
+ minutes), set to 0 to disable.
+* Server locking. Two new commands: set-password to set a password (a
+ preencrypted password may be specified with -c); and lock-server to lock the
+ server until the password is entered. Also an additional command line flag,
+ -U, to unlock from the shell. The default password is blank (any password
+ accepted). If specifying an encrypted password from encrypt(1) in .tmux.conf
+ with -c, don't forget to enclose it in single-quotes (') to prevent shell
+ variable expansion.
+* If a window is created from the command line, tmux will now use the same
+ current working directory for the new process. A new default-path option to
+ sets the working directory for processes created from keys or interactively
+ from the prompt.
+* New mode to display a large clock. Entered with clock-mode command (bound to
+ C-b t by default); two window options: clock-mode-colour and clock-mode-style
+ (12 or 24). This will probably be used as the basis for window locking.
+* New command, server-info, to show some server information and terminal
+ details.
+
+09 January 2009
+
+* Stop using ncurses variables and instead build a table of the codes we want
+ into an array for each terminal type. This makes the code a little more
+ untidy in places but gets rid of the awful global variables and calling
+ setterm all the time, and shoves all the ncurses-dependent mess into a single
+ file, tty-term.c. It also allows overriding single terminal codes, this is
+ used to fix rxvt on some platforms (where it is missing dch) and in future
+ may allow user customisation a la vim.
+* Update key handling code. Simplify, support ctrl properly and add a new
+ window option (xterm-keys) to output xterm key codes including ctrl and,
+ if available, alt and shift.
+
+08 January 2009
+
+* If built without DEBUG (the release versions), don't cause a fatal error if
+ the grid functions notice an input error, just log and ignore the
+ request. This might mean me getting shouted at less often when bugs kill
+ long-running sessions, at least in release versions.
+* Hopefully fix cursor out-of-bounds checking when writing to grid. When I
+ wrote the code I must have forgotten that the cursor can be one cell off the
+ right of the screen (yes, I know), so there were number of out-of-bounds/
+ overflow problems.
+
+07 January 2009
+
+* New flag to set and setw, -u, to unset an option (allowing it to inherit from)
+ the global options again.
+* Added more info messages for options changes.
+* A bit of tidying and reorganisation of options code.
+
+06 January 2009
+
+* Don't crash when backspacing if cursor is off the right of the screen,
+ reported by David Chisnall.
+* Complete words at any point inside command in prompt, also use option name
+ as well as command names.
+* Per-client prompt history of up to 100 items.
+* Use a splay tree for key bindings instead of an array. As a side-effect this
+ sorts them when listed.
+
+22 December 2008
+
+* Use the right keys for home and end.
+
+20 December 2008
+
+* Add vim mode for tmux configuration file to examples/, from Tiago Cunha.
+
+15 December 2008
+
+* New command, source-file (alias source), to load a configuration
+ file. Written by Tiago Cunha, many thanks.
+
+13 December 2008
+
+* Work around lack of dch. On Linux, the rxvt termcap doesn't have it (it is
+ lying, but we can't really start disbelieving termcaps...). This is a bit
+ horrible - I can see no way to do it without pretty much redrawing the whole
+ line, but it works...
+
+10 December 2008
+
+* glibc's getopt(3) is useless: it is not POSIX compliant without jumping
+ through non-portable hoops, and the method of resetting it is unclear (the
+ man page on my system says set optind to 1, but other sources say 0). So,
+ import OpenBSD's getopt_long.c into compat/ for use on Linux and use the
+ clearly documented optreset = optind = 1 method. This fixes some strange
+ issues with command parsing (getting the syntax wrong would prevent any
+ further commands being parsed).
+
+06 December 2008
+
+* Bring set/setw/show/showw into line with other commands. This means that by
+ default they now affect the current window (if any); the new -g flag must be
+ passed to set the global options. This changes the behaviour of set/show and
+ WILL BREAK CURRENT CONFIGURATIONS.
+
+ In summary, whether in the configuration file, the command prompt, or a key
+ binding, use -g to set a global option, use -t to specify a particular window
+ or session, or omit both to try and use the current window or session.
+
+ This makes set/show a bit of a pain but is the correct behaviour for
+ setw/showw and is the same as every other command, so we can put up with a
+ bit of pain for consistency.
+* Redo window options. They now work in the same way to session options with a
+ global options set. showw/setw commands now have similar syntax to show/set
+ (including the ability to use abbreviations).
+
+ PLEASE NOTE this includes the following configuration-breaking changes:
+
+ - remain-by-default is now GONE, use "setw -g remain-on-exit" to apply the
+ global window option instead;
+ - mode-keys is now a window option rather than session - use "setw [-g]
+ mode-keys" instead of set.
+
+ There are also some additions:
+
+ - message-fg and message-bg session options to control status line message
+ colours;
+ - mode-fg and mode-bg window options to set colours in window modes such as
+ copy mode.
+
+ The options code still a mess and now there is twice as much of it :-(.
+
+02 December 2008
+
+* Add support for including the window title in status-left or status-right
+ strings by including the character pair "#T". This may be prefixed with
+ a number to specify a maximum length, for example "#24T" to use at most
+ 24 characters of the title.
+* Introduce two new options, status-left-length and status-right-length,
+ control the maximum length of left and right components of the status bar.
+* elinks (and possibly others) bypass the terminal and talk directly to X to
+ restore the window title when exiting. tmux can't know about this particular
+ bit of stupidity so the title ends up strange - the prefix isn't terribly
+ important and elinks is quite useful so just get rid of it.
+
+27 November 2008
+
+* Tweaks to support Dragonfly.
+
+17 November 2008
+
+* tmux 0.5 released.
+
+16 November 2008
+
+* New window option: "utf8"; this must be on (it is off by default) for UTF-8
+ to be parsed. The global/session option "utf8-default" controls the setting
+ for new windows.
+
+ This means that by default tmux does not handle UTF-8. To use UTF-8 by
+ default it is necessary to a) "set utf8-default on" in .tmux.conf b) start
+ tmux with -u on any terminal which support UTF-8.
+
+ It seems a bit unnecessary for this to be a per-window option but that is
+ the easiest way to do it, and it can't do any harm...
+* Enable default colours if op contains \033[39;49m, based on a report from
+ fulvio ciriaco.
+
+12 November 2008
+
+* Keep stack of last windows rather than just most recent; based on a diff from
+ joshe.
+
+04 November 2008
+
+* Don't try to redraw status line when showing a prompt or message; if it does,
+ the status timer is never reset so it redraws on every loop. Spotted by
+ joshe.
+
+09 October 2008
+
+* Translate 256 colours into 16 if 256 is not available, same as screen does.
+* Better support for OSC command (only to set window title now), and also
+ support using APC for the same purpose (some Linux default shell profiles do
+ this).
+
+25 September 2008
+
+* Large internal rewrite to better support 256 colours and UTF-8. Screen data
+ is now stored as single two-way array of structures rather than as multiple
+ separate arrays. Also simplified a lot of code.
+
+ Only external changes are three new flags, -2, -d and -u, which force tmux to
+ assume the terminal supports 256 colours, default colours (useful for
+ xterm-256color which lacks the AX flag), or UTF-8 respectively.
+
+10 September 2008
+
+* Split off colour conversion code from screen code.
+
+09 September 2008
+
+* Initial UTF-8 support. A bit ugly and with a limit of 4096 UTF-8
+ characters per window.
+
+08 September 2008
+
+* 256 colour support. tmux attempts to autodetect the terminal by looking
+ both at what ncurses reports (usually wrong for xterm) and checking if
+ the TERM contains "256col". For xterm TERM=xterm-256color is needed (as
+ well as a build that support 256 colours); this seems to work for rxvt
+ as well. On non-256 colour terminals, high colours are translated to white
+ foreground and black background.
+
+28 August 2008
+
+* Support OS X/Darwin thanks to bsd-poll.c from OpenSSH. Also convert
+ from clock_gettime(2) to gettimeofday(2) as OS X doesn't support the
+ former; microsecond accuracy will have to be sufficient ;-).
+
+07 August 2008
+
+* Lose some unused/useless wrapper functions.
+
+25 July 2008
+
+* Shell variables may now be defined and used in configuration file. Define
+ variables with:
+
+ VAR=1
+
+ And use with:
+
+ renamew ${VAR}
+ renamew "x${VAR}x"
+
+ Also some other fixes to make, for example, "abc""abc" work similarly to
+ the shell.
+
+24 July 2008
+
+* Finally lose inconsistently-used SCREEN_DEF* defines.
+* If cursor mode is on, switch the arrow keys from \033[A to \033OA.
+* Support the numeric keypad in both application and numbers mode. This is
+ different from screen which always keeps it in application mode.
+
+19 July 2008
+
+* Unbreak "set status" - tmux thought it was ambiguous, reported by rivo nurges.
+
+02 July 2008
+
+* Split vi and emacs mode keys into two tables and add an option (mode-keys)
+ to select between them. Default is emacs, use,
+
+ tmux set mode-keys vi
+
+ to change to vi.
+
+ vi mode uses space to start selection, enter to copy selection and escape
+ to clear selection.
+
+01 July 2008
+
+* Protocol versioning. Clients which identify as a different version from the
+ server will be rejected.
+* tmux 0.4 released.
+
+29 June 2008
+
+* Zombie windows. These are not closed when the child process dies. May be
+ set for a window with the new "remain-on-exit" option; the default setting
+ of this flag for new windows may be set with the "remain-by-default" session
+ option.
+
+ A window may be restarted with the respawn-window command:
+
+ respawn-window [-k] [command]
+
+ If -k is given, any existing process running in the window is killed;
+ if command is omitted, the same command as when the window was first
+ created is used.
+
+27 June 2008
+
+* Handle nonexistent session or client to -t properly.
+
+25 June 2008
+
+* select-prompt command to allow a window to be selected at a prompt. Only
+ windows in the current session may be selected. Bound to ' by default.
+ Suggested by merdely.
+* move-window command. Requested by merdely.
+* Support binding alt keys (prefixed with M-). Change default to use
+ C- for ctrl keys (^ is still accepted as an alternative).
+* Slim down default key bindings: support lowercase only.
+* Handle escaped keys properly (parse eg \033b into a single key code) and
+ use this to change copy mode next/previous work to M-f and M-b to match
+ emacs.
+
+24 June 2008
+
+* Next word (C-n/w) and previous word (C-b/b) in copy mode.
+
+23 June 2008
+
+* list-commands command (alias lscm).
+* Split information about options into a table and use it to parse options
+ on input (allowing abbreviations) and to print them with show-options
+ (meaning that bell-action gets a proper string). This turned out a bit ugly
+ though :-/.
+
+22 June 2008
+
+* Do not translate black and white into default if the terminal supports
+ default colours. This was nice to force programs which didn't use default
+ colours to be properly transparent in rxvt/aterm windows with a background
+ image, but it causes trouble if someone redefines the default foreground and
+ background (to have black on white or something).
+
+21 June 2008
+
+* Naive tab completion in the command prompt. This only completes command
+ names if a) they are at the start of the text b) the cursor is at
+ the end of the text c) the text contains no spaces.
+* Only attempt to set the title where TERM looks like an xterm (contains
+ "xterm", "rxvt" or is "screen"). I hate this but I don't see a better way:
+ setting the title actually kills some other terminals pretty much dead.
+* Strip padding out of terminfo(5) strings. Currently the padding is just
+ ignored, this may need to be altered if there are any software terminals
+ out there that actually need it.
+
+20 June 2008
+
+* buffer-limit option to set maximum size of buffer stack. Default is 9.
+* Initial buffer improvements. Each session has a stack of buffers and each
+ buffer command takes a -b option to manipulate items on the stack. If -b
+ is omitted, the top entry is used. The following commands are currently
+ available:
+
+ set-buffer [-b index] [-t target-session] string
+ paste-buffer [-d] [-b index] [-t target-window]
+ delete-buffer [-b index] [-t target-session]
+ show-buffers [-t target-session]
+ show-buffer [-b index] [-t target-session]
+
+ -d to paste-buffer deletes the buffer after pasting it.
+* New option, display-time, sets the time status line messages stay on screen
+ (unless a key is pressed). Set in milliseconds, default is 750 (0.75 seconds).
+ The timer is only checked every 100 ms or so.
+
+19 June 2008
+
+* Use "status" consistently for status line option, and prefix for "prefix" key
+ option.
+* Allow commands to be entered at a prompt. This is triggered with the
+ command-prompt command, bound to : by default.
+* Show status messages properly, without blocking the server.
+
+18 June 2008
+
+* New option, set-titles. On by default, this attempts to set the window title
+ using the \e]2;...\007 xterm code.
+
+ Note that elinks requires the STY environment variable (used by screen) to be
+ set before it will set the window title. So, if you want window titles set by
+ elinks, set STY before running it (any value will do). I can't do this for all
+ windows since setting it to an invalid value breaks screen.
+* Show arrows at either end of status line when scrolled if more windows
+ exist. Highlight the arrow if a hidden window has activity or bell.
+* Scroll the status line to show the current window if necessary. Also handle
+ windows smaller than needed better (show a blank status line instead of
+ hanging or crashing).
+
+17 June 2008
+
+* tmux 0.3 released.
+
+16 June 2008
+
+* Add some information messages when window options are changed, suggested by
+ Mike Erdely. Also add a -q command-line option to suppress them.
+* show-window-options (showw) command.
+
+15 June 2008
+
+* show-options (show) command to show one or all options.
+
+14 June 2008
+
+* New window options: force-width and force-height. This will force a window
+ to an arbitrary width and height (0 for the default unlimited). This is
+ neat for emacs which doesn't have a sensible way to force hard wrapping at 80
+ columns. Also, don't try to be clever and use clr_eol when redrawing the
+ whole screen, it causes trouble since the redraw functions are used to draw
+ the blank areas too.
+* Clear the blank area below windows properly when they are smaller than client,
+ also add an indicator line to show the vertical limit.
+* Don't die on empty strings in config file, reported by Will Maier.
+
+08 June 2008
+
+* Set socket mode +x if any sessions are attached and -x if not.
+
+07 June 2008
+
+* Make status-interval actually changeable.
+
+06 June 2008
+
+* New window option: aggressive-resize. Normally, windows are resized to the
+ size of the smallest attached session to which they are linked. This means a
+ window only changes size when sessions are detached or attached, or they are
+ linked or unlinked from a session. This flag changes a window to be the size
+ of the smallest attached session for which it is the current window - it is
+ resized every time a session changes to it or away from it. This is nice for
+ things that handle SIGWINCH well (like irssi) and bad for things like shells.
+* The server now exits when no sessions remain.
+* Fix bug with inserting characters with TERM=xterm-color.
+
+05 June 2008
+
+* Completely reorganise command parsing. Much more common code in cmd-generic.c
+ and a new way of specifying windows, clients or sessions. Now, most commands
+ take a -t argument, which specifies a client, a session, or a window target.
+ Clients and sessions are given alone (sessions are fnmatch(3)d and
+ clients currently not), windows are give by (client|session):index. For
+ example, if a user is in session "1" window 0 on /dev/ttypi, these should all
+ be equivalent:
+
+ tmux renamew newname (current session and window)
+ tmux renamew -t: newname (current session and window)
+ tmux renamew -t:0 newname (current session, window 0)
+ tmux renamew -t0 newname (current session, window 0)
+ tmux renamew -t1:0 newname (session 1, window 0)
+ tmux renamew -t1: newname (session 1's current window)
+ tmux renamew -t/dev/ttypi newname (client /dev/ttypi's current
+ session and window)
+ tmux renamew -t/dev/ttypi: newname (client /dev/ttypi's current
+ session and window)
+ tmux renamew -t/dev/ttypi:0 newname (client /dev/ttypi's current
+ session, window 0)
+
+ This does have some downsides, for example, having to use -t on selectw,
+
+ tmux selectw -t7
+
+ is annoying. But then using non-flagged arguments would mean renaming the
+ current window would need to be something like:
+
+ tmux renamew : newname
+
+ It might be better not to try and be so consistent; comments to the usual
+ address ;-).
+* Infrastructure for printing arguments in list-keys output. Easy ones only for
+ now.
+
+04 June 2008
+
+* Add some vi(1) key bindings in copy mode, and support binding ^[, ^\, ^]
+ ^^ and ^_. Both from/prompted by Will Maier.
+* setw monitor-activity and set status without arguments now toggle the current
+ value; suggested by merdely.
+* New command set-window-option (alias setw) to set the single current window
+ option: monitor-activity to determine whether window activity is shown in
+ the status bar for that window (default off).
+* Change so active/bell windows are inverted in status line.
+* Activity monitoring - window with activity are marked in status line. No
+ way to disable this/filter windows yet.
+* Brought select-window command into line with everything else; it now uses
+ -i for the window index.
+* Strings to display on the left and right of the status bar may now be set
+ with the status-left and status-right options. These are passed through
+ strftime(3) before being displayed. The status bar is automatically updated
+ at an interval set by the status-interval option. The default is to display
+ nothing on the left and the date and time on the left; the default update
+ interval is 15 seconds.
+
+03 June 2008
+
+* Per session options. Setting options without specifying a session sets the
+ global options as normal (global options are inherited by all sessions);
+ passing -c or -s will set the option only for that session.
+* Because a client has a session attached, any command needing a session can
+ take a client and use its session. So, anything that used to accept -s now
+ accepts -c as well.
+* -s to specify session name now supports fnmatch(3) wildcards; if multiple
+ sessions are found, or if no -s is specified, the most newly created is used.
+* If no command is specified, assume new-session. As a byproduct, clean up
+ command default values into separate init functions.
+* kill-server command.
+
+02 June 2008
+
+* New command, start-server (alias "start"), to start the tmux server and do
+ nothing else. This is good if you have a configuration file which creates
+ windows or sessions (like me): in that case, starting the server the first
+ time tmux new is run is bad since it creates a new session and window (as
+ it is supposed to - starting the server is a side-effect).
+
+ Instead, I have a little script which does the equivalent of:
+
+ tmux has -s0 2>/dev/null || tmux start
+ tmux attach -d -s0
+
+ And I use it to start the server if necessary and attach to my primary
+ session.
+* Basic configuration file in ~/.tmux.conf or specified with -f. This is file
+ contains a set of tmux commands that are run the first time the server is
+ started. The configuration commands are executed before any others, so
+ if you have a configuration file that contains:
+
+ new -d
+ neww -s0
+
+ And you do the following without an existing server running:
+
+ tmux new
+
+ You will end up with two sessions, session 0 with two windows (created by
+ the configuration file) and your client attached to session 1 with one
+ window (created by the command-line command). I'm not completely happy with
+ this, it seems a little non-obvious, but I haven't yet decided what to do
+ about it.
+
+ There is no environment variable handling or other special stuff yet.
+
+ In the future, it might be nice to be able to have per-session configuration
+ settings, probably by having conditionals in the file (so you could, for
+ example, have commands to define a particular window layout that would only
+ be invoked if you called tmux new -smysession and mysession did not already
+ exist).
+* BIG CHANGE: -s and -c to specify session name and client name are now passed
+ after the command rather than before it. So, for example:
+
+ tmux -s0 neww
+
+ Becomes:
+
+ tmux neww -s0
+
+ This is to allow them to be used in the (forthcoming) configuration file
+ THIS WILL BREAK ANY CURRENT SCRIPTS OR ALIASES USING -s OR -c.
+
+01 June 2008
+
+* Bug fix: don't die if -k passed to link-window and the destination doesn't
+ exist.
+* New command, send-keys, will send a set of keys to a window.
+
+31 May 2008
+
+* Fix so tmux doesn't hang if the initial window fails for some reason. This
+ was highlighted by problems on Darwin, thanks to Elias Pipping for the report
+ and access to a test account. (tmux still won't work on Darwin since its
+ poll(2) is broken.)
+
+02 January 2008
+
+* Don't attempt to reset the tty on exit if it has been closed externally.
+
+06 December 2007
+
+* Restore checks for required termcap entries and add a few more obvious
+ emulations.
+* Another major reorganisation, this time of screen handling. A new set of
+ functions, screen_write_*, are now used to write to a screen and a tty
+ simultaneously. These are used by the input parser to update the base
+ window screen and also by the different modes which now interpose their own
+ screen.
+
+30 November 2007
+
+* Support \ek...\e\ to set window name.
+
+27 November 2007
+
+* Enable/disable mouse when asked, if terminal claims to support it. Mouse
+ sequences are just passed through unaltered for the moment.
+* Big internal reorganisation. Rather than leaving control of the tty solely in
+ the client and piping all data through a socket to it, change so that the
+ server opens the tty again and reads and writes to it directly. This avoids
+ a lot of buffering and copying. Also reorganise the redrawing stuff so that
+ everything goes through screen_draw_* - this makes the code simpler, but
+ still needs broken up more, and all the ways of writing to screens should be
+ more consistent.
+
+26 November 2007
+
+* Rather than shifting up one line at a time once the history is full,
+ shift by 10% of the history each time. This is faster.
+* Add ^A and ^E to copy mode to move to start-of-line/end-of-line.
+
+24 November 2007
+
+* Support for alt charset mode (VT100 graphics characters).
+
+23 November 2007
+
+* Mostly complete copy & paste. Copy mode entered with C-b [ (copy-mode
+ command). In copy mode, arrow keys/page up/page down/hjkl/C-u/C-f navigate,
+ space or C-space starts selection, and enter or C-w copies and (important!)
+ exits copy mode. C-b ] (paste-buffer) pastes into current window. No
+ extra utility keys (bol/eol/clear selection/etc), only one single buffer,
+ and no buffer manipulation commands (clear/view/etc) yet. The code is also
+ fugly :-(.
+* history-limit option to set maximum history. Does not apply retroactively to
+ existing windows! Lines take up a variable amount of space, but a reasonable
+ guess for an 80-column terminal is 250 KB per 1000 lines (of history used,
+ an empty history takes no space).
+
+21 November 2007
+
+* Create every line as zero length and only expand it as data is written,
+ rather than creating at full size immediately.
+* Make command output (eg list-keys) go to a scrollable window similar to
+ scroll mode.
+* Redo screen redrawing so it is a) readable b) split into utility functions
+ that can be used outside screen.c. Use these to make scroll mode only
+ redraw what it has to which gets rid of irritating flickering status box and
+ makes it much faster.
+* Full line width memory and horizontal scrolling in history.
+* Initial support for scroll history. = to enter scrolling mode, and then
+ vi keys or up/down/pgup/pgdown to navigate. Q to exit. No horizontal history
+ yet (need per-line sizes) and a few kinks to be worked out (resizing while in
+ history mode will probably cause trouble).
+
+20 November 2007
+
+* Fix format string error with "must specify a client" message. Also
+ sprinkle some printflike tags.
+* tmux 0.1 released.
+
+17 November 2007
+
+* (nicm) Add -k option to link-window to kill target window if it exists.
+
+16 November 2007
+
+* (nicm) Split in-client display into two columns. This is a hack but not a lot
+ more so than that bit is already and it helps with lots of keys.
+* (nicm) switch-client command to switch client between different sessions. This
+ is pretty cool:
+
+ $ tmux bind q switch 0
+ $ tmux bind w switch 1
+
+ Then you can switch between sessions 0 and 1 with a key :-).
+* (nicm) Accept "-c client-tty" on command line to allow client manipulation
+ commands, and change detach-/refresh-session to detach-/refresh-client (this
+ loses the -a behaviour, but at some point -session versions may return, and
+ -c will allow fnmatch(3)).
+* (nicm) List available commands on ambiguous command.
+
+12 November 2007
+
+* (nicm) If the terminal supports default colours (AX present), force black
+ background and white foreground to default. This is useful on transparent
+ *terms for programs which don't do it themselves (like most(1)).
+* (nicm) Fill in the rest of the man page.
+* (nicm) kill-session command.
+
+09 November 2007
+
+* (nicm) C-space is now "^ " not "^@".
+* (nicm) Support tab (\011).
+* (nicm) Initial man page outline.
+* (nicm) -V to show version.
+* (nicm) rename-session command.
+
+08 November 2007
+
+* (nicm) Check for required terminal capabilities on start.
+
+31 October 2007
+
+* (nicm) Linux port.
+
+30 October 2007
+
+* (nicm) swap-window command. Same as link-window but swaps windows.
+
+26 October 2007
+
+* (nicm) Saving scroll region on \e7 causes problems with ncmpc so I guess
+ it is not required.
+* (nicm) unlink-window command.
+* (nicm) link-window command to link an existing window into another session
+ (or another index in the same session). Syntax:
+
+ tmux -s dstname link-window [-i dstidx] srcname srcidx
+
+* (nicm) Redo window data structures. The global array remains, but each per-
+ session list is now a RB tree of winlink structures. This disassociates the
+ window index from the array size (allowing arbitrary indexes) which still
+ allowing windows to have multiple indexes.
+
+25 October 2007
+
+* (nicm) has-session command: checks if session exists.
+
+24 October 2007
+
+* (nicm) Support for \e6n to request cursor position. resize(1) now works.
+* (nicm) Support for \e7, \e8 save/restore cursor and attribute sequences.
+ Currently don't save mode (probably should). Also change some cases where
+ out-of-bound values are ignored to limit them to within range (there are
+ others than need to be checked too).
+
+23 October 2007
+
+* (nicm) Lift limit on session name passed with -s.
+* (nicm) Show size in session/window lists.
+* (nicm) Pass tty up to server when client identifies and add a list-clients
+ command to list connected clients.
+
+20 October 2007
+
+* (nicm) Add default-command option and change default to be $SHELL rather than
+ $SHELL -l. Also try to read shell from passwd db if $SHELL isn't present.
+
+19 October 2007
+
+* (nicm) -n on new-session is now -s, and -n is now the initial window name.
+ This was documented but not implemented :-/.
+* (nicm) kill-window command, bound to & by default (because it should be hard
+ to hit accidently).
+* (nicm) bell-style option with three choices: "none" completely ignore bell;
+ "any" pass through a bell in any window to current; "current" ignore bells
+ except in current window. This applies only to the bell terminal signal,
+ the status bar always reflects any bells.
+* (nicm) Refresh session command.
+
+12 October 2007
+
+* (nicm) Add a warning if $TMUX exists on new/attach.
+* (nicm) send-prefix command. Bound to C-b by default.
+* (nicm) set status, status-fg, status-bg commands. fg and bg are as a number
+ from 0 to 8 or a string ("red", "blue", etc). status may be 1/0, on/off,
+ yes/no.
+* (nicm) Make status line mark window in yellow on bell.
+
+04 October 2007
+
+* (nicm) -d option to attach to detach all other clients on the same session.
+* (nicm) Partial resizing support. Still buggy. A C-b S and back sometimes fixes
+ it when it goes wonky.
+* (mxey) Added my tmux start script as an example (examples/start-tmux.sh).
+* (mxey) New sessions can now be given a command for their first window.
+* (mxey) Fixed usage statement for new-window.
+* (nicm) attach-session (can't believe I forgot it until now!) and list-windows
+ commands.
+* (nicm) rename-window and select-window commands.
+* (nicm) set-option command (alias set): "tmux set-option prefix ^A".
+* (nicm) Key binding and unbinding is back.
+
+03 October 2007
+
+* (nicm) {new,next,last,previous}-window.
+* (nicm) Rewrite command handling so commands are much more generic and the
+ same commands are used for command line and keys (although most will probably
+ need to check how they are called). Currently incomplete (only new/detach/ls
+ implemented). Change: -s is now passed before command again!
+* (nicm) String number arguments. So you can do: tmux bind ^Q create "blah".
+* (nicm) Key binding. tmux bind key command [argument] and tmux unbind key.
+ Key names are in a table in key-string.c, plus A is A, ^A is ctrl-A.
+ Possible commands are in cmd.c (look at cmd_bind_table).
+* (nicm) Move command parsing into the client. Also rename some messages and
+ tidy up a few bits. Lots more tidying up needed :-/.
+
+02 October 2007
+
+* (nicm) Redraw client status lines on rename.
+* (nicm) Error on ambiguous command.
+
+01 October 2007
+
+* (nicm) Restore window title handling.
+* (nicm) Simple uncustomisable status line with window list.
+
+30 September 2007
+
+* (nicm) Window info command for debugging, C-b I.
+
+29 September 2007
+
+* (nicm) Deleting/inserting lines should follow scrolling region. Fix.
+* (nicm) Allow creation of detached sessions: "tmux new-session -d".
+* (nicm) Permit error messages to be passed back for transient clients like
+ rename. Also make rename -i work.
+* (nicm) Pass through bell in any window to current.
+
+28 September 2007
+
+* (nicm) Major rewrite of input parser:
+ - Lose the old weirdness in favour of a state machine.
+ - Merge in parsing from screen.c.
+ - Split key parsing off into a separate file.
+ This is step one towards hopefully allowing a status line. It requires
+ that we output data as if the terminal had one line less than it really does -
+ a serious problem when it comes to things like scrolling. This change
+ consolidates all the range checking and limiting together which should make
+ it easier.
+* (mxey) Added window renaming, like "tmux rename [-s session] [-i index] name"
+
+27 September 2007
+
+* Split "tmux list" into "tmux list-sessions" (ls) and "list-windows" (lsw).
+* New command session selection:
+ - if name is specified, look for it and use it if it exists, otherwise
+ error
+ - if no name specified, try the current session from $TMUX
+ - if $TMUX doesn't exist, and there is only one session, use it,
+ otherwise error
+
+26 September 2007
+
+* Add command aliases, so "ls" is an alias for "list".
+* Rename some commands and alter syntax to take options after a la CVS. Also
+ change some flags. So:
+
+ tmux -s/socket -nabc new
+
+ Becomes:
+
+ tmux -S/socket new -sabc
+
+* Major tidy and split of client/server code.
+
+22 September 2007
+
+* Window list command (C-b W). Started by Maximilian Gass, finished by me.
+
+20 September 2007
+
+* Specify meta via environment variable (META).
+* Record last window and ^L key to switch to it. Largely from Maximilian Gass.
+* Reset ignored signals in child after forkpty, makes ^C work.
+* Wrap on next/previous. From Maximilian Gass.
+
+19 September 2007
+
+* Don't renumber windows on close.
+
+28 August 2007
+
+* Scrolling region (\e[r) support.
+
+27 August 2007
+
+* Change screen.c to work more logically and hopefully fix heap corruption.
+
+09 July 2007
+
+* Initial import to CVS. Basic functions are working, albeit with a couple of
+ showstopper memory bugs and many missing features. Detaching, reattaching,
+ creating new sessions, listing sessions work acceptably for using with shells.
+ Simple curses programs (top, systat, tetris) and more complicated ones (mutt,
+ emacs) that don't require scrolling regions (ESC[r) mostly work fine
+ (including mutt, emacs). No status bar yet and no key remapping or other
+ customisation.
+
+$Id: CHANGES,v 1.272 2009-04-17 12:36:21 nicm Exp $
+
+ LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
+ LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
+ LocalWords: dstidx srcname srcidx winlink lsw nabc sabc Exp Tiago Cunha dch
+ LocalWords: setw Chisnall renamew merdely eg Maier newname selectw neww Gass
diff --git a/tags/TMUX_0_8/FAQ b/tags/TMUX_0_8/FAQ
new file mode 100644
index 00000000..76edf66f
--- /dev/null
+++ b/tags/TMUX_0_8/FAQ
@@ -0,0 +1,189 @@
+tmux frequently asked questions
+
+* How is tmux different from GNU screen? What else does it offer?
+
+tmux offers several advantages over screen:
+
+- a clearly-defined client-server model: windows are independent entities which
+ may be attached simultaneously to multiple sessions and viewed from multiple
+ clients (terminals), as well as moved freely between sessions within the same
+ tmux server;
+- a consistent, well-documented command interface, with the same syntax
+ whether used interactively, as a key binding, or from the shell;
+- easily scriptable from the shell;
+- multiple paste buffers;
+- choice of vi or emacs key layouts;
+- an option to limit the window size;
+- a more usable status line syntax, with the ability to display the first line
+ of output of a specific command;
+- a cleaner, modern, easily extended, BSD-licensed codebase.
+
+There are still a few features screen includes that tmux omits:
+
+- builtin serial and telnet support; this is bloat and is unlikely to be added
+ to tmux;
+- wider platform support, for example IRIX and HP-UX, and for odd terminals.
+
+* I found a bug! What do I do?
+
+Please send bug reports by email to nicm@users.sourceforge.net. Please
+include as much of the following information as possible:
+
+- the version of tmux you are running;
+- the operating system you are using and its version;
+- the terminal emulator you are using and the TERM setting when tmux was
+ started;
+- a description of the problem;
+- if the problem is repeatable, the steps to repeat the problem;
+- for screen corruption issues, a screenshot and the output of "infocmp $TERM"
+ from outside tmux are often very useful.
+
+* Why doesn't tmux do $x?
+
+Please send feature requests by email to nicm@users.sourceforge.net.
+
+* Why do you use the screen termcap inside tmux? It sucks.
+
+It is already widely available. It is planned to change to something else
+such as xterm-color at some point, if possible.
+
+* I don't see any colour in my terminal! Help!
+
+On some platforms, common termcaps such as xterm do not include colour. screen
+ignores this, tmux does not. If the terminal emulator in use supports colour,
+use a termcap which correctly lists this, such as xterm-color.
+
+* tmux freezes my terminal when I attach to a session. I even have to kill -9
+ the shell it was started from to recover!
+
+Some consoles really really don't like attempts to set the window title. Tell
+tmux not to do this by turning off the "set-titles" option (you can do this
+in .tmux.conf):
+
+ set -g set-titles off
+
+If this doesn't fix it, send a bug report.
+
+* Why is C-b the prefix key? How do I change it?
+
+The default key is C-b because the prototype of tmux was originally developed
+inside screen and C-b was chosen not to clash with the screen meta key. It
+also has the advantage of not interfering with the use of C-a for start-of-line
+in emacs and the shell (although it does interfere with previous-character).
+
+Changing is simple: change the "prefix-key" option, and - if required - move
+the binding of the "send-prefix" command from C-b (C-b C-b sends C-b by
+default) to the new key. For example:
+
+ set -g prefix C-a
+ unbind C-b
+ bind C-a send-prefix
+
+* How do I use UTF-8?
+
+When running tmux in a UTF-8 capable terminal, two things must be done to
+enable support. UTF-8 must be turned on in tmux; this may be done separately
+for each tmux window or globally by setting the "utf8" flag:
+
+ setw -g utf8 on
+
+And, as it is not possible to automatically detect that a terminal is UTF-8
+capable, tmux must be told by passing the -u flag when creating or
+attaching a client to a tmux session:
+
+ $ tmux -u new
+
+* How do I use a 256 colour terminal?
+
+tmux will attempt to detect a 256 colour terminal both by looking at the Co
+termcap entry and, as this is broken for some terminals such as xterm-256color,
+by looking for the string "256col" in the termcap name.
+
+If both these methods fail, the -2 flag may be passed to tmux when attaching
+to a session to indicate the terminal supports 256 colours.
+
+* vim or $otherprogram doesn't display 256 colours. What's up?
+
+Some programs attempt to detect the number of colours a terminal is capable of
+by checking the Co termcap entry. However, this is not reliable, and in any
+case is missing from the "screen" termcap used inside tmux.
+
+There are three options to allow programs to recognise they are running on
+a 256-colour terminal inside tmux:
+
+- Manually force the application to use 256 colours always or if TERM is set to
+ screen. For vim, you can do this by overriding the t_Co option, see
+ http://vim.wikia.com/wiki/256_colors_in_vim.
+- If the platform includes it, using the "screen-256color" termcap (set
+ TERM=screen-256color). "infocmp screen-256color" can be used to check if this
+ is supported. It is not currently possible to set this globally inside tmux
+ but it may be done in a shell startup script by checking if TERM is screen
+ and exporting TERM=screen-256color instead.
+- Creating a custom terminfo file that includes Co#256 in ~/.terminfo and using
+ it instead. These may be compiled with tic(1).
+
+* How do I make Ctrl-PgUp and Ctrl-PgDn work in vim?
+
+tmux supports passing through ctrl (and where supported by the client terminal,
+alt and shift) modifiers to function keys using xterm(1)-style key sequences.
+This may be enabled per window, or globally with the tmux command:
+
+ setw -g xterm-keys on
+
+Because the TERM variable inside tmux must be set to "screen", vim will not
+automatically detect these keys are available; however, the appropriate key
+sequences can be overridden in .vimrc using the following:
+
+ if &term == "screen"
+ set t_kN=^[[6;*~
+ set t_kP=^[[5;*~
+ endif
+
+And similarly for any other keys for which modifiers are desired.
+
+Please note that the "xterm-keys" setting may affect other programs, in the
+same way as running them in a standard xterm; for example most shells do not
+expect to receive xterm(1)-style key sequences so this setting may prevent keys
+such as ctrl-left and ctrl-right working correctly. tmux also passes through
+the ctrl (bit 5 set, for example ^[[5~ to ^[[5^) modifier in non-xterm(1) mode;
+it may be possible to configure vim to accept these, an example of how to do so
+would be welcome.
+
+* Why doesn't elinks set the window title inside tmux?
+
+There isn't a way to detect if a terminal supports setting the window title, so
+elinks attempts to guess by looking at the environment. Rather than looking for
+TERM=screen, it uses the STY variable to detect if it is running in screen;
+tmux does not use this so the check fails. A workaround is to set STY before
+running elinks.
+
+The following shell function does this, and also clears the window title on
+exit (elinks, for some strange reason, sets it to the value of TERM):
+
+ elinks() {
+ STY= `which elinks` $*
+ echo -ne \\033]0\;\\007;
+ }
+
+* What is the proper way to escape characters with #(command)?
+
+When using the #(command) construction to include the output from a command in
+the status line, the command will be parsed twice. First, when it's read by the
+configuration file or the command-prompt parser, and second when the status
+line is being drawn and the command is passed to the shell. For example, to
+echo the string "(test)" to the status line, either single or double quotes
+could be used:
+
+ set -g status-right "#(echo \\\\(test\\\\))"
+ set -g status-right '#(echo \\\(test\\\))'
+
+In both cases, the status-right option will be set to the string "#(echo
+\\(test\\))" and the command executed will be "echo \(test\)".
+
+* tmux uses too much CPU. What do I do?
+
+Automatic window renaming may use a lot of CPU, particularly on slow computers:
+if this is a problem, turn it off with "setw -g automatic-rename off". If this
+doesn't fix it, please report the problem.
+
+$Id: FAQ,v 1.21 2009-03-31 23:17:28 nicm Exp $
diff --git a/tags/TMUX_0_8/GNUmakefile b/tags/TMUX_0_8/GNUmakefile
new file mode 100644
index 00000000..535ac3dd
--- /dev/null
+++ b/tags/TMUX_0_8/GNUmakefile
@@ -0,0 +1,144 @@
+# $Id: GNUmakefile,v 1.82 2009-04-21 20:10:22 nicm Exp $
+
+.PHONY: clean
+
+PROG= tmux
+VERSION= 0.8
+
+DATE= $(shell date +%Y%m%d-%H%M)
+
+#FDEBUG= 1
+
+META?= \002
+
+SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
+ xmalloc.c xmalloc-debug.c input.c input-keys.c \
+ screen.c screen-write.c screen-redraw.c \
+ grid.c grid-view.c \
+ window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
+ key-string.c key-bindings.c resize.c arg.c mode-key.c \
+ layout.c cmd.c cmd-generic.c cmd-string.c cmd-list.c \
+ cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
+ cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
+ cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
+ cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c \
+ cmd-refresh-client.c cmd-kill-window.c cmd-list-clients.c \
+ cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
+ cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
+ cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
+ cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
+ cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \
+ cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
+ cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
+ cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
+ cmd-respawn-window.c cmd-source-file.c cmd-server-info.c \
+ cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c \
+ cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
+ cmd-resize-pane-up.c cmd-resize-pane-down.c cmd-kill-pane.c \
+ cmd-up-pane.c cmd-down-pane.c cmd-choose-window.c cmd-choose-session.c \
+ cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
+ cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-next-layout.c \
+ cmd-rotate-window.c \
+ window-clock.c window-scroll.c window-more.c window-copy.c \
+ window-choose.c \
+ options.c options-cmd.c paste.c colour.c utf8.c clock.c \
+ tty.c tty-term.c tty-keys.c tty-write.c util.c names.c \
+ osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \
+ osdep-darwin.c attributes.c
+
+CC?= gcc
+INCDIRS+= -I. -I-
+CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\"" -DMETA="'${META}'"
+ifdef FDEBUG
+CFLAGS+= -g -ggdb -DDEBUG
+LDFLAGS+= -rdynamic
+LIBS+= -ldl
+endif
+ifeq (${CC},gcc)
+CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
+CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
+CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
+endif
+
+LDFLAGS+=
+LIBS+= -lncurses
+
+PREFIX?= /usr/local
+INSTALLDIR= install -d
+INSTALLBIN= install -g bin -o root -m 555
+INSTALLMAN= install -g bin -o root -m 444
+
+ifeq ($(shell uname),AIX)
+INCDIRS+= -I/usr/local/include/ncurses -Icompat
+SRCS+= compat/vis.c compat/strlcpy.c compat/strlcat.c compat/strtonum.c \
+ compat/fgetln.c compat/asprintf.c compat/daemon.c compat/forkpty-aix.c \
+ compat/getopt_long.c compat/bsd-poll.c
+CFLAGS+= -DNO_TREE_H -DNO_ASPRINTF -DNO_QUEUE_H -DNO_VSYSLOG \
+ -DNO_PROGNAME -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM \
+ -DNO_SETPROCTITLE -DNO_QUEUE_H -DNO_TREE_H -DNO_FORKPTY -DNO_FGETLN \
+ -DBROKEN_GETOPT -DBROKEN_POLL -DNO_PATHS_H
+LDFLAGS+= -L/usr/local/lib
+endif
+
+ifeq ($(shell uname),IRIX64)
+INCDIRS+= -Icompat -I/usr/local/include/ncurses
+SRCS+= compat/strlcpy.c compat/strtonum.c compat/daemon.c \
+ compat/asprintf.c compat/fgetln.c compat/forkpty-irix.c
+CFLAGS+= -DNO_STRLCPY -DNO_STRTONUM -DNO_TREE_H -DNO_SETPROCTITLE \
+ -DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF -DNO_FGETLN \
+ -DBROKEN_VSNPRINTF -D_SGI_SOURCE -std=c99
+LDFLAGS+= -L/usr/local/lib
+LIBS+= -lgen
+endif
+
+ifeq ($(shell uname),SunOS)
+INCDIRS+= -Icompat -I/usr/local/include/ncurses
+SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c \
+ compat/asprintf.c compat/fgetln.c compat/vis.c
+CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
+ -DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF -DNO_FGETLN
+LDFLAGS+= -L/usr/local/lib
+LIBS+= -lsocket -lnsl
+endif
+
+ifeq ($(shell uname),Darwin)
+INCDIRS+= -Icompat
+SRCS+= compat/strtonum.c compat/bsd-poll.c compat/vis.c
+CFLAGS+= -DNO_STRTONUM -DNO_SETRESUID -DNO_SETRESGID -DNO_SETPROCTITLE \
+ -DNO_QUEUE_H -DNO_TREE_H -DBROKEN_POLL
+endif
+
+ifeq ($(shell uname),Linux)
+INCDIRS+= -Icompat
+SRCS+= compat/strlcpy.c compat/strlcat.c compat/strtonum.c \
+ compat/fgetln.c compat/getopt_long.c compat/vis.c
+CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
+ -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM -DNO_SETPROCTITLE \
+ -DNO_QUEUE_H -DNO_TREE_H -DUSE_PTY_H -DNO_FGETLN \
+ -DBROKEN_GETOPT -std=c99
+LIBS+= -lcrypt -lutil
+endif
+
+OBJS= $(patsubst %.c,%.o,$(SRCS))
+
+CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
+
+CPPFLAGS:= ${INCDIRS} ${CPPFLAGS}
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
+
+depend: $(SRCS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SRCS) > .depend
+
+install:
+ $(INSTALLDIR) $(DESTDIR)$(PREFIX)/bin
+ $(INSTALLBIN) $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
+ $(INSTALLDIR) $(DESTDIR)$(PREFIX)/man/man1
+ $(INSTALLMAN) $(PROG).1 $(DESTDIR)$(PREFIX)/man/man1/$(PROG).1
+
+clean:
+ rm -f $(CLEANFILES)
diff --git a/tags/TMUX_0_8/Makefile b/tags/TMUX_0_8/Makefile
new file mode 100644
index 00000000..6fda60bb
--- /dev/null
+++ b/tags/TMUX_0_8/Makefile
@@ -0,0 +1,158 @@
+# $Id: Makefile,v 1.121 2009-04-21 20:10:22 nicm Exp $
+
+.SUFFIXES: .c .o .y .h
+.PHONY: clean update-index.html upload-index.html
+
+PROG= tmux
+VERSION= 0.8
+
+OS!= uname
+REL!= uname -r
+DATE!= date +%Y%m%d-%H%M
+
+#FDEBUG= 1
+
+META?= \002 # C-b
+
+SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
+ xmalloc.c xmalloc-debug.c input.c input-keys.c \
+ screen.c screen-write.c screen-redraw.c \
+ grid.c grid-view.c \
+ window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
+ layout.c key-string.c key-bindings.c resize.c arg.c mode-key.c \
+ cmd.c cmd-generic.c cmd-string.c cmd-list.c \
+ cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
+ cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
+ cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
+ cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c \
+ cmd-refresh-client.c cmd-kill-window.c cmd-list-clients.c \
+ cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
+ cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
+ cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
+ cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
+ cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \
+ cmd-show-window-options.c cmd-command-prompt.c cmd-set-buffer.c \
+ cmd-show-buffer.c cmd-list-buffers.c cmd-delete-buffer.c \
+ cmd-list-commands.c cmd-move-window.c cmd-select-prompt.c \
+ cmd-respawn-window.c cmd-source-file.c cmd-server-info.c \
+ cmd-clock-mode.c cmd-lock-server.c cmd-set-password.c \
+ cmd-save-buffer.c cmd-select-pane.c cmd-split-window.c \
+ cmd-resize-pane-up.c cmd-resize-pane-down.c cmd-kill-pane.c \
+ cmd-up-pane.c cmd-down-pane.c cmd-choose-window.c cmd-choose-session.c \
+ cmd-suspend-client.c cmd-find-window.c cmd-load-buffer.c \
+ cmd-copy-buffer.c cmd-break-pane.c cmd-swap-pane.c cmd-next-layout.c \
+ cmd-rotate-window.c \
+ window-clock.c window-scroll.c window-more.c window-copy.c \
+ window-choose.c \
+ options.c options-cmd.c paste.c colour.c utf8.c clock.c \
+ tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c \
+ osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \
+ osdep-darwin.c osdep-netbsd.c
+
+CC?= c
+INCDIRS+= -I. -I- -I/usr/local/include
+CFLAGS+= -DMETA="'${META}'"
+.ifdef PROFILE
+# Don't use ccache
+CC= /usr/bin/gcc
+CFLAGS+= -pg -DPROFILE -O0
+.endif
+.ifdef FDEBUG
+CFLAGS+= -g -ggdb -DDEBUG
+LDFLAGS+= -Wl,-E
+CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\""
+.else
+CFLAGS+= -DBUILD="\"$(VERSION)\""
+.endif
+#CFLAGS+= -pedantic -std=c99
+CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
+CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
+CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
+CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
+
+PREFIX?= /usr/local
+INSTALLDIR= install -d
+INSTALLBIN= install -g bin -o root -m 555
+INSTALLMAN= install -g bin -o root -m 444
+
+LDFLAGS+= -L/usr/local/lib
+.ifdef PROFILE
+LDFLAGS+= -pg
+.endif
+LIBS+= -lutil -lncurses
+
+# FreeBSD and DragonFly
+.if ${OS} == "FreeBSD" || ${OS} == "DragonFly"
+INCDIRS+= -Icompat
+SRCS+= compat/vis.c
+CFLAGS+= -DUSE_LIBUTIL_H -DNO_QUEUE_H -DNO_TREE_H
+LIBS+= -lcrypt
+.endif
+
+# NetBSD
+.if ${OS} == "NetBSD"
+INCDIRS= -Icompat
+SRCS+= compat/strtonum.c compat/vis.c
+LIBS+= -lcrypt
+CFLAGS+=-DNO_STRTONUM
+.endif
+
+OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
+
+DISTDIR= ${PROG}-${VERSION}
+DISTFILES= *.[chyl] Makefile GNUmakefile *.[1-9] NOTES TODO CHANGES FAQ \
+ `find examples compat -type f -and ! -path '*CVS*'`
+
+CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
+
+CPPFLAGS:= ${INCDIRS} ${CPPFLAGS}
+
+.c.o:
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+
+.y.o:
+ ${YACC} ${.IMPSRC}
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c y.tab.c -o ${.TARGET}
+
+all: ${PROG}
+
+${PROG}: ${OBJS}
+ ${CC} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
+
+depend:
+ mkdep ${CPPFLAGS} ${CFLAGS} ${SRCS:M*.c}
+
+dist: clean
+ grep '^#FDEBUG=' Makefile
+ grep '^#FDEBUG=' GNUmakefile
+ [ "`(grep '^VERSION' Makefile; grep '^VERSION' GNUmakefile)| \
+ uniq -u`" = "" ]
+ tar -zc \
+ -s '/.*/${DISTDIR}\/\0/' \
+ -f ${DISTDIR}.tar.gz ${DISTFILES}
+
+lint:
+ lint -chvx ${CFLAGS:M-D*} ${SRCS:M*.c}
+
+clean:
+ rm -f ${CLEANFILES}
+
+upload-index.html: update-index.html
+ scp index.html images/*.png \
+ nicm,tmux@web.sf.net:/home/groups/t/tm/tmux/htdocs
+ rm -f images/small-*
+
+update-index.html:
+ (cd images && \
+ rm -f small-* && \
+ for i in *.png; do \
+ convert "$$i" -resize 200x150 "small-$$i"; \
+ done \
+ )
+ sed "s/%%VERSION%%/${VERSION}/g" index.html.in >index.html
+
+install: all
+ ${INSTALLDIR} ${DESTDIR}${PREFIX}/bin
+ ${INSTALLBIN} ${PROG} ${DESTDIR}${PREFIX}/bin/
+ ${INSTALLDIR} ${DESTDIR}${PREFIX}/man/man1
+ ${INSTALLMAN} ${PROG}.1 ${DESTDIR}${PREFIX}/man/man1/
diff --git a/tags/TMUX_0_8/NOTES b/tags/TMUX_0_8/NOTES
new file mode 100644
index 00000000..19646322
--- /dev/null
+++ b/tags/TMUX_0_8/NOTES
@@ -0,0 +1,97 @@
+Welcome to tmux!
+
+tmux is a "terminal multiplexer", it enables a number of terminals (or windows)
+to be accessed and controlled from a single terminal. tmux is intended to be a
+simple, modern, BSD-licensed alternative to programs such as GNU screen.
+
+This 0.8 release runs on OpenBSD, FreeBSD, Linux and OS X and may still run on
+Solaris (although it hasn't been tested in a while). It is usable, although
+there remain a number of missing features and some remaining bugs are expected.
+
+If upgrading from 0.5, PLEASE NOTE the following configuration file changes: it
+is now required to pass the -g flag to set-option or set-window-option to set
+global options; remain-by-default and utf8-default are now gone, use global
+window options (set-window-option -g) instead.
+
+tmux consists of a server part and multiple clients. The server is created when
+required and runs continuously unless killed by the user. Clients access the
+server through a socket in /tmp. Multiple sessions may be created on a single
+server and attached to a number of clients. Each session may then have a number
+of windows and windows may be linked to a number of sessions. Commands are
+available to create, rename and destroy windows and sessions; to attach and
+detach sessions from client terminals; to set configuration options; to split
+windows into several simultaneously displayed panes; and to bind and unbind
+command keys (invoked preceded by a prefix key, by default ctrl-b). Please see
+the tmux(1) man page for further information.
+
+The following is a summary of major features implemented in this version:
+
+- Basic multiplexing, window switching, attaching and detaching.
+- Window listing and renaming.
+- Key binding.
+- Handling of client terminal resize.
+- Terminal emulation sufficient to handle most curses applications.
+- A optional status line (enabled by default).
+- Window history and copy and paste.
+- Support for VT100 line drawing characters.
+- A large command set.
+- Vertical window splitting and layout.
+- Automatic server locking on inactivity.
+- A configuration file.
+- UTF-8 support.
+
+And major missing features:
+
+- Proper mouse support.
+- No support for programs changing termios(4) settings or other tty(4) ioctls.
+
+A more extensive, but rough, todo list is included in the TODO file.
+
+tmux also depends on several features of the client terminal (TERM), if these
+are missing it may refuse to run, or not behave correctly. Known working are
+TERM=screen (tmux in screen), xterm, xterm-color and rxvt. Note that TERM=xterm
+does not support colour on OpenBSD. screen ignores this, tmux does not: use
+xterm-color or rxvt for colour.
+
+tmux supports UTF-8. To use it, the utf8 option must be set on each window;
+this may be turned on for all windows by setting it as a global option, see
+tmux(1) and the FAQ file. In addition, when starting tmux or attaching to an
+existing session from a UTF-8-capable terminal, the -u flag must be specified.
+
+A Vim syntax file is available in the examples directory. To install it:
+
+- Drop the file in the syntax directory in your runtimepath (such as
+ ~/.vim/syntax/tmux.vim).
+- Make the filetype recognisable by adding the following to filetype.vim
+ in your runtimepath (~/.vim/filetype.vim):
+
+ augroup filetypedetect
+ au BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
+ augroup END
+
+- Switch on syntax highlighting by adding "syntax enable" to your vimrc file.
+
+For debugging, running tmux with -v or -vv will generate server and client log
+files in the current directory.
+
+The CVS HEAD version of tmux often has additional features from the release
+versions; if interested, testing it is encouraged. It can be obtained by
+anonymous CVS from SourceForge:
+
+ $ cvs -d:pserver:anoncvs@tmux.cvs.sf.net:/cvsroot/tmux co tmux
+
+If running CVS HEAD, please note it is development code and there may be bugs
+and undocumented features; please read the CHANGES file for information.
+
+tmux mailing lists are available; visit:
+
+ https://sourceforge.net/mail/?group_id=200378
+
+Bug reports, feature suggestions and especially code contributions are most
+welcome. Please send by email to:
+
+ nicm@users.sf.net
+
+-- Nicholas Marriott <nicm@users.sf.net>
+
+$Id: NOTES,v 1.45 2009-04-21 20:06:12 nicm Exp $
diff --git a/tags/TMUX_0_8/TODO b/tags/TMUX_0_8/TODO
new file mode 100644
index 00000000..ceb3b1cf
--- /dev/null
+++ b/tags/TMUX_0_8/TODO
@@ -0,0 +1,103 @@
+- line mode/char-at-a-time mode a la telnet?
+- handle ioctl/termios stuff on window sockets
+- figure out once and for all what is going on with backspace and del
+ backspace should be translated per the termios setting.
+ del passed through?
+- window creation/idle time
+- profile/optimise, particularly (i suspect) input.c
+- could use bsearch all over the place or get rid of smaller tables (clientmsg)
+- better errors when creating new windows/sessions (how?)
+- Implicitly add exec to the commands for new windows (switch to disable it)
+- it would be nice to have multichar commands so you could have C-b K K for
+ kill-window to limit accidental presses
+- commands:
+ extend list-clients to list clients attached to a session (-a for all?)
+ bring back detach-session to detach all clients on a session?
+ clone-session command to link all windows to a new session
+- allow fnmatch for -c, so that you can, eg, detach all clients
+- bind non prefix keys
+- garbage collect window history (100 lines at a time?) if it hasn't been used
+ in $x time (need window creation/use times)
+- lift SHRT_MAX limits for history
+- audit copy/scroll and other modes for problems with very small windows
+- split clients into three RB trees by fd: attached/unattached/dead?
+ or tailqs? what would be fastest per-char?
+- c/p is still borken in some ways
+- better mode features: search, back word, forward word, etc
+- flags to centre screen in window
+- better terminal emulation (identify, insert mode, some other bits)
+- when resizing, use history
+- audit for leftover/unused code
+- activity/bell should be per-window not per-link? what if it is cur win in
+ session not being watched?
+- tidy up window modes
+- next prev word etc in command prompt; also ^K
+- many more info() displays for various things
+- vi half page scroll
+- backspace should perhaps wrap backwards over newlines which were not moved
+ down by a newline: screen and the OS X terminal does this but xterm and most
+ others do not. this might be hard: a flag for each grid line (top bit of size
+ maybe)? a single flag is insufficient as can't then tell when to /stop/
+ unwrapping
+- input.c is too complicated. simplify?
+- use a better termcap internally instead of screen, perhaps xterm
+- a command to display the status line briefly when it is turned off
+- FAQ "Can I have some examples of cool things I can do with tmux?" -- linkw,
+ more??
+- kill all but current pane
+- fix rxvt cursor fg issue (text under cursor can have non-white fg)
+- key handling sucks a bit and needs to be reworked
+- some people find first window being 0 rather than 1 is awkward on the
+ keyboard. what about a new-window-index option that sets the base at which
+ tmux starts numbering new windows, then they can do: set -g new-window-index
+ 1; bind 0 selectw -t:10
+- some way to change status line colours based on something? command?
+- client sx/sy should be in tty, then can let the terminal wrap at edge
+ to allow xterm to pick up it should be one line for its c/p
+- should be able to move to a hidden pane and it would be moved into view. pane
+ number in status line/top-right would be cool for this
+- command to run something without a window at all - output to
+ window-more. what for? isnt this the same as doing it w/ splitw/neww now?
+- command to purge window history? or apply history-limit changes?
+- clone session command
+- make command sequences more usable: don't require space around ;, handle
+ errors better
+- would be nice if tmux could be the shell (tmux attach, but hard link to tmux
+ binary as "tmuxsh" or wrapper script?) -- problems with tty dev permissions
+- support other mouse modes (highlight etc) and use it in copy mode
+- set-remain-on-exit is a bit of a hack, some way to do it generically?
+- set-option should be set-session-option and should be overall global options
+ for stuff like mode keys?
+- a confirm-before command which asks "Are you sure? (y/n)" before executing
+ command, eg bind-key "&" confirm-before "kill-window"
+- might be nice if attach-session behaved like switch-client inside an
+ existing client
+- key to switch to copy mode from scroll mode
+- attach should have a flag to create session if it doesn't exist
+- clear window title on exit
+- better support for stupid margin terminals. strcmp for cons25 sucks, how can
+ these be autodetected?
+- refer to windows by name etc (duplicates? fnmatch?)
+- the output code (tty.c) could do with optimisation depending on term
+ capibilities
+- resize-pane-up/down should be resize-pane -U/-D. ditto up-pane/down-pane
+ should be select-pane -U/-D
+- layout/split stuff:
+ horiz split command, and similar resizing commands as for vert split
+ display the layout in a readable format somewhere
+ previous-layout command
+ select-layout command
+ make manual layout a bit less of a hack and make it handle a grid
+ should the layout be a window option???
+ more layouts
+ better resizing of shells when changing layout
+ find and fix bug with clear screen after horiz split
+ speed improvements? -- still too slow over ssh!
+ hardcoded 81 for left-vertical is nasty
+- test bug sshing from freebsd console (tom iirc?)
+- fix build on solaris 10
+- rotate-window has redraw bugs... :-/
+
+(hopefully) for 0.8, in no particular order:
+- nothing!
+
diff --git a/tags/TMUX_0_8/arg.c b/tags/TMUX_0_8/arg.c
new file mode 100644
index 00000000..a1508528
--- /dev/null
+++ b/tags/TMUX_0_8/arg.c
@@ -0,0 +1,194 @@
+/* $Id: arg.c,v 1.5 2008-08-28 17:45:25 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <fnmatch.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tmux.h"
+
+struct client *arg_lookup_client(const char *);
+struct session *arg_lookup_session(const char *);
+
+struct client *
+arg_lookup_client(const char *name)
+{
+ struct client *c;
+ u_int i;
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && strcmp(name, c->tty.path) == 0)
+ return (c);
+ }
+
+ return (NULL);
+}
+
+struct session *
+arg_lookup_session(const char *name)
+{
+ struct session *s, *newest = NULL;
+ struct timeval *tv;
+ u_int i;
+
+ tv = NULL;
+ for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
+ s = ARRAY_ITEM(&sessions, i);
+ if (s == NULL || fnmatch(name, s->name, 0) != 0)
+ continue;
+
+ if (tv == NULL || timercmp(&s->tv, tv, >)) {
+ newest = s;
+ tv = &s->tv;
+ }
+ }
+
+ return (newest);
+}
+
+struct client *
+arg_parse_client(const char *arg)
+{
+ struct client *c;
+ char *arg2;
+ size_t n;
+
+ if (arg != NULL && (arg[0] != ':' || arg[1] != '\0')) {
+ arg2 = xstrdup(arg);
+
+ /* Trim a trailing : if any from the argument. */
+ n = strlen(arg2);
+ if (arg2[n - 1] == ':')
+ arg2[n - 1] = '\0';
+
+ /* Try and look up the client name. */
+ c = arg_lookup_client(arg2);
+ xfree(arg2);
+ return (c);
+ }
+
+ return (NULL);
+}
+
+struct session *
+arg_parse_session(const char *arg)
+{
+ struct session *s;
+ struct client *c;
+ char *arg2;
+ size_t n;
+
+ if (arg != NULL && (arg[0] != ':' || arg[1] != '\0')) {
+ arg2 = xstrdup(arg);
+
+ /* Trim a trailing : if any from the argument. */
+ n = strlen(arg2);
+ if (arg2[n - 1] == ':')
+ arg2[n - 1] = '\0';
+
+ /* See if the argument matches a session. */
+ if ((s = arg_lookup_session(arg2)) != NULL) {
+ xfree(arg2);
+ return (s);
+ }
+
+ /* If not try a client. */
+ if ((c = arg_lookup_client(arg2)) != NULL) {
+ xfree(arg2);
+ return (c->session);
+ }
+
+ xfree(arg2);
+ }
+
+ return (NULL);
+}
+
+int
+arg_parse_window(const char *arg, struct session **s, int *idx)
+{
+ char *arg2, *ptr;
+ const char *errstr;
+
+ *idx = -1;
+
+ /* Handle no argument or a single :. */
+ if (arg == NULL || (arg[0] == ':' && arg[1] == '\0')) {
+ *s = arg_parse_session(NULL);
+ return (0);
+ }
+
+ /* Find the separator if any. */
+ arg2 = xstrdup(arg);
+ ptr = strrchr(arg2, ':');
+
+ /*
+ * If it is first, this means no session name, so use current session
+ * and try to convert the rest as index.
+ */
+ if (ptr == arg2) {
+ *idx = strtonum(ptr + 1, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xfree(arg2);
+ return (1);
+ }
+
+ xfree(arg2);
+ *s = arg_parse_session(NULL);
+ return (0);
+ }
+
+ /* If missing, try as an index, else look up immediately. */
+ if (ptr == NULL) {
+ *idx = strtonum(arg2, 0, INT_MAX, &errstr);
+ if (errstr == NULL) {
+ /* This is good as an index; use current session. */
+ xfree(arg2);
+ *s = arg_parse_session(NULL);
+ return (0);
+ }
+
+ *idx = -1;
+ goto lookup;
+ }
+
+ /* If last, strip it and look up as a session. */
+ if (ptr[1] == '\0') {
+ *ptr = '\0';
+ goto lookup;
+ }
+
+ /* Present but not first and not last. Break and convert both. */
+ *ptr = '\0';
+ *idx = strtonum(ptr + 1, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xfree(arg2);
+ return (1);
+ }
+
+lookup:
+ /* Look up as session. */
+ *s = arg_parse_session(arg2);
+ xfree(arg2);
+ if (*s == NULL)
+ return (1);
+ return (0);
+}
diff --git a/tags/TMUX_0_8/array.h b/tags/TMUX_0_8/array.h
new file mode 100644
index 00000000..3d96d81f
--- /dev/null
+++ b/tags/TMUX_0_8/array.h
@@ -0,0 +1,119 @@
+/* $Id: array.h,v 1.7 2008-09-29 16:58:02 nicm Exp $ */
+
+/*
+ * Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef ARRAY_H
+#define ARRAY_H
+
+#define ARRAY_DECL(n, c) \
+ struct n { \
+ c *list; \
+ u_int num; \
+ size_t space; \
+ }
+
+#define ARRAY_ITEM(a, i) ((a)->list[i])
+#define ARRAY_ITEMSIZE(a) (sizeof *(a)->list)
+#define ARRAY_INITIALSPACE(a) (10 * ARRAY_ITEMSIZE(a))
+
+#define ARRAY_ENSURE(a, n) do { \
+ if (UINT_MAX - (n) < (a)->num) \
+ fatalx("number too big"); \
+ if (SIZE_MAX / ((a)->num + (n)) < ARRAY_ITEMSIZE(a)) \
+ fatalx("size too big"); \
+ if ((a)->space == 0) { \
+ (a)->space = ARRAY_INITIALSPACE(a); \
+ (a)->list = xrealloc((a)->list, 1, (a)->space); \
+ } \
+ while ((a)->space <= ((a)->num + (n)) * ARRAY_ITEMSIZE(a)) { \
+ (a)->list = xrealloc((a)->list, 2, (a)->space); \
+ (a)->space *= 2; \
+ } \
+} while (0)
+
+#define ARRAY_EMPTY(a) ((a) == NULL || (a)->num == 0)
+#define ARRAY_LENGTH(a) ((a)->num)
+#define ARRAY_DATA(a) ((a)->list)
+
+#define ARRAY_FIRST(a) ARRAY_ITEM(a, 0)
+#define ARRAY_LAST(a) ARRAY_ITEM(a, (a)->num - 1)
+
+#define ARRAY_INIT(a) do { \
+ (a)->num = 0; \
+ (a)->list = NULL; \
+ (a)->space = 0; \
+} while (0)
+#define ARRAY_CLEAR(a) do { \
+ (a)->num = 0; \
+} while (0)
+
+#define ARRAY_SET(a, i, s) do { \
+ (a)->list[i] = s; \
+} while (0)
+
+#define ARRAY_ADD(a, s) do { \
+ ARRAY_ENSURE(a, 1); \
+ (a)->list[(a)->num] = s; \
+ (a)->num++; \
+} while (0)
+#define ARRAY_INSERT(a, i, s) do { \
+ ARRAY_ENSURE(a, 1); \
+ if ((i) < (a)->num) { \
+ memmove((a)->list + (i) + 1, (a)->list + (i), \
+ ARRAY_ITEMSIZE(a) * ((a)->num - (i))); \
+ } \
+ (a)->list[i] = s; \
+ (a)->num++; \
+} while (0)
+#define ARRAY_REMOVE(a, i) do { \
+ if ((i) < (a)->num - 1) { \
+ memmove((a)->list + (i), (a)->list + (i) + 1, \
+ ARRAY_ITEMSIZE(a) * ((a)->num - (i) - 1)); \
+ } \
+ (a)->num--; \
+ if ((a)->num == 0) \
+ ARRAY_FREE(a); \
+} while (0)
+
+#define ARRAY_EXPAND(a, n) do { \
+ ARRAY_ENSURE(a, n); \
+ (a)->num += n; \
+} while (0)
+#define ARRAY_TRUNC(a, n) do { \
+ if ((a)->num > n) \
+ (a)->num -= n; \
+ else \
+ ARRAY_FREE(a); \
+} while (0)
+
+#define ARRAY_CONCAT(a, b) do { \
+ ARRAY_ENSURE(a, (b)->num); \
+ memcpy((a)->list + (a)->num, (b)->list, (b)->num * ARRAY_ITEMSIZE(a)) \
+ (a)->num += (b)->num; \
+} while (0)
+
+#define ARRAY_FREE(a) do { \
+ if ((a)->list != NULL) \
+ xfree((a)->list); \
+ ARRAY_INIT(a); \
+} while (0)
+#define ARRAY_FREEALL(a) do { \
+ ARRAY_FREE(a); \
+ xfree(a); \
+} while (0)
+
+#endif
diff --git a/tags/TMUX_0_8/attributes.c b/tags/TMUX_0_8/attributes.c
new file mode 100644
index 00000000..24744481
--- /dev/null
+++ b/tags/TMUX_0_8/attributes.c
@@ -0,0 +1,92 @@
+/* $Id: attributes.c,v 1.1 2009-01-27 20:22:33 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+const char *
+attributes_tostring(u_char ch)
+{
+ static char buf[128];
+
+ if (ch == 0)
+ return ("default");
+
+ buf[0] = '\0';
+ if (ch & GRID_ATTR_BRIGHT)
+ strlcat(buf, "bright,", sizeof (buf));
+ if (ch & GRID_ATTR_DIM)
+ strlcat(buf, "dim,", sizeof (buf));
+ if (ch & GRID_ATTR_UNDERSCORE)
+ strlcat(buf, "underscore,", sizeof (buf));
+ if (ch & GRID_ATTR_BLINK)
+ strlcat(buf, "blink,", sizeof (buf));
+ if (ch & GRID_ATTR_REVERSE)
+ strlcat(buf, "reverse,", sizeof (buf));
+ if (ch & GRID_ATTR_HIDDEN)
+ strlcat(buf, "hidden,", sizeof (buf));
+ if (ch & GRID_ATTR_ITALICS)
+ strlcat(buf, "italics,", sizeof (buf));
+ *(strrchr(buf, ',')) = '\0';
+
+ return (buf);
+}
+
+int
+attributes_fromstring(const char *str)
+{
+ const char delimiters[] = " ,|";
+ u_char ch;
+ size_t end;
+
+ if (*str == '\0' || strcspn(str, delimiters) == 0)
+ return (-1);
+ if (strchr(delimiters, str[strlen(str) - 1]) != NULL)
+ return (-1);
+
+ if (strcasecmp(str, "default") == 0)
+ return (0);
+
+ ch = 0;
+ do {
+ end = strcspn(str, delimiters);
+ if ((end == 6 && strncasecmp(str, "bright", end) == 0) ||
+ (end == 4 && strncasecmp(str, "bold", end) == 0))
+ ch |= GRID_ATTR_BRIGHT;
+ else if (end == 3 && strncasecmp(str, "dim", end) == 0)
+ ch |= GRID_ATTR_DIM;
+ else if (end == 10 && strncasecmp(str, "underscore", end) == 0)
+ ch |= GRID_ATTR_UNDERSCORE;
+ else if (end == 5 && strncasecmp(str, "blink", end) == 0)
+ ch |= GRID_ATTR_BLINK;
+ else if (end == 7 && strncasecmp(str, "reverse", end) == 0)
+ ch |= GRID_ATTR_REVERSE;
+ else if (end == 6 && strncasecmp(str, "hidden", end) == 0)
+ ch |= GRID_ATTR_HIDDEN;
+ else if (end == 7 && strncasecmp(str, "italics", end) == 0)
+ ch |= GRID_ATTR_ITALICS;
+ else
+ return (-1);
+ str += end + strspn(str + end, delimiters);
+ } while (*str != '\0');
+
+ return (ch);
+}
diff --git a/tags/TMUX_0_8/buffer-poll.c b/tags/TMUX_0_8/buffer-poll.c
new file mode 100644
index 00000000..efd294c2
--- /dev/null
+++ b/tags/TMUX_0_8/buffer-poll.c
@@ -0,0 +1,99 @@
+/* $Id: buffer-poll.c,v 1.10 2008-09-09 22:16:36 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/* Set up pollfd for buffers. */
+void
+buffer_set(
+ struct pollfd *pfd, int fd, unused struct buffer *in, struct buffer *out)
+{
+ pfd->fd = fd;
+ pfd->events = POLLIN;
+ if (BUFFER_USED(out) > 0)
+ pfd->events |= POLLOUT;
+}
+
+/* Fill buffers from socket based on poll results. */
+int
+buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
+{
+ ssize_t n;
+
+#if 0
+ log_debug("buffer_poll (%ld): fd=%d, revents=%d; out=%zu in=%zu",
+ (long) getpid(),
+ pfd->fd, pfd->revents, BUFFER_USED(out), BUFFER_USED(in));
+#endif
+
+#ifndef BROKEN_POLL
+ if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
+ return (-1);
+#endif
+ if (pfd->revents & POLLIN) {
+ buffer_ensure(in, BUFSIZ);
+ n = read(pfd->fd, BUFFER_IN(in), BUFFER_FREE(in));
+#if 0
+ log_debug("buffer_poll: fd=%d, read=%zd", pfd->fd, n);
+#endif
+ if (n == 0)
+ return (-1);
+ if (n == -1) {
+ if (errno != EINTR && errno != EAGAIN)
+ return (-1);
+ } else
+ buffer_add(in, n);
+ }
+ if (BUFFER_USED(out) > 0 && pfd->revents & POLLOUT) {
+ n = write(pfd->fd, BUFFER_OUT(out), BUFFER_USED(out));
+#if 0
+ log_debug("buffer_poll: fd=%d, write=%zd", pfd->fd, n);
+#endif
+ if (n == -1) {
+ if (errno != EINTR && errno != EAGAIN)
+ return (-1);
+ } else
+ buffer_remove(out, n);
+ }
+ return (0);
+}
+
+/* Flush buffer output to socket. */
+void
+buffer_flush(int fd, struct buffer *in, struct buffer *out)
+{
+ struct pollfd pfd;
+
+ while (BUFFER_USED(out) > 0) {
+ buffer_set(&pfd, fd, in, out);
+
+ if (poll(&pfd, 1, INFTIM) == -1) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ fatal("poll failed");
+ }
+
+ if (buffer_poll(&pfd, in, out) != 0)
+ break;
+ }
+}
diff --git a/tags/TMUX_0_8/buffer.c b/tags/TMUX_0_8/buffer.c
new file mode 100644
index 00000000..6dd3e3ee
--- /dev/null
+++ b/tags/TMUX_0_8/buffer.c
@@ -0,0 +1,227 @@
+/* $Id: buffer.c,v 1.5 2008-08-07 20:20:52 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+/* Create a buffer. */
+struct buffer *
+buffer_create(size_t size)
+{
+ struct buffer *b;
+
+ if (size == 0)
+ fatalx("zero size");
+
+ b = xcalloc(1, sizeof *b);
+
+ b->base = xmalloc(size);
+ b->space = size;
+
+ return (b);
+}
+
+/* Destroy a buffer. */
+void
+buffer_destroy(struct buffer *b)
+{
+ xfree(b->base);
+ xfree(b);
+}
+
+/* Empty a buffer. */
+void
+buffer_clear(struct buffer *b)
+{
+ b->size = 0;
+ b->off = 0;
+}
+
+/* Ensure free space for size in buffer. */
+void
+buffer_ensure(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+
+ if (BUFFER_FREE(b) >= size)
+ return;
+
+ if (b->off > 0) {
+ if (b->size > 0)
+ memmove(b->base, b->base + b->off, b->size);
+ b->off = 0;
+ }
+
+ if (SIZE_MAX - b->size < size)
+ fatalx("size too big");
+ while (b->space < b->size + size) {
+ b->base = xrealloc(b->base, 2, b->space);
+ b->space *= 2;
+ }
+}
+
+/* Adjust buffer after data appended. */
+void
+buffer_add(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->space - b->size)
+ fatalx("overflow");
+
+ b->size += size;
+}
+
+/* Reverse buffer add. */
+void
+buffer_reverse_add(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("underflow");
+
+ b->size -= size;
+}
+
+/* Adjust buffer after data removed. */
+void
+buffer_remove(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("underflow");
+
+ b->size -= size;
+ b->off += size;
+}
+
+/* Reverse buffer remove. */
+void
+buffer_reverse_remove(struct buffer *b, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->off)
+ fatalx("overflow");
+
+ b->size += size;
+ b->off -= size;
+}
+
+/* Insert a section into the buffer. */
+void
+buffer_insert_range(struct buffer *b, size_t base, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (base > b->size)
+ fatalx("range outside buffer");
+
+ buffer_ensure(b, size);
+ memmove(b->base + b->off + base + size,
+ b->base + b->off + base, b->size - base);
+ b->size += size;
+}
+
+/* Delete a section from the buffer. */
+void
+buffer_delete_range(struct buffer *b, size_t base, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("size too big");
+ if (base + size > b->size)
+ fatalx("range outside buffer");
+
+ memmove(b->base + b->off + base,
+ b->base + b->off + base + size, b->size - base - size);
+ b->size -= size;
+}
+
+/* Copy data into a buffer. */
+void
+buffer_write(struct buffer *b, const void *data, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+
+ buffer_ensure(b, size);
+ memcpy(BUFFER_IN(b), data, size);
+ buffer_add(b, size);
+}
+
+/* Copy data out of a buffer. */
+void
+buffer_read(struct buffer *b, void *data, size_t size)
+{
+ if (size == 0)
+ fatalx("zero size");
+ if (size > b->size)
+ fatalx("underflow");
+
+ memcpy(data, BUFFER_OUT(b), size);
+ buffer_remove(b, size);
+}
+
+/* Store an 8-bit value. */
+void
+buffer_write8(struct buffer *b, uint8_t n)
+{
+ buffer_ensure(b, 1);
+ BUFFER_IN(b)[0] = n;
+ buffer_add(b, 1);
+}
+
+/* Store a 16-bit value. */
+void
+buffer_write16(struct buffer *b, uint16_t n)
+{
+ buffer_ensure(b, 2);
+ BUFFER_IN(b)[0] = n & 0xff;
+ BUFFER_IN(b)[1] = n >> 8;
+ buffer_add(b, 2);
+}
+
+/* Extract an 8-bit value. */
+uint8_t
+buffer_read8(struct buffer *b)
+{
+ uint8_t n;
+
+ n = BUFFER_OUT(b)[0];
+ buffer_remove(b, 1);
+ return (n);
+}
+
+/* Extract a 16-bit value. */
+uint16_t
+buffer_read16(struct buffer *b)
+{
+ uint16_t n;
+
+ n = BUFFER_OUT(b)[0] | (BUFFER_OUT(b)[1] << 8);
+ buffer_remove(b, 2);
+ return (n);
+}
diff --git a/tags/TMUX_0_8/cfg.c b/tags/TMUX_0_8/cfg.c
new file mode 100644
index 00000000..2a45c393
--- /dev/null
+++ b/tags/TMUX_0_8/cfg.c
@@ -0,0 +1,121 @@
+/* $Id: cfg.c,v 1.15 2009-03-31 22:23:43 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Config file parser. Pretty quick and simple, each line is parsed into a
+ * argv array and executed as a command.
+ */
+
+char *cfg_string(FILE *, char, int);
+void printflike2 cfg_print(struct cmd_ctx *, const char *, ...);
+void printflike2 cfg_error(struct cmd_ctx *, const char *, ...);
+
+char *cfg_cause;
+
+void printflike2
+cfg_print(unused struct cmd_ctx *ctx, unused const char *fmt, ...)
+{
+}
+
+void printflike2
+cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ xvasprintf(&cfg_cause, fmt, ap);
+ va_end(ap);
+}
+
+int
+load_cfg(const char *path, char **cause)
+{
+ FILE *f;
+ u_int n;
+ char *buf, *line, *ptr;
+ size_t len;
+ struct cmd_list *cmdlist;
+ struct cmd_ctx ctx;
+
+ if ((f = fopen(path, "rb")) == NULL) {
+ xasprintf(cause, "%s: %s", path, strerror(errno));
+ return (1);
+ }
+ n = 0;
+
+ line = NULL;
+ while ((buf = fgetln(f, &len))) {
+ if (buf[len - 1] == '\n')
+ buf[len - 1] = '\0';
+ else {
+ line = xrealloc(line, 1, len + 1);
+ memcpy(line, buf, len);
+ line[len] = '\0';
+ buf = line;
+ }
+ n++;
+
+ if (cmd_string_parse(buf, &cmdlist, cause) != 0) {
+ if (*cause == NULL)
+ continue;
+ goto error;
+ }
+ if (cmdlist == NULL)
+ continue;
+ cfg_cause = NULL;
+
+ ctx.msgdata = NULL;
+ ctx.cursession = NULL;
+ ctx.curclient = NULL;
+
+ ctx.error = cfg_error;
+ ctx.print = cfg_print;
+ ctx.info = cfg_print;
+
+ ctx.cmdclient = NULL;
+
+ cfg_cause = NULL;
+ cmd_list_exec(cmdlist, &ctx);
+ cmd_list_free(cmdlist);
+ if (cfg_cause != NULL) {
+ *cause = cfg_cause;
+ goto error;
+ }
+ }
+ if (line != NULL)
+ xfree(line);
+ fclose(f);
+
+ return (0);
+
+error:
+ fclose(f);
+
+ xasprintf(&ptr, "%s: %s at line %u", path, *cause, n);
+ xfree(*cause);
+ *cause = ptr;
+ return (1);
+}
diff --git a/tags/TMUX_0_8/client-fn.c b/tags/TMUX_0_8/client-fn.c
new file mode 100644
index 00000000..2e3ca11b
--- /dev/null
+++ b/tags/TMUX_0_8/client-fn.c
@@ -0,0 +1,92 @@
+/* $Id: client-fn.c,v 1.6 2009-03-04 17:24:07 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "tmux.h"
+
+void
+client_fill_session(struct msg_command_data *data)
+{
+ char *env, *ptr1, *ptr2, buf[256];
+ size_t len;
+ const char *errstr;
+ long long ll;
+
+ data->pid = -1;
+ if ((env = getenv("TMUX")) == NULL)
+ return;
+
+ if ((ptr2 = strrchr(env, ',')) == NULL || ptr2 == env)
+ return;
+ for (ptr1 = ptr2 - 1; ptr1 > env && *ptr1 != ','; ptr1--)
+ ;
+ if (*ptr1 != ',')
+ return;
+ ptr1++;
+ ptr2++;
+
+ len = ptr2 - ptr1 - 1;
+ if (len > (sizeof buf) - 1)
+ return;
+ memcpy(buf, ptr1, len);
+ buf[len] = '\0';
+
+ ll = strtonum(buf, 0, LONG_MAX, &errstr);
+ if (errstr != NULL)
+ return;
+ data->pid = ll;
+
+ ll = strtonum(ptr2, 0, UINT_MAX, &errstr);
+ if (errstr != NULL)
+ return;
+ data->idx = ll;
+}
+
+void
+client_write_server(
+ struct client_ctx *cctx, enum hdrtype type, void *buf, size_t len)
+{
+ struct hdr hdr;
+
+ hdr.type = type;
+ hdr.size = len;
+ buffer_write(cctx->srv_out, &hdr, sizeof hdr);
+
+ if (buf != NULL && len > 0)
+ buffer_write(cctx->srv_out, buf, len);
+}
+
+void
+client_write_server2(struct client_ctx *cctx,
+ enum hdrtype type, void *buf1, size_t len1, void *buf2, size_t len2)
+{
+ struct hdr hdr;
+
+ hdr.type = type;
+ hdr.size = len1 + len2;
+ buffer_write(cctx->srv_out, &hdr, sizeof hdr);
+
+ if (buf1 != NULL && len1 > 0)
+ buffer_write(cctx->srv_out, buf1, len1);
+ if (buf2 != NULL && len2 > 0)
+ buffer_write(cctx->srv_out, buf2, len2);
+}
diff --git a/tags/TMUX_0_8/client-msg.c b/tags/TMUX_0_8/client-msg.c
new file mode 100644
index 00000000..182b26f2
--- /dev/null
+++ b/tags/TMUX_0_8/client-msg.c
@@ -0,0 +1,159 @@
+/* $Id: client-msg.c,v 1.18 2009-01-21 22:47:31 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+int client_msg_fn_detach(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_error(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_shutdown(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_exit(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_exited(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_suspend(struct hdr *, struct client_ctx *, char **);
+
+struct client_msg {
+ enum hdrtype type;
+ int (*fn)(struct hdr *, struct client_ctx *, char **);
+};
+struct client_msg client_msg_table[] = {
+ { MSG_DETACH, client_msg_fn_detach },
+ { MSG_ERROR, client_msg_fn_error },
+ { MSG_EXIT, client_msg_fn_exit },
+ { MSG_EXITED, client_msg_fn_exited },
+ { MSG_SHUTDOWN, client_msg_fn_shutdown },
+ { MSG_SUSPEND, client_msg_fn_suspend },
+};
+
+int
+client_msg_dispatch(struct client_ctx *cctx, char **error)
+{
+ struct hdr hdr;
+ struct client_msg *msg;
+ u_int i;
+
+ if (BUFFER_USED(cctx->srv_in) < sizeof hdr)
+ return (1);
+ memcpy(&hdr, BUFFER_OUT(cctx->srv_in), sizeof hdr);
+ if (BUFFER_USED(cctx->srv_in) < (sizeof hdr) + hdr.size)
+ return (1);
+ buffer_remove(cctx->srv_in, sizeof hdr);
+
+ for (i = 0; i < nitems(client_msg_table); i++) {
+ msg = client_msg_table + i;
+ if (msg->type == hdr.type) {
+ if (msg->fn(&hdr, cctx, error) != 0)
+ return (-1);
+ return (0);
+ }
+ }
+ fatalx("unexpected message");
+}
+
+int
+client_msg_fn_error(struct hdr *hdr, struct client_ctx *cctx, char **error)
+{
+ if (hdr->size > SIZE_MAX - 1)
+ fatalx("bad MSG_ERROR size");
+
+ *error = xmalloc(hdr->size + 1);
+ buffer_read(cctx->srv_in, *error, hdr->size);
+ (*error)[hdr->size] = '\0';
+
+ return (-1);
+}
+
+int
+client_msg_fn_detach(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_DETACH size");
+
+ client_write_server(cctx, MSG_EXITING, NULL, 0);
+ cctx->flags |= CCTX_DETACH;
+
+ return (0);
+}
+
+int
+client_msg_fn_shutdown(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_SHUTDOWN size");
+
+ client_write_server(cctx, MSG_EXITING, NULL, 0);
+ cctx->flags |= CCTX_SHUTDOWN;
+
+ return (0);
+}
+
+int
+client_msg_fn_exit(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_EXIT size");
+
+ client_write_server(cctx, MSG_EXITING, NULL, 0);
+ cctx->flags |= CCTX_EXIT;
+
+ return (0);
+}
+
+int
+client_msg_fn_exited(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_EXITED size");
+
+ return (-1);
+}
+
+int
+client_msg_fn_suspend(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ struct sigaction act;
+
+ if (hdr->size != 0)
+ fatalx("bad MSG_SUSPEND size");
+
+ memset(&act, 0, sizeof act);
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_RESTART;
+
+ act.sa_handler = SIG_DFL;
+ if (sigaction(SIGTSTP, &act, NULL) != 0)
+ fatal("sigaction failed");
+
+ act.sa_handler = sighandler;
+ if (sigaction(SIGCONT, &act, NULL) != 0)
+ fatal("sigaction failed");
+
+ kill(getpid(), SIGTSTP);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/client.c b/tags/TMUX_0_8/client.c
new file mode 100644
index 00000000..15c29349
--- /dev/null
+++ b/tags/TMUX_0_8/client.c
@@ -0,0 +1,228 @@
+/* $Id: client.c,v 1.46 2009-03-31 22:20:42 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+void client_handle_winch(struct client_ctx *);
+
+int
+client_init(char *path, struct client_ctx *cctx, int start_server, int flags)
+{
+ struct sockaddr_un sa;
+ struct stat sb;
+ struct msg_identify_data data;
+ struct winsize ws;
+ size_t size;
+ int mode;
+ struct buffer *b;
+ char *name;
+
+ if (lstat(path, &sb) != 0) {
+ if (start_server && errno == ENOENT) {
+ if ((cctx->srv_fd = server_start(path)) == -1)
+ goto start_failed;
+ goto server_started;
+ }
+ goto not_found;
+ }
+ if (!S_ISSOCK(sb.st_mode)) {
+ errno = ENOTSOCK;
+ goto not_found;
+ }
+
+ memset(&sa, 0, sizeof sa);
+ sa.sun_family = AF_UNIX;
+ size = strlcpy(sa.sun_path, path, sizeof sa.sun_path);
+ if (size >= sizeof sa.sun_path) {
+ errno = ENAMETOOLONG;
+ goto not_found;
+ }
+
+ if ((cctx->srv_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
+ fatal("socket");
+
+ if (connect(
+ cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) {
+ if (errno == ECONNREFUSED) {
+ if (unlink(path) != 0 || !start_server)
+ goto not_found;
+ if ((cctx->srv_fd = server_start(path)) == -1)
+ goto start_failed;
+ goto server_started;
+ }
+ goto not_found;
+ }
+
+server_started:
+ if ((mode = fcntl(cctx->srv_fd, F_GETFL)) == -1)
+ fatal("fcntl failed");
+ if (fcntl(cctx->srv_fd, F_SETFL, mode|O_NONBLOCK) == -1)
+ fatal("fcntl failed");
+ cctx->srv_in = buffer_create(BUFSIZ);
+ cctx->srv_out = buffer_create(BUFSIZ);
+
+ if (isatty(STDIN_FILENO)) {
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
+ fatal("ioctl(TIOCGWINSZ)");
+ data.version = PROTOCOL_VERSION;
+ data.flags = flags;
+ data.sx = ws.ws_col;
+ data.sy = ws.ws_row;
+ *data.tty = '\0';
+ if (getcwd(data.cwd, sizeof data.cwd) == NULL)
+ *data.cwd = '\0';
+
+ if ((name = ttyname(STDIN_FILENO)) == NULL)
+ fatal("ttyname failed");
+ if (strlcpy(data.tty, name, sizeof data.tty) >= sizeof data.tty)
+ fatalx("ttyname failed");
+
+ b = buffer_create(BUFSIZ);
+ cmd_send_string(b, getenv("TERM"));
+ client_write_server2(cctx, MSG_IDENTIFY,
+ &data, sizeof data, BUFFER_OUT(b), BUFFER_USED(b));
+ buffer_destroy(b);
+ }
+
+ return (0);
+
+start_failed:
+ log_warnx("server failed to start");
+ return (1);
+
+not_found:
+ log_warn("server not found");
+ return (1);
+}
+
+int
+client_main(struct client_ctx *cctx)
+{
+ struct pollfd pfd;
+ char *error;
+ int xtimeout; /* Yay for ncurses namespace! */
+
+ siginit();
+
+ logfile("client");
+#ifndef NO_SETPROCTITLE
+ setproctitle("client");
+#endif
+
+ error = NULL;
+ xtimeout = INFTIM;
+ while (!sigterm) {
+ if (sigchld) {
+ waitpid(WAIT_ANY, NULL, WNOHANG);
+ sigchld = 0;
+ }
+ if (sigwinch)
+ client_handle_winch(cctx);
+ if (sigcont) {
+ siginit();
+ client_write_server(cctx, MSG_WAKEUP, NULL, 0);
+ sigcont = 0;
+ }
+
+ switch (client_msg_dispatch(cctx, &error)) {
+ case -1:
+ goto out;
+ case 0:
+ /* May be more in buffer, don't let poll block. */
+ xtimeout = 0;
+ break;
+ default:
+ /* Out of data, poll may block. */
+ xtimeout = INFTIM;
+ break;
+ }
+
+ pfd.fd = cctx->srv_fd;
+ pfd.events = POLLIN;
+ if (BUFFER_USED(cctx->srv_out) > 0)
+ pfd.events |= POLLOUT;
+
+ if (poll(&pfd, 1, xtimeout) == -1) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ fatal("poll failed");
+ }
+
+ if (buffer_poll(&pfd, cctx->srv_in, cctx->srv_out) != 0)
+ goto server_dead;
+ }
+
+out:
+ if (sigterm) {
+ printf("[terminated]\n");
+ return (1);
+ }
+
+ if (cctx->flags & CCTX_SHUTDOWN) {
+ printf("[server exited]\n");
+ return (0);
+ }
+
+ if (cctx->flags & CCTX_EXIT) {
+ printf("[exited]\n");
+ return (0);
+ }
+
+ if (cctx->flags & CCTX_DETACH) {
+ printf("[detached]\n");
+ return (0);
+ }
+
+ printf("[error: %s]\n", error);
+ return (1);
+
+server_dead:
+ printf("[lost server]\n");
+ return (0);
+}
+
+void
+client_handle_winch(struct client_ctx *cctx)
+{
+ struct msg_resize_data data;
+ struct winsize ws;
+
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1)
+ fatal("ioctl failed");
+
+ data.sx = ws.ws_col;
+ data.sy = ws.ws_row;
+ client_write_server(cctx, MSG_RESIZE, &data, sizeof data);
+
+ sigwinch = 0;
+}
diff --git a/tags/TMUX_0_8/clock.c b/tags/TMUX_0_8/clock.c
new file mode 100644
index 00000000..9f7d1c0e
--- /dev/null
+++ b/tags/TMUX_0_8/clock.c
@@ -0,0 +1,161 @@
+/* $Id: clock.c,v 1.3 2009-03-27 16:59:57 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <time.h>
+
+#include "tmux.h"
+
+const char clock_table[14][5][5] = {
+ { { 1,1,1,1,1 }, /* 0 */
+ { 1,0,0,0,1 },
+ { 1,0,0,0,1 },
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 0,0,0,0,1 }, /* 1 */
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 } },
+ { { 1,1,1,1,1 }, /* 2 */
+ { 0,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 1,0,0,0,0 },
+ { 1,1,1,1,1 } },
+ { { 1,1,1,1,1 }, /* 3 */
+ { 0,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 0,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 1,0,0,0,1 }, /* 4 */
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 } },
+ { { 1,1,1,1,1 }, /* 5 */
+ { 1,0,0,0,0 },
+ { 1,1,1,1,1 },
+ { 0,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 1,1,1,1,1 }, /* 6 */
+ { 1,0,0,0,0 },
+ { 1,1,1,1,1 },
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 1,1,1,1,1 }, /* 7 */
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 },
+ { 0,0,0,0,1 } },
+ { { 1,1,1,1,1 }, /* 8 */
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 1,1,1,1,1 }, /* 9 */
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 0,0,0,0,1 },
+ { 1,1,1,1,1 } },
+ { { 0,0,0,0,0 }, /* : */
+ { 0,0,1,0,0 },
+ { 0,0,0,0,0 },
+ { 0,0,1,0,0 },
+ { 0,0,0,0,0 } },
+ { { 1,1,1,1,1 }, /* A */
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 1,0,0,0,1 },
+ { 1,0,0,0,1 } },
+ { { 1,1,1,1,1 }, /* P */
+ { 1,0,0,0,1 },
+ { 1,1,1,1,1 },
+ { 1,0,0,0,0 },
+ { 1,0,0,0,0 } },
+ { { 1,0,0,0,1 }, /* M */
+ { 1,1,0,1,1 },
+ { 1,0,1,0,1 },
+ { 1,0,0,0,1 },
+ { 1,0,0,0,1 } },
+};
+
+void
+clock_draw(struct screen_write_ctx *ctx, u_int colour, int style)
+{
+ struct screen *s = ctx->s;
+ struct grid_cell gc;
+ char tim[64], *ptr;
+ time_t t;
+ u_int i, j, x, y, idx;
+
+ t = time(NULL);
+ if (style == 0)
+ strftime(tim, sizeof tim, "%l:%M %p", localtime(&t));
+ else
+ strftime(tim, sizeof tim, "%H:%M", localtime(&t));
+
+ screen_write_clearscreen(ctx);
+ memcpy(&gc, &grid_default_cell, sizeof gc);
+ gc.fg = colour;
+
+ if (screen_size_x(s) < 6 * strlen(tim) || screen_size_y(s) < 6) {
+ if (screen_size_x(s) >= strlen(tim) && screen_size_y(s) != 0) {
+ x = (screen_size_x(s) / 2) - (strlen(tim) / 2);
+ y = screen_size_y(s) / 2;
+ screen_write_cursormove(ctx, x, y);
+
+ gc.fg = colour;
+ screen_write_puts(ctx, &gc, "%s", tim);
+ }
+ return;
+ }
+
+ x = (screen_size_x(s) / 2) - 3 * strlen(tim);
+ y = (screen_size_y(s) / 2) - 3;
+
+ for (ptr = tim; *ptr != '\0'; ptr++) {
+ if (*ptr >= '0' && *ptr <= '9')
+ idx = *ptr - '0';
+ else if (*ptr == ':')
+ idx = 10;
+ else if (*ptr == 'A')
+ idx = 11;
+ else if (*ptr == 'P')
+ idx = 12;
+ else if (*ptr == 'M')
+ idx = 13;
+ else {
+ x += 6;
+ continue;
+ }
+
+ for (j = 0; j < 5; j++) {
+ screen_write_cursormove(ctx, x, y + j);
+ for (i = 0; i < 5; i++) {
+ if (clock_table[idx][j][i])
+ gc.attr |= GRID_ATTR_REVERSE;
+ else
+ gc.attr &= ~GRID_ATTR_REVERSE;
+ screen_write_putc(ctx, &gc, ' ');
+ }
+ }
+ x += 6;
+ }
+}
diff --git a/tags/TMUX_0_8/cmd-attach-session.c b/tags/TMUX_0_8/cmd-attach-session.c
new file mode 100644
index 00000000..ad9ed857
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-attach-session.c
@@ -0,0 +1,80 @@
+/* $Id: cmd-attach-session.c,v 1.24 2009-01-23 16:59:14 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Attach existing session to the current terminal.
+ */
+
+int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_attach_session_entry = {
+ "attach-session", "attach",
+ "[-d] " CMD_TARGET_SESSION_USAGE,
+ CMD_DFLAG|CMD_CANTNEST|CMD_STARTSERVER,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_attach_session_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ char *cause;
+
+ if (ctx->curclient != NULL)
+ return (0);
+
+ if (ARRAY_LENGTH(&sessions) == 0) {
+ ctx->error(ctx, "no sessions");
+ return (-1);
+ }
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (!(ctx->cmdclient->flags & CLIENT_TERMINAL)) {
+ ctx->error(ctx, "not a terminal");
+ return (-1);
+ }
+
+ if (tty_open(&ctx->cmdclient->tty, &cause) != 0) {
+ ctx->error(ctx, "terminal open failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+
+ if (data->flags & CMD_DFLAG)
+ server_write_session(s, MSG_DETACH, NULL, 0);
+ ctx->cmdclient->session = s;
+
+ server_write_client(ctx->cmdclient, MSG_READY, NULL, 0);
+ recalculate_sizes();
+ server_redraw_client(ctx->cmdclient);
+
+ return (1);
+}
+
diff --git a/tags/TMUX_0_8/cmd-bind-key.c b/tags/TMUX_0_8/cmd-bind-key.c
new file mode 100644
index 00000000..1991bae9
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-bind-key.c
@@ -0,0 +1,157 @@
+/* $Id: cmd-bind-key.c,v 1.20 2009-03-28 14:08:09 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Bind a key to a command, this recurses through cmd_*.
+ */
+
+int cmd_bind_key_parse(struct cmd *, int, char **, char **);
+int cmd_bind_key_exec(struct cmd *, struct cmd_ctx *);
+void cmd_bind_key_send(struct cmd *, struct buffer *);
+void cmd_bind_key_recv(struct cmd *, struct buffer *);
+void cmd_bind_key_free(struct cmd *);
+size_t cmd_bind_key_print(struct cmd *, char *, size_t);
+
+struct cmd_bind_key_data {
+ int key;
+ int can_repeat;
+ struct cmd_list *cmdlist;
+};
+
+const struct cmd_entry cmd_bind_key_entry = {
+ "bind-key", "bind",
+ "[-r] key command [arguments]",
+ 0,
+ NULL,
+ cmd_bind_key_parse,
+ cmd_bind_key_exec,
+ cmd_bind_key_send,
+ cmd_bind_key_recv,
+ cmd_bind_key_free,
+ cmd_bind_key_print
+};
+
+int
+cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_bind_key_data *data;
+ int opt;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->can_repeat = 0;
+ data->cmdlist = NULL;
+
+ while ((opt = getopt(argc, argv, "r")) != -1) {
+ switch (opt) {
+ case 'r':
+ data->can_repeat = 1;
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc < 1)
+ goto usage;
+
+ if ((data->key = key_string_lookup_string(argv[0])) == KEYC_NONE) {
+ xasprintf(cause, "unknown key: %s", argv[0]);
+ goto error;
+ }
+
+ argc--;
+ argv++;
+ if ((data->cmdlist = cmd_list_parse(argc, argv, cause)) == NULL)
+ goto error;
+
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+error:
+ self->entry->free(self);
+ return (-1);
+}
+
+int
+cmd_bind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx)
+{
+ struct cmd_bind_key_data *data = self->data;
+
+ if (data == NULL)
+ return (0);
+
+ key_bindings_add(data->key, data->can_repeat, data->cmdlist);
+ data->cmdlist = NULL; /* avoid free */
+
+ return (0);
+}
+
+void
+cmd_bind_key_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_bind_key_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_list_send(data->cmdlist, b);
+}
+
+void
+cmd_bind_key_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_bind_key_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->cmdlist = cmd_list_recv(b);
+}
+
+void
+cmd_bind_key_free(struct cmd *self)
+{
+ struct cmd_bind_key_data *data = self->data;
+
+ if (data->cmdlist != NULL)
+ cmd_list_free(data->cmdlist);
+ xfree(data);
+}
+
+size_t
+cmd_bind_key_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_bind_key_data *data = self->data;
+ size_t off = 0;
+ const char *skey;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ if (off < len) {
+ skey = key_string_lookup_key(data->key);
+ off += xsnprintf(buf + off, len - off, " %s ", skey);
+ }
+ if (off < len)
+ off += cmd_list_print(data->cmdlist, buf + off, len - off);
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-break-pane.c b/tags/TMUX_0_8/cmd-break-pane.c
new file mode 100644
index 00000000..95a0171f
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-break-pane.c
@@ -0,0 +1,92 @@
+/* $Id: cmd-break-pane.c,v 1.1 2009-03-07 09:29:54 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Break pane off into a window.
+ */
+
+int cmd_break_pane_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_break_pane_entry = {
+ "break-pane", "breakp",
+ CMD_PANE_WINDOW_USAGE " [-d]",
+ CMD_DFLAG,
+ cmd_pane_init,
+ cmd_pane_parse,
+ cmd_break_pane_exec,
+ cmd_pane_send,
+ cmd_pane_recv,
+ cmd_pane_free,
+ cmd_pane_print
+};
+
+int
+cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_pane_data *data = self->data;
+ struct winlink *wl;
+ struct session *s;
+ struct window_pane *wp;
+ struct window *w;
+ char *cause;
+
+ if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ return (-1);
+ if (data->pane == -1)
+ wp = wl->window->active;
+ else {
+ wp = window_pane_at_index(wl->window, data->pane);
+ if (wp == NULL) {
+ ctx->error(ctx, "no pane: %d", data->pane);
+ return (-1);
+ }
+ }
+
+ if (window_count_panes(wl->window) == 1) {
+ ctx->error(ctx, "can't break pane: %d", data->pane);
+ return (-1);
+ }
+
+ TAILQ_REMOVE(&wl->window->panes, wp, entry);
+ if (wl->window->active == wp) {
+ wl->window->active = TAILQ_PREV(wp, window_panes, entry);
+ if (wl->window->active == NULL)
+ wl->window->active = TAILQ_NEXT(wp, entry);
+ }
+ window_fit_panes(wl->window);
+
+ w = wp->window = window_create1(s->sx, s->sy);
+ TAILQ_INSERT_HEAD(&w->panes, wp, entry);
+ w->active = wp;
+ window_fit_panes(w);
+ w->name = default_window_name(w);
+
+ wl = session_attach(s, w, -1, &cause); /* can't fail */
+
+ if (!(data->flags & CMD_DFLAG))
+ session_select(s, wl->idx);
+ server_redraw_session(s);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-choose-session.c b/tags/TMUX_0_8/cmd-choose-session.c
new file mode 100644
index 00000000..dd637a55
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-choose-session.c
@@ -0,0 +1,107 @@
+/* $Id: cmd-choose-session.c,v 1.6 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Enter choice mode to choose a session.
+ */
+
+int cmd_choose_session_exec(struct cmd *, struct cmd_ctx *);
+
+void cmd_choose_session_callback(void *, int);
+
+const struct cmd_entry cmd_choose_session_entry = {
+ "choose-session", NULL,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_choose_session_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+struct cmd_choose_session_data {
+ u_int client;
+};
+
+int
+cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct cmd_choose_session_data *cdata;
+ struct winlink *wl;
+ struct session *s;
+ u_int i, idx, cur;
+
+ if (ctx->curclient == NULL) {
+ ctx->error(ctx, "must be run interactively");
+ return (-1);
+ }
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
+ return (0);
+
+ cur = idx = 0;
+ for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
+ s = ARRAY_ITEM(&sessions, i);
+ if (s == NULL)
+ continue;
+ if (s == ctx->curclient->session)
+ cur = idx;
+ idx++;
+
+ window_choose_add(wl->window->active, i,
+ "%s: %u windows [%ux%u]%s", s->name,
+ winlink_count(&s->windows), s->sx, s->sy,
+ s->flags & SESSION_UNATTACHED ? "" : " (attached)");
+ }
+
+ cdata = xmalloc(sizeof *cdata);
+ cdata->client = server_client_index(ctx->curclient);
+
+ window_choose_ready(
+ wl->window->active, cur, cmd_choose_session_callback, cdata);
+
+ return (0);
+}
+
+void
+cmd_choose_session_callback(void *data, int idx)
+{
+ struct cmd_choose_session_data *cdata = data;
+ struct client *c;
+
+ if (idx != -1 && cdata->client <= ARRAY_LENGTH(&clients) - 1) {
+ c = ARRAY_ITEM(&clients, cdata->client);
+ if (c != NULL && (u_int) idx <= ARRAY_LENGTH(&sessions) - 1) {
+ c->session = ARRAY_ITEM(&sessions, idx);
+ recalculate_sizes();
+ server_redraw_client(c);
+ }
+ }
+ xfree(cdata);
+}
diff --git a/tags/TMUX_0_8/cmd-choose-window.c b/tags/TMUX_0_8/cmd-choose-window.c
new file mode 100644
index 00000000..9820c01e
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-choose-window.c
@@ -0,0 +1,106 @@
+/* $Id: cmd-choose-window.c,v 1.7 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Enter choice mode to choose a window.
+ */
+
+int cmd_choose_window_exec(struct cmd *, struct cmd_ctx *);
+
+void cmd_choose_window_callback(void *, int);
+
+const struct cmd_entry cmd_choose_window_entry = {
+ "choose-window", NULL,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_choose_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+struct cmd_choose_window_data {
+ u_int session;
+};
+
+int
+cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct cmd_choose_window_data *cdata;
+ struct session *s;
+ struct winlink *wl, *wm;
+ struct window *w;
+ u_int idx, cur;
+
+ if (ctx->curclient == NULL) {
+ ctx->error(ctx, "must be run interactively");
+ return (-1);
+ }
+ s = ctx->curclient->session;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
+ return (0);
+
+ cur = idx = 0;
+ RB_FOREACH(wm, winlinks, &s->windows) {
+ w = wm->window;
+
+ if (wm == s->curw)
+ cur = idx;
+ idx++;
+
+ window_choose_add(wl->window->active,
+ wm->idx, "%3d: %s [%ux%u] (%u panes)", wm->idx, w->name,
+ w->sx, w->sy, window_count_panes(w));
+ }
+
+ cdata = xmalloc(sizeof *cdata);
+ if (session_index(s, &cdata->session) != 0)
+ fatalx("session not found");
+
+ window_choose_ready(
+ wl->window->active, cur, cmd_choose_window_callback, cdata);
+
+ return (0);
+}
+
+void
+cmd_choose_window_callback(void *data, int idx)
+{
+ struct cmd_choose_window_data *cdata = data;
+ struct session *s;
+
+ if (idx != -1 && cdata->session <= ARRAY_LENGTH(&sessions) - 1) {
+ s = ARRAY_ITEM(&sessions, cdata->session);
+ if (s != NULL && session_select(s, idx) == 0)
+ server_redraw_session(s);
+ recalculate_sizes();
+ }
+ xfree(cdata);
+}
diff --git a/tags/TMUX_0_8/cmd-clock-mode.c b/tags/TMUX_0_8/cmd-clock-mode.c
new file mode 100644
index 00000000..de10833d
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-clock-mode.c
@@ -0,0 +1,54 @@
+/* $Id: cmd-clock-mode.c,v 1.3 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Enter clock mode.
+ */
+
+int cmd_clock_mode_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_clock_mode_entry = {
+ "clock-mode", NULL,
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_clock_mode_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_clock_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ window_pane_set_mode(wl->window->active, &window_clock_mode);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-command-prompt.c b/tags/TMUX_0_8/cmd-command-prompt.c
new file mode 100644
index 00000000..52f8db1b
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-command-prompt.c
@@ -0,0 +1,178 @@
+/* $Id: cmd-command-prompt.c,v 1.16 2009-02-16 18:58:14 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Prompt for command in client.
+ */
+
+void cmd_command_prompt_init(struct cmd *, int);
+int cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *);
+
+int cmd_command_prompt_callback(void *, const char *);
+
+const struct cmd_entry cmd_command_prompt_entry = {
+ "command-prompt", NULL,
+ CMD_TARGET_CLIENT_USAGE " [template]",
+ CMD_ARG01,
+ cmd_command_prompt_init,
+ cmd_target_parse,
+ cmd_command_prompt_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+struct cmd_command_prompt_data {
+ struct client *c;
+ char *template;
+};
+
+void
+cmd_command_prompt_init(struct cmd *self, int key)
+{
+ struct cmd_target_data *data;
+
+ cmd_target_init(self, key);
+ data = self->data;
+
+ switch (key) {
+ case ',':
+ data->arg = xstrdup("rename-window '%%'");
+ break;
+ case '.':
+ data->arg = xstrdup("move-window -t '%%'");
+ break;
+ case 'f':
+ data->arg = xstrdup("find-window '%%'");
+ break;
+ }
+}
+
+int
+cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct cmd_command_prompt_data *cdata;
+ struct client *c;
+ char *hdr, *ptr;
+
+ if ((c = cmd_find_client(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (c->prompt_string != NULL)
+ return (0);
+
+ cdata = xmalloc(sizeof *cdata);
+ cdata->c = c;
+ if (data->arg != NULL) {
+ cdata->template = xstrdup(data->arg);
+ if ((ptr = strchr(data->arg, ' ')) == NULL)
+ ptr = strchr(data->arg, '\0');
+ xasprintf(&hdr, "(%.*s) ", (int) (ptr - data->arg), data->arg);
+ } else {
+ cdata->template = NULL;
+ hdr = xstrdup(":");
+ }
+ status_prompt_set(c, hdr, cmd_command_prompt_callback, cdata, 0);
+ xfree(hdr);
+
+ return (0);
+}
+
+int
+cmd_command_prompt_callback(void *data, const char *s)
+{
+ struct cmd_command_prompt_data *cdata = data;
+ struct client *c = cdata->c;
+ struct cmd_list *cmdlist;
+ struct cmd_ctx ctx;
+ char *cause, *ptr, *buf, ch;
+ size_t len, slen;
+
+ if (s == NULL) {
+ xfree(cdata);
+ return (0);
+ }
+ slen = strlen(s);
+
+ len = 0;
+ buf = NULL;
+ if (cdata->template != NULL) {
+ ptr = cdata->template;
+ while (*ptr != '\0') {
+ switch (ch = *ptr++) {
+ case '%':
+ if (*ptr != '%')
+ break;
+ ptr++;
+
+ buf = xrealloc(buf, 1, len + slen + 1);
+ memcpy(buf + len, s, slen);
+ len += slen;
+ break;
+ default:
+ buf = xrealloc(buf, 1, len + 2);
+ buf[len++] = ch;
+ break;
+ }
+ }
+ xfree(cdata->template);
+
+ buf[len] = '\0';
+ s = buf;
+ }
+ xfree(cdata);
+
+ if (cmd_string_parse(s, &cmdlist, &cause) != 0) {
+ if (cause == NULL)
+ return (0);
+ *cause = toupper((u_char) *cause);
+ status_message_set(c, cause);
+ xfree(cause);
+ cmdlist = NULL;
+ }
+ if (buf != NULL)
+ xfree(buf);
+ if (cmdlist == NULL)
+ return (0);
+
+ ctx.msgdata = NULL;
+ ctx.cursession = c->session;
+ ctx.curclient = c;
+
+ ctx.error = key_bindings_error;
+ ctx.print = key_bindings_print;
+ ctx.info = key_bindings_info;
+
+ ctx.cmdclient = NULL;
+
+ cmd_list_exec(cmdlist, &ctx);
+ cmd_list_free(cmdlist);
+
+ if (c->prompt_callback != (void *) &cmd_command_prompt_callback)
+ return (1);
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-copy-buffer.c b/tags/TMUX_0_8/cmd-copy-buffer.c
new file mode 100644
index 00000000..c72cbb5b
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-copy-buffer.c
@@ -0,0 +1,222 @@
+/* $Id: cmd-copy-buffer.c,v 1.1 2009-02-03 17:21:19 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Copies a session paste buffer to another session.
+ */
+
+int cmd_copy_buffer_parse(struct cmd *, int, char **, char **);
+int cmd_copy_buffer_exec(struct cmd *, struct cmd_ctx *);
+void cmd_copy_buffer_send(struct cmd *, struct buffer *);
+void cmd_copy_buffer_recv(struct cmd *, struct buffer *);
+void cmd_copy_buffer_free(struct cmd *);
+void cmd_copy_buffer_init(struct cmd *, int);
+size_t cmd_copy_buffer_print(struct cmd *, char *, size_t);
+
+struct cmd_copy_buffer_data {
+ char *dst_session;
+ char *src_session;
+ int dst_idx;
+ int src_idx;
+};
+
+const struct cmd_entry cmd_copy_buffer_entry = {
+ "copy-buffer", "copyb",
+ "[-a src-index] [-b dst-index] [-s src-session] [-t dst-session]",
+ 0,
+ cmd_copy_buffer_init,
+ cmd_copy_buffer_parse,
+ cmd_copy_buffer_exec,
+ cmd_copy_buffer_send,
+ cmd_copy_buffer_recv,
+ cmd_copy_buffer_free,
+ cmd_copy_buffer_print
+};
+
+void
+cmd_copy_buffer_init(struct cmd *self, unused int arg)
+{
+ struct cmd_copy_buffer_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->dst_session = NULL;
+ data->src_session = NULL;
+ data->dst_idx = -1;
+ data->src_idx = -1;
+}
+
+int
+cmd_copy_buffer_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_copy_buffer_data *data;
+ const char *errstr;
+ int n, opt;
+
+ self->entry->init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, "a:b:s:t:")) != -1) {
+ switch (opt) {
+ case 'a':
+ if (data->src_idx == -1) {
+ n = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xasprintf(cause, "buffer %s", errstr);
+ goto error;
+ }
+ data->src_idx = n;
+ }
+ break;
+ case 'b':
+ if (data->dst_idx == -1) {
+ n = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xasprintf(cause, "buffer %s", errstr);
+ goto error;
+ }
+ data->dst_idx = n;
+ }
+ break;
+ case 's':
+ if (data->src_session == NULL)
+ data->src_session = xstrdup(optarg);
+ break;
+ case 't':
+ if (data->dst_session == NULL)
+ data->dst_session = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+error:
+ self->entry->free(self);
+ return (-1);
+}
+
+int
+cmd_copy_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_copy_buffer_data *data = self->data;
+ struct paste_buffer *pb;
+ struct session *dst_session, *src_session;
+ u_int limit;
+
+ if ((dst_session = cmd_find_session(ctx, data->dst_session)) == NULL ||
+ (src_session = cmd_find_session(ctx, data->src_session)) == NULL)
+ return (-1);
+
+ if (data->src_idx == -1) {
+ if ((pb = paste_get_top(&src_session->buffers)) == NULL) {
+ ctx->error(ctx, "no buffers");
+ return (-1);
+ }
+ } else {
+ if ((pb = paste_get_index(&src_session->buffers,
+ data->src_idx)) == NULL) {
+ ctx->error(ctx, "no buffer %d", data->src_idx);
+ return (-1);
+ }
+ }
+
+ limit = options_get_number(&dst_session->options, "buffer-limit");
+ if (data->dst_idx == -1) {
+ paste_add(&dst_session->buffers, xstrdup(pb->data), limit);
+ return (0);
+ }
+ if (paste_replace(&dst_session->buffers, data->dst_idx,
+ xstrdup(pb->data)) != 0) {
+ ctx->error(ctx, "no buffer %d", data->dst_idx);
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+cmd_copy_buffer_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_copy_buffer_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->dst_session);
+ cmd_send_string(b, data->src_session);
+}
+
+void
+cmd_copy_buffer_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_copy_buffer_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->dst_session = cmd_recv_string(b);
+ data->src_session = cmd_recv_string(b);
+}
+
+void
+cmd_copy_buffer_free(struct cmd *self)
+{
+ struct cmd_copy_buffer_data *data = self->data;
+
+ if (data->dst_session != NULL)
+ xfree(data->dst_session);
+ if (data->src_session != NULL)
+ xfree(data->src_session);
+ xfree(data);
+}
+
+size_t
+cmd_copy_buffer_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_copy_buffer_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ if (off < len && data->src_idx != -1) {
+ off += xsnprintf(buf + off, len - off, " -a %d",
+ data->src_idx);
+ }
+ if (off < len && data->dst_idx != -1) {
+ off += xsnprintf(buf + off, len - off, " -b %d",
+ data->dst_idx);
+ }
+ if (off < len && data->src_session != NULL) {
+ off += cmd_prarg(buf + off, len - off, " -s ",
+ data->src_session);
+ }
+ if (off < len && data->dst_session != NULL) {
+ off += cmd_prarg(buf + off, len - off, " -t ",
+ data->dst_session);
+ }
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-copy-mode.c b/tags/TMUX_0_8/cmd-copy-mode.c
new file mode 100644
index 00000000..b5642a45
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-copy-mode.c
@@ -0,0 +1,56 @@
+/* $Id: cmd-copy-mode.c,v 1.16 2009-02-25 21:56:46 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Enter copy mode.
+ */
+
+int cmd_copy_mode_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_copy_mode_entry = {
+ "copy-mode", NULL,
+ CMD_TARGET_WINDOW_USAGE,
+ CMD_UFLAG,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_copy_mode_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ NULL
+};
+
+int
+cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ window_pane_set_mode(wl->window->active, &window_copy_mode);
+ if (data->flags & CMD_UFLAG)
+ window_copy_pageup(wl->window->active);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-delete-buffer.c b/tags/TMUX_0_8/cmd-delete-buffer.c
new file mode 100644
index 00000000..377ff622
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-delete-buffer.c
@@ -0,0 +1,61 @@
+/* $Id: cmd-delete-buffer.c,v 1.4 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Delete a paste buffer.
+ */
+
+int cmd_delete_buffer_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_delete_buffer_entry = {
+ "delete-buffer", "deleteb",
+ CMD_BUFFER_SESSION_USAGE,
+ 0,
+ cmd_buffer_init,
+ cmd_buffer_parse,
+ cmd_delete_buffer_exec,
+ cmd_buffer_send,
+ cmd_buffer_recv,
+ cmd_buffer_free,
+ cmd_buffer_print
+};
+
+int
+cmd_delete_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_buffer_data *data = self->data;
+ struct session *s;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (data->buffer == -1)
+ paste_free_top(&s->buffers);
+ else if (paste_free_index(&s->buffers, data->buffer) != 0) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-detach-client.c b/tags/TMUX_0_8/cmd-detach-client.c
new file mode 100644
index 00000000..3c0879e1
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-detach-client.c
@@ -0,0 +1,54 @@
+/* $Id: cmd-detach-client.c,v 1.7 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Detach a client.
+ */
+
+int cmd_detach_client_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_detach_client_entry = {
+ "detach-client", "detach",
+ CMD_TARGET_CLIENT_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_detach_client_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct client *c;
+
+ if ((c = cmd_find_client(ctx, data->target)) == NULL)
+ return (-1);
+
+ server_write_client(c, MSG_DETACH, NULL, 0);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-down-pane.c b/tags/TMUX_0_8/cmd-down-pane.c
new file mode 100644
index 00000000..af67bbac
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-down-pane.c
@@ -0,0 +1,61 @@
+/* $Id: cmd-down-pane.c,v 1.7 2009-04-01 21:10:08 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Move down a pane.
+ */
+
+int cmd_down_pane_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_down_pane_entry = {
+ "down-pane", "downp",
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_down_pane_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_down_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+ struct window *w;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ w = wl->window;
+
+ do {
+ w->active = TAILQ_NEXT(w->active, entry);
+ if (w->active == NULL)
+ w->active = TAILQ_FIRST(&w->panes);
+ layout_refresh(w, 1);
+ } while (w->active->flags & PANE_HIDDEN);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-find-window.c b/tags/TMUX_0_8/cmd-find-window.c
new file mode 100644
index 00000000..a597582a
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-find-window.c
@@ -0,0 +1,204 @@
+/* $Id: cmd-find-window.c,v 1.6 2009-03-29 11:18:28 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Find window containing text.
+ */
+
+int cmd_find_window_exec(struct cmd *, struct cmd_ctx *);
+
+void cmd_find_window_callback(void *, int);
+char *cmd_find_window_search(struct window_pane *, const char *);
+
+const struct cmd_entry cmd_find_window_entry = {
+ "find-window", "findw",
+ CMD_TARGET_WINDOW_USAGE " match-string",
+ CMD_ARG1,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_find_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+struct cmd_find_window_data {
+ u_int session;
+};
+
+int
+cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct cmd_find_window_data *cdata;
+ struct session *s;
+ struct winlink *wl, *wm;
+ struct window *w;
+ struct window_pane *wp;
+ ARRAY_DECL(, u_int) list_idx;
+ ARRAY_DECL(, char *) list_ctx;
+ char *sres, *sctx;
+ u_int i;
+
+ if (ctx->curclient == NULL) {
+ ctx->error(ctx, "must be run interactively");
+ return (-1);
+ }
+ s = ctx->curclient->session;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ ARRAY_INIT(&list_idx);
+ ARRAY_INIT(&list_ctx);
+
+ RB_FOREACH(wm, winlinks, &s->windows) {
+ i = 0;
+ TAILQ_FOREACH(wp, &wm->window->panes, entry) {
+ i++;
+
+ if (strstr(wm->window->name, data->arg) != NULL)
+ sctx = xstrdup("");
+ else {
+ sres = cmd_find_window_search(wp, data->arg);
+ if (sres == NULL &&
+ strstr(wp->base.title, data->arg) == NULL)
+ continue;
+
+ if (sres == NULL) {
+ xasprintf(&sctx,
+ "pane %u title: \"%s\"", i - 1,
+ wp->base.title);
+ } else {
+ xasprintf(&sctx, "\"%s\"", sres);
+ xfree(sres);
+ }
+ }
+
+ ARRAY_ADD(&list_idx, wm->idx);
+ ARRAY_ADD(&list_ctx, sctx);
+ }
+ }
+
+ if (ARRAY_LENGTH(&list_idx) == 0) {
+ ctx->error(ctx, "no windows matching: %s", data->arg);
+ ARRAY_FREE(&list_idx);
+ ARRAY_FREE(&list_ctx);
+ return (-1);
+ }
+
+ if (ARRAY_LENGTH(&list_idx) == 1) {
+ if (session_select(s, ARRAY_FIRST(&list_idx)) == 0)
+ server_redraw_session(s);
+ recalculate_sizes();
+ goto out;
+ }
+
+ if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
+ goto out;
+
+ for (i = 0; i < ARRAY_LENGTH(&list_idx); i++) {
+ wm = winlink_find_by_index(
+ &s->windows, ARRAY_ITEM(&list_idx, i));
+ w = wm->window;
+
+ sctx = ARRAY_ITEM(&list_ctx, i);
+ window_choose_add(wl->window->active,
+ wm->idx, "%3d: %s [%ux%u] (%u panes) %s", wm->idx, w->name,
+ w->sx, w->sy, window_count_panes(w), sctx);
+ xfree(sctx);
+ }
+
+ cdata = xmalloc(sizeof *cdata);
+ if (session_index(s, &cdata->session) != 0)
+ fatalx("session not found");
+
+ window_choose_ready(
+ wl->window->active, 0, cmd_find_window_callback, cdata);
+
+out:
+ ARRAY_FREE(&list_idx);
+ ARRAY_FREE(&list_ctx);
+
+ return (0);
+}
+
+void
+cmd_find_window_callback(void *data, int idx)
+{
+ struct cmd_find_window_data *cdata = data;
+ struct session *s;
+
+ if (idx != -1 && cdata->session <= ARRAY_LENGTH(&sessions) - 1) {
+ s = ARRAY_ITEM(&sessions, cdata->session);
+ if (s != NULL && session_select(s, idx) == 0)
+ server_redraw_session(s);
+ recalculate_sizes();
+ }
+ xfree(cdata);
+}
+
+char *
+cmd_find_window_search(struct window_pane *wp, const char *searchstr)
+{
+ const struct grid_cell *gc;
+ const struct grid_utf8 *gu;
+ char *buf, *s;
+ size_t off;
+ u_int i, j, k;
+
+ buf = xmalloc(1);
+
+ for (j = 0; j < screen_size_y(&wp->base); j++) {
+ off = 0;
+ for (i = 0; i < screen_size_x(&wp->base); i++) {
+ gc = grid_view_peek_cell(wp->base.grid, i, j);
+ if (gc->flags & GRID_FLAG_UTF8) {
+ gu = grid_view_peek_utf8(wp->base.grid, i, j);
+ buf = xrealloc(buf, 1, off + 8);
+ for (k = 0; k < UTF8_SIZE; k++) {
+ if (gu->data[k] == 0xff)
+ break;
+ buf[off++] = gu->data[k];
+ }
+ } else {
+ buf = xrealloc(buf, 1, off + 1);
+ buf[off++] = gc->data;
+ }
+ }
+ while (off > 0 && buf[off - 1] == ' ')
+ off--;
+ buf[off] = '\0';
+
+ if ((s = strstr(buf, searchstr)) != NULL) {
+ s = section_string(buf, off, s - buf, 40);
+ xfree(buf);
+ return (s);
+ }
+ }
+
+ xfree(buf);
+ return (NULL);
+}
diff --git a/tags/TMUX_0_8/cmd-generic.c b/tags/TMUX_0_8/cmd-generic.c
new file mode 100644
index 00000000..d6a1f8bc
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-generic.c
@@ -0,0 +1,694 @@
+/* $Id: cmd-generic.c,v 1.25 2009-04-03 17:31:44 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "tmux.h"
+
+#define CMD_FLAGS "adDgkuU"
+#define CMD_FLAGMASK (CMD_AFLAG|CMD_DFLAG|CMD_UPPERDFLAG|CMD_GFLAG|CMD_KFLAG| \
+ CMD_UFLAG|CMD_UPPERUFLAG)
+
+int cmd_do_flags(int, int, int *);
+size_t cmd_print_flags(char *, size_t, size_t, int);
+int cmd_fill_argument(int, char **, int, char **);
+
+size_t
+cmd_prarg(char *buf, size_t len, const char *prefix, char *arg)
+{
+ if (strchr(arg, ' ' ) != NULL)
+ return (xsnprintf(buf, len, "%s\"%s\"", prefix, arg));
+ return (xsnprintf(buf, len, "%s%s", prefix, arg));
+}
+
+int
+cmd_do_flags(int opt, int iflags, int *oflags)
+{
+ switch (opt) {
+ case 'a':
+ if (iflags & CMD_AFLAG) {
+ (*oflags) |= CMD_AFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'd':
+ if (iflags & CMD_DFLAG) {
+ (*oflags) |= CMD_DFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'D':
+ if (iflags & CMD_UPPERDFLAG) {
+ (*oflags) |= CMD_UPPERDFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'g':
+ if (iflags & CMD_GFLAG) {
+ (*oflags) |= CMD_GFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'k':
+ if (iflags & CMD_KFLAG) {
+ (*oflags) |= CMD_KFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'u':
+ if (iflags & CMD_UFLAG) {
+ (*oflags) |= CMD_UFLAG;
+ return (0);
+ }
+ return (-1);
+ case 'U':
+ if (iflags & CMD_UPPERUFLAG) {
+ (*oflags) |= CMD_UPPERUFLAG;
+ return (0);
+ }
+ return (-1);
+ }
+ return (1);
+}
+
+size_t
+cmd_print_flags(char *buf, size_t len, size_t off, int flags)
+{
+ size_t boff = off;
+
+ if ((flags & CMD_FLAGMASK) == 0)
+ return (0);
+ off += xsnprintf(buf + off, len - off, " -");
+ if (off < len && flags & CMD_AFLAG)
+ off += xsnprintf(buf + off, len - off, "a");
+ if (off < len && flags & CMD_UPPERDFLAG)
+ off += xsnprintf(buf + off, len - off, "D");
+ if (off < len && flags & CMD_DFLAG)
+ off += xsnprintf(buf + off, len - off, "d");
+ if (off < len && flags & CMD_GFLAG)
+ off += xsnprintf(buf + off, len - off, "g");
+ if (off < len && flags & CMD_KFLAG)
+ off += xsnprintf(buf + off, len - off, "k");
+ if (off < len && flags & CMD_UFLAG)
+ off += xsnprintf(buf + off, len - off, "u");
+ if (off < len && flags & CMD_UPPERUFLAG)
+ off += xsnprintf(buf + off, len - off, "U");
+ return (off - boff);
+}
+
+int
+cmd_fill_argument(int flags, char **arg, int argc, char **argv)
+{
+ *arg = NULL;
+
+ if (flags & CMD_ARG1) {
+ if (argc != 1)
+ return (-1);
+ *arg = xstrdup(argv[0]);
+ return (0);
+ }
+
+ if (flags & CMD_ARG01) {
+ if (argc != 0 && argc != 1)
+ return (-1);
+ if (argc == 1)
+ *arg = xstrdup(argv[0]);
+ return (0);
+ }
+
+ if (argc != 0)
+ return (-1);
+ return (0);
+}
+
+void
+cmd_target_init(struct cmd *self, unused int key)
+{
+ struct cmd_target_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flags = 0;
+ data->target = NULL;
+ data->arg = NULL;
+}
+
+int
+cmd_target_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_target_data *data;
+ int opt;
+
+ /* Don't use the entry version since it may be dependent on key. */
+ cmd_target_init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, CMD_FLAGS "t:")) != -1) {
+ switch (cmd_do_flags(opt, self->entry->flags, &data->flags)) {
+ case -1:
+ goto usage;
+ case 0:
+ continue;
+ }
+ switch (opt) {
+ case 't':
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (cmd_fill_argument(self->entry->flags, &data->arg, argc, argv) != 0)
+ goto usage;
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+ self->entry->free(self);
+ return (-1);
+}
+
+void
+cmd_target_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_target_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->target);
+ cmd_send_string(b, data->arg);
+}
+
+void
+cmd_target_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_target_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->target = cmd_recv_string(b);
+ data->arg = cmd_recv_string(b);
+}
+
+void
+cmd_target_free(struct cmd *self)
+{
+ struct cmd_target_data *data = self->data;
+
+ if (data->target != NULL)
+ xfree(data->target);
+ if (data->arg != NULL)
+ xfree(data->arg);
+ xfree(data);
+}
+
+size_t
+cmd_target_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_target_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ off += cmd_print_flags(buf, len, off, data->flags);
+ if (off < len && data->target != NULL)
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
+ if (off < len && data->arg != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->arg);
+ return (off);
+}
+
+void
+cmd_srcdst_init(struct cmd *self, unused int key)
+{
+ struct cmd_srcdst_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flags = 0;
+ data->src = NULL;
+ data->dst = NULL;
+ data->arg = NULL;
+}
+
+int
+cmd_srcdst_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_srcdst_data *data;
+ int opt;
+
+ cmd_srcdst_init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, CMD_FLAGS "s:t:")) != -1) {
+ switch (cmd_do_flags(opt, self->entry->flags, &data->flags)) {
+ case -1:
+ goto usage;
+ case 0:
+ continue;
+ }
+ switch (opt) {
+ case 's':
+ if (data->src == NULL)
+ data->src = xstrdup(optarg);
+ break;
+ case 't':
+ if (data->dst == NULL)
+ data->dst = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (cmd_fill_argument(self->entry->flags, &data->arg, argc, argv) != 0)
+ goto usage;
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+ self->entry->free(self);
+ return (-1);
+}
+
+void
+cmd_srcdst_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_srcdst_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->src);
+ cmd_send_string(b, data->dst);
+ cmd_send_string(b, data->arg);
+}
+
+void
+cmd_srcdst_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_srcdst_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->src = cmd_recv_string(b);
+ data->dst = cmd_recv_string(b);
+ data->arg = cmd_recv_string(b);
+}
+
+void
+cmd_srcdst_free(struct cmd *self)
+{
+ struct cmd_srcdst_data *data = self->data;
+
+ if (data->src != NULL)
+ xfree(data->src);
+ if (data->dst != NULL)
+ xfree(data->dst);
+ if (data->arg != NULL)
+ xfree(data->arg);
+ xfree(data);
+}
+
+size_t
+cmd_srcdst_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_srcdst_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ off += cmd_print_flags(buf, len, off, data->flags);
+ if (off < len && data->src != NULL)
+ off += xsnprintf(buf + off, len - off, " -s %s", data->src);
+ if (off < len && data->dst != NULL)
+ off += xsnprintf(buf + off, len - off, " -t %s", data->dst);
+ if (off < len && data->arg != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->arg);
+ return (off);
+}
+
+void
+cmd_buffer_init(struct cmd *self, unused int key)
+{
+ struct cmd_buffer_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flags = 0;
+ data->target = NULL;
+ data->buffer = -1;
+ data->arg = NULL;
+}
+
+int
+cmd_buffer_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_buffer_data *data;
+ int opt, n;
+ const char *errstr;
+
+ cmd_buffer_init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, CMD_FLAGS "b:t:")) != -1) {
+ switch (cmd_do_flags(opt, self->entry->flags, &data->flags)) {
+ case -1:
+ goto usage;
+ case 0:
+ continue;
+ }
+ switch (opt) {
+ case 'b':
+ if (data->buffer == -1) {
+ n = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xasprintf(cause, "buffer %s", errstr);
+ goto error;
+ }
+ data->buffer = n;
+ }
+ break;
+ case 't':
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (cmd_fill_argument(self->entry->flags, &data->arg, argc, argv) != 0)
+ goto usage;
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+error:
+ self->entry->free(self);
+ return (-1);
+}
+
+void
+cmd_buffer_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_buffer_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->target);
+ cmd_send_string(b, data->arg);
+}
+
+void
+cmd_buffer_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_buffer_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->target = cmd_recv_string(b);
+ data->arg = cmd_recv_string(b);
+}
+
+void
+cmd_buffer_free(struct cmd *self)
+{
+ struct cmd_buffer_data *data = self->data;
+
+ if (data->target != NULL)
+ xfree(data->target);
+ if (data->arg != NULL)
+ xfree(data->arg);
+ xfree(data);
+}
+
+size_t
+cmd_buffer_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_buffer_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ off += cmd_print_flags(buf, len, off, data->flags);
+ if (off < len && data->buffer != -1)
+ off += xsnprintf(buf + off, len - off, " -b %d", data->buffer);
+ if (off < len && data->target != NULL)
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
+ if (off < len && data->arg != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->arg);
+ return (off);
+}
+
+void
+cmd_option_init(struct cmd *self, unused int key)
+{
+ struct cmd_option_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flags = 0;
+ data->target = NULL;
+ data->option = NULL;
+ data->value = NULL;
+}
+
+int
+cmd_option_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_option_data *data;
+ int opt;
+
+ /* Don't use the entry version since it may be dependent on key. */
+ cmd_option_init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, CMD_FLAGS "t:")) != -1) {
+ switch (cmd_do_flags(opt, self->entry->flags, &data->flags)) {
+ case -1:
+ goto usage;
+ case 0:
+ continue;
+ }
+ switch (opt) {
+ case 't':
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 2) {
+ data->option = xstrdup(argv[0]);
+ data->value = xstrdup(argv[1]);
+ } else if (argc == 1)
+ data->option = xstrdup(argv[0]);
+ else
+ goto usage;
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+ self->entry->free(self);
+ return (-1);
+}
+
+void
+cmd_option_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_option_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->target);
+ cmd_send_string(b, data->option);
+ cmd_send_string(b, data->value);
+}
+
+void
+cmd_option_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_option_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->target = cmd_recv_string(b);
+ data->option = cmd_recv_string(b);
+ data->value = cmd_recv_string(b);
+}
+
+void
+cmd_option_free(struct cmd *self)
+{
+ struct cmd_option_data *data = self->data;
+
+ if (data->target != NULL)
+ xfree(data->target);
+ if (data->option != NULL)
+ xfree(data->option);
+ if (data->value != NULL)
+ xfree(data->value);
+ xfree(data);
+}
+
+size_t
+cmd_option_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_option_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ off += cmd_print_flags(buf, len, off, data->flags);
+ if (off < len && data->target != NULL)
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
+ if (off < len && data->option != NULL)
+ off += xsnprintf(buf + off, len - off, " %s", data->option);
+ if (off < len && data->value != NULL)
+ off += xsnprintf(buf + off, len - off, " %s", data->value);
+ return (off);
+}
+
+void
+cmd_pane_init(struct cmd *self, unused int key)
+{
+ struct cmd_pane_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flags = 0;
+ data->target = NULL;
+ data->arg = NULL;
+ data->pane = -1;
+}
+
+int
+cmd_pane_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_pane_data *data;
+ int opt, n;
+ const char *errstr;
+
+ /* Don't use the entry version since it may be dependent on key. */
+ cmd_pane_init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, CMD_FLAGS "p:t:")) != -1) {
+ switch (cmd_do_flags(opt, self->entry->flags, &data->flags)) {
+ case -1:
+ goto usage;
+ case 0:
+ continue;
+ }
+ switch (opt) {
+ case 'p':
+ if (data->pane == -1) {
+ n = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ xasprintf(cause, "pane %s", errstr);
+ goto error;
+ }
+ data->pane = n;
+ }
+ break;
+ case 't':
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (cmd_fill_argument(self->entry->flags, &data->arg, argc, argv) != 0)
+ goto usage;
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+error:
+ self->entry->free(self);
+ return (-1);
+}
+
+void
+cmd_pane_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_pane_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->target);
+ cmd_send_string(b, data->arg);
+}
+
+void
+cmd_pane_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_pane_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->target = cmd_recv_string(b);
+ data->arg = cmd_recv_string(b);
+}
+
+void
+cmd_pane_free(struct cmd *self)
+{
+ struct cmd_pane_data *data = self->data;
+
+ if (data->target != NULL)
+ xfree(data->target);
+ if (data->arg != NULL)
+ xfree(data->arg);
+ xfree(data);
+}
+
+size_t
+cmd_pane_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_pane_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ off += cmd_print_flags(buf, len, off, data->flags);
+ if (off < len && data->target != NULL)
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
+ if (off < len && data->arg != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->arg);
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-has-session.c b/tags/TMUX_0_8/cmd-has-session.c
new file mode 100644
index 00000000..9cd3f128
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-has-session.c
@@ -0,0 +1,51 @@
+/* $Id: cmd-has-session.c,v 1.12 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Cause client to report an error and exit with 1 if session doesn't exist.
+ */
+
+int cmd_has_session_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_has_session_entry = {
+ "has-session", "has",
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_has_session_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_has_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+
+ if (cmd_find_session(ctx, data->target) == NULL)
+ return (-1);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-kill-pane.c b/tags/TMUX_0_8/cmd-kill-pane.c
new file mode 100644
index 00000000..202bfd5f
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-kill-pane.c
@@ -0,0 +1,72 @@
+/* $Id: cmd-kill-pane.c,v 1.6 2009-04-01 21:10:08 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Kill pane.
+ */
+
+int cmd_kill_pane_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_kill_pane_entry = {
+ "kill-pane", "killp",
+ CMD_PANE_WINDOW_USAGE,
+ 0,
+ cmd_pane_init,
+ cmd_pane_parse,
+ cmd_kill_pane_exec,
+ cmd_pane_send,
+ cmd_pane_recv,
+ cmd_pane_free,
+ cmd_pane_print
+};
+
+int
+cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_pane_data *data = self->data;
+ struct winlink *wl;
+ struct window_pane *wp;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ if (data->pane == -1)
+ wp = wl->window->active;
+ else {
+ wp = window_pane_at_index(wl->window, data->pane);
+ if (wp == NULL) {
+ ctx->error(ctx, "no pane: %d", data->pane);
+ return (-1);
+ }
+ }
+
+ if (window_count_panes(wl->window) == 1) {
+ ctx->error(ctx, "can't kill pane: %d", data->pane);
+ return (-1);
+ }
+
+ window_remove_pane(wl->window, wp);
+ server_redraw_window(wl->window);
+ layout_refresh(wl->window, 0);
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-kill-server.c b/tags/TMUX_0_8/cmd-kill-server.c
new file mode 100644
index 00000000..b35a1c9c
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-kill-server.c
@@ -0,0 +1,51 @@
+/* $Id: cmd-kill-server.c,v 1.6 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <signal.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * Kill the server and do nothing else.
+ */
+
+int cmd_kill_server_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_kill_server_entry = {
+ "kill-server", NULL,
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_kill_server_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+int
+cmd_kill_server_exec(unused struct cmd *self, unused struct cmd_ctx *ctx)
+{
+ sigterm = 1;
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-kill-session.c b/tags/TMUX_0_8/cmd-kill-session.c
new file mode 100644
index 00000000..5b0e643c
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-kill-session.c
@@ -0,0 +1,68 @@
+/* $Id: cmd-kill-session.c,v 1.12 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Destroy session, detaching all clients attached to it and destroying any
+ * windows linked only to this session.
+ *
+ * Note this deliberately has no alias to make it hard to hit by accident.
+ */
+
+int cmd_kill_session_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_kill_session_entry = {
+ "kill-session", NULL,
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_kill_session_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ struct client *c;
+ u_int i;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c->session == s) {
+ c->session = NULL;
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ }
+ }
+ recalculate_sizes();
+
+ session_destroy(s);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-kill-window.c b/tags/TMUX_0_8/cmd-kill-window.c
new file mode 100644
index 00000000..e7fb4d62
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-kill-window.c
@@ -0,0 +1,69 @@
+/* $Id: cmd-kill-window.c,v 1.15 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Destroy window.
+ */
+
+int cmd_kill_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_kill_window_entry = {
+ "kill-window", "killw",
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_kill_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+ struct session *s;
+ struct client *c;
+ u_int i;
+ int destroyed;
+
+ if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ return (-1);
+
+ destroyed = session_detach(s, wl);
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session != s)
+ continue;
+ if (destroyed) {
+ c->session = NULL;
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ } else
+ server_redraw_client(c);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-last-window.c b/tags/TMUX_0_8/cmd-last-window.c
new file mode 100644
index 00000000..e040eb3a
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-last-window.c
@@ -0,0 +1,60 @@
+/* $Id: cmd-last-window.c,v 1.16 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Move to last window.
+ */
+
+int cmd_last_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_last_window_entry = {
+ "last-window", "last",
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_last_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_last_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (session_last(s) == 0)
+ server_redraw_session(s);
+ else {
+ ctx->error(ctx, "no last window");
+ return (-1);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-link-window.c b/tags/TMUX_0_8/cmd-link-window.c
new file mode 100644
index 00000000..48ebf891
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-link-window.c
@@ -0,0 +1,109 @@
+/* $Id: cmd-link-window.c,v 1.28 2009-01-23 16:59:14 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Link a window into another session.
+ */
+
+int cmd_link_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_link_window_entry = {
+ "link-window", "linkw",
+ "[-dk] " CMD_SRCDST_WINDOW_USAGE,
+ CMD_DFLAG|CMD_KFLAG,
+ cmd_srcdst_init,
+ cmd_srcdst_parse,
+ cmd_link_window_exec,
+ cmd_srcdst_send,
+ cmd_srcdst_recv,
+ cmd_srcdst_free,
+ cmd_srcdst_print
+};
+
+int
+cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_srcdst_data *data = self->data;
+ struct session *dst;
+ struct winlink *wl_src, *wl_dst;
+ char *cause;
+ int idx;
+
+ if ((wl_src = cmd_find_window(ctx, data->src, NULL)) == NULL)
+ return (-1);
+
+ if (arg_parse_window(data->dst, &dst, &idx) != 0) {
+ ctx->error(ctx, "bad window: %s", data->dst);
+ return (-1);
+ }
+ if (dst == NULL)
+ dst = ctx->cursession;
+ if (dst == NULL)
+ dst = cmd_current_session(ctx);
+ if (dst == NULL) {
+ ctx->error(ctx, "session not found: %s", data->dst);
+ return (-1);
+ }
+
+ wl_dst = NULL;
+ if (idx != -1)
+ wl_dst = winlink_find_by_index(&dst->windows, idx);
+ if (wl_dst != NULL) {
+ if (wl_dst->window == wl_src->window)
+ return (0);
+
+ if (data->flags & CMD_KFLAG) {
+ /*
+ * Can't use session_detach as it will destroy session
+ * if this makes it empty.
+ */
+ session_alert_cancel(dst, wl_dst);
+ winlink_stack_remove(&dst->lastw, wl_dst);
+ winlink_remove(&dst->windows, wl_dst);
+
+ /* Force select/redraw if current. */
+ if (wl_dst == dst->curw) {
+ data->flags &= ~CMD_DFLAG;
+ dst->curw = NULL;
+ }
+ }
+ }
+
+ wl_dst = session_attach(dst, wl_src->window, idx, &cause);
+ if (wl_dst == NULL) {
+ ctx->error(ctx, "create session failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+
+ if (data->flags & CMD_DFLAG)
+ server_status_session(dst);
+ else {
+ session_select(dst, wl_dst->idx);
+ server_redraw_session(dst);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-buffers.c b/tags/TMUX_0_8/cmd-list-buffers.c
new file mode 100644
index 00000000..c4c042f2
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-buffers.c
@@ -0,0 +1,91 @@
+/* $Id: cmd-list-buffers.c,v 1.7 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * List paste buffers.
+ */
+
+int cmd_list_buffers_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_buffers_entry = {
+ "list-buffers", "lsb",
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_list_buffers_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ struct paste_buffer *pb;
+ u_int idx;
+ char *tmp;
+ size_t size, in, out;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (s->sx > 35) { /* leave three for ... */
+ size = s->sx - 32;
+ tmp = xmalloc(size + 1);
+ } else {
+ size = 0;
+ tmp = NULL;
+ }
+
+ idx = 0;
+ while ((pb = paste_walk_stack(&s->buffers, &idx)) != NULL) {
+ if (tmp != NULL) {
+ in = out = 0;
+ while (out < size && pb->data[in] != '\0') {
+ if (pb->data[in] > 31 && pb->data[in] != 127)
+ tmp[out++] = pb->data[in];
+ in++;
+ }
+ tmp[out] = '\0';
+ if (out == size) {
+ tmp[out - 1] = '.';
+ tmp[out - 2] = '.';
+ tmp[out - 3] = '.';
+ }
+
+ ctx->print(ctx, "%d: %zu bytes: \"%s\"",
+ idx - 1, strlen(pb->data), tmp);
+ } else
+ ctx->print(ctx, "%d: %zu bytes", idx, strlen(pb->data));
+ }
+
+ if (tmp != NULL)
+ xfree(tmp);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-clients.c b/tags/TMUX_0_8/cmd-list-clients.c
new file mode 100644
index 00000000..67a0cc5b
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-clients.c
@@ -0,0 +1,61 @@
+/* $Id: cmd-list-clients.c,v 1.13 2009-02-11 17:50:32 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <time.h>
+
+#include "tmux.h"
+
+/*
+ * List all clients.
+ */
+
+int cmd_list_clients_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_clients_entry = {
+ "list-clients", "lsc",
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_list_clients_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+int
+cmd_list_clients_exec(unused struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct client *c;
+ u_int i;
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session == NULL)
+ continue;
+
+ ctx->print(ctx, "%s: %s [%ux%u %s]", c->tty.path,
+ c->session->name, c->tty.sx, c->tty.sy, c->tty.termname);
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-commands.c b/tags/TMUX_0_8/cmd-list-commands.c
new file mode 100644
index 00000000..99451123
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-commands.c
@@ -0,0 +1,51 @@
+/* $Id: cmd-list-commands.c,v 1.3 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * List all commands with usages.
+ */
+
+int cmd_list_commands_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_commands_entry = {
+ "list-commands", "lscm",
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_list_commands_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+int
+cmd_list_commands_exec(unused struct cmd *self, struct cmd_ctx *ctx)
+{
+ const struct cmd_entry **entryp;
+
+ for (entryp = cmd_table; *entryp != NULL; entryp++)
+ ctx->print(ctx, "%s %s", (*entryp)->name, (*entryp)->usage);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-keys.c b/tags/TMUX_0_8/cmd-list-keys.c
new file mode 100644
index 00000000..a32f6b1a
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-keys.c
@@ -0,0 +1,59 @@
+/* $Id: cmd-list-keys.c,v 1.13 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * List key bindings.
+ */
+
+int cmd_list_keys_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_keys_entry = {
+ "list-keys", "lsk",
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_list_keys_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+int
+cmd_list_keys_exec(unused struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct key_binding *bd;
+ const char *key;
+ char tmp[BUFSIZ];
+
+ SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
+ if ((key = key_string_lookup_key(bd->key)) == NULL)
+ continue;
+
+ *tmp = '\0';
+ cmd_list_print(bd->cmdlist, tmp, sizeof tmp);
+ ctx->print(ctx, "%11s: %s", key, tmp);
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-sessions.c b/tags/TMUX_0_8/cmd-list-sessions.c
new file mode 100644
index 00000000..135adbd6
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-sessions.c
@@ -0,0 +1,67 @@
+/* $Id: cmd-list-sessions.c,v 1.19 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+#include <time.h>
+
+#include "tmux.h"
+
+/*
+ * List all sessions.
+ */
+
+int cmd_list_sessions_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_sessions_entry = {
+ "list-sessions", "ls", "",
+ 0,
+ NULL,
+ NULL,
+ cmd_list_sessions_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+int
+cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct session *s;
+ char *tim;
+ u_int i;
+ time_t t;
+
+ for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
+ s = ARRAY_ITEM(&sessions, i);
+ if (s == NULL)
+ continue;
+
+ t = s->tv.tv_sec;
+ tim = ctime(&t);
+ *strchr(tim, '\n') = '\0';
+
+ ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s",
+ s->name, winlink_count(&s->windows), tim, s->sx, s->sy,
+ s->flags & SESSION_UNATTACHED ? "" : " (attached)");
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list-windows.c b/tags/TMUX_0_8/cmd-list-windows.c
new file mode 100644
index 00000000..9cfc255a
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list-windows.c
@@ -0,0 +1,87 @@
+/* $Id: cmd-list-windows.c,v 1.33 2009-03-28 20:17:29 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * List windows on given session.
+ */
+
+int cmd_list_windows_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_list_windows_entry = {
+ "list-windows", "lsw",
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_list_windows_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ struct winlink *wl;
+ struct window *w;
+ struct window_pane *wp;
+ struct grid *gd;
+ u_int i;
+ unsigned long long size;
+ const char *name;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ RB_FOREACH(wl, winlinks, &s->windows) {
+ w = wl->window;
+ ctx->print(ctx,
+ "%3d: %s [%ux%u]", wl->idx, w->name, w->sx, w->sy);
+
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ gd = wp->base.grid;
+
+ size = 0;
+ for (i = 0; i < gd->hsize; i++) {
+ size += gd->size[i] * sizeof **gd->data;
+ size += gd->usize[i] * sizeof **gd->udata;
+ }
+ size += gd->hsize * (sizeof *gd->data);
+ size += gd->hsize * (sizeof *gd->size);
+
+ if (wp->fd != -1)
+ name = ttyname(wp->fd);
+ else
+ name = "unknown";
+ ctx->print(ctx,
+ " %s [%ux%u] [history %u/%u, %llu bytes]",
+ name, wp->sx, wp->sy, gd->hsize, gd->hlimit, size);
+ }
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-list.c b/tags/TMUX_0_8/cmd-list.c
new file mode 100644
index 00000000..963d49fe
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-list.c
@@ -0,0 +1,139 @@
+/* $Id: cmd-list.c,v 1.3 2009-02-16 18:57:16 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+struct cmd_list *
+cmd_list_parse(int argc, char **argv, char **cause)
+{
+ struct cmd_list *cmdlist;
+ struct cmd *cmd;
+ int i, lastsplit;
+
+ cmdlist = xmalloc(sizeof *cmdlist);
+ TAILQ_INIT(cmdlist);
+
+ lastsplit = 0;
+ for (i = 0; i < argc; i++) {
+ if (strcmp(argv[i], "\\;") == 0) {
+ argv[i][0] = ';';
+ argv[i][1] = '\0';
+ } else if (strcmp(argv[i], ";") == 0) {
+ cmd = cmd_parse(i - lastsplit, argv + lastsplit, cause);
+ if (cmd == NULL)
+ goto bad;
+ TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
+ lastsplit = i + 1;
+ }
+ }
+
+ cmd = cmd_parse(argc - lastsplit, argv + lastsplit, cause);
+ if (cmd == NULL)
+ goto bad;
+ TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
+
+ return (cmdlist);
+
+bad:
+ cmd_list_free(cmdlist);
+ return (NULL);
+}
+
+int
+cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx)
+{
+ struct cmd *cmd;
+ int n;
+
+ TAILQ_FOREACH(cmd, cmdlist, qentry) {
+ if ((n = cmd_exec(cmd, ctx)) != 0)
+ return (n);
+ }
+ return (0);
+}
+
+void
+cmd_list_send(struct cmd_list *cmdlist, struct buffer *b)
+{
+ struct cmd *cmd;
+ u_int n;
+
+ n = 0;
+ TAILQ_FOREACH(cmd, cmdlist, qentry)
+ n++;
+
+ buffer_write(b, &n, sizeof n);
+ TAILQ_FOREACH(cmd, cmdlist, qentry)
+ cmd_send(cmd, b);
+}
+
+struct cmd_list *
+cmd_list_recv(struct buffer *b)
+{
+ struct cmd_list *cmdlist;
+ struct cmd *cmd;
+ u_int n;
+
+ buffer_read(b, &n, sizeof n);
+
+ cmdlist = xmalloc(sizeof *cmdlist);
+ TAILQ_INIT(cmdlist);
+
+ while (n-- > 0) {
+ cmd = cmd_recv(b);
+ TAILQ_INSERT_TAIL(cmdlist, cmd, qentry);
+ }
+
+ return (cmdlist);
+}
+
+void
+cmd_list_free(struct cmd_list *cmdlist)
+{
+ struct cmd *cmd;
+
+ while (!TAILQ_EMPTY(cmdlist)) {
+ cmd = TAILQ_FIRST(cmdlist);
+ TAILQ_REMOVE(cmdlist, cmd, qentry);
+ cmd_free(cmd);
+ }
+ xfree(cmdlist);
+}
+
+size_t
+cmd_list_print(struct cmd_list *cmdlist, char *buf, size_t len)
+{
+ struct cmd *cmd;
+ size_t off;
+
+ off = 0;
+ TAILQ_FOREACH(cmd, cmdlist, qentry) {
+ if (off >= len)
+ break;
+ off += cmd_print(cmd, buf + off, len - off);
+ if (off >= len)
+ break;
+ if (TAILQ_NEXT(cmd, qentry) != NULL)
+ off += xsnprintf(buf + off, len - off, " ; ");
+ }
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-load-buffer.c b/tags/TMUX_0_8/cmd-load-buffer.c
new file mode 100644
index 00000000..ab4c5c60
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-load-buffer.c
@@ -0,0 +1,102 @@
+/* $Id: cmd-load-buffer.c,v 1.2 2009-01-27 23:26:15 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * Loads a session paste buffer from a file.
+ */
+
+int cmd_load_buffer_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_load_buffer_entry = {
+ "load-buffer", "loadb",
+ CMD_BUFFER_SESSION_USAGE " path",
+ CMD_ARG1,
+ cmd_buffer_init,
+ cmd_buffer_parse,
+ cmd_load_buffer_exec,
+ cmd_buffer_send,
+ cmd_buffer_recv,
+ cmd_buffer_free,
+ cmd_buffer_print
+};
+
+int
+cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_buffer_data *data = self->data;
+ struct session *s;
+ struct stat statbuf;
+ FILE *f;
+ char *buf;
+ u_int limit;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (stat(data->arg, &statbuf) < 0) {
+ ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
+ return (-1);
+ }
+
+ if ((f = fopen(data->arg, "r")) == NULL) {
+ ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
+ return (-1);
+ }
+
+ /*
+ * We don't want to die due to memory exhaustion, hence xmalloc can't
+ * be used here.
+ */
+ if ((buf = malloc(statbuf.st_size + 1)) == NULL) {
+ ctx->error(ctx, "malloc error: %s", strerror(errno));
+ return (-1);
+ }
+
+ if (fread(buf, 1, statbuf.st_size, f) != (size_t) statbuf.st_size) {
+ ctx->error(ctx, "%s: fread error", data->arg);
+ xfree(buf);
+ fclose(f);
+ return (-1);
+ }
+
+ buf[statbuf.st_size] = '\0';
+ fclose(f);
+
+ limit = options_get_number(&s->options, "buffer-limit");
+ if (data->buffer == -1) {
+ paste_add(&s->buffers, buf, limit);
+ return (0);
+ }
+ if (paste_replace(&s->buffers, data->buffer, buf) != 0) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ xfree(buf);
+ return (-1);
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-lock-server.c b/tags/TMUX_0_8/cmd-lock-server.c
new file mode 100644
index 00000000..102898ad
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-lock-server.c
@@ -0,0 +1,54 @@
+/* $Id: cmd-lock-server.c,v 1.2 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <pwd.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * Lock server.
+ */
+
+int cmd_lock_server_exec(struct cmd *, struct cmd_ctx *);
+
+int cmd_lock_server_callback(void *, const char *);
+
+const struct cmd_entry cmd_lock_server_entry = {
+ "lock-server", "lock",
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_lock_server_exec,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+int
+cmd_lock_server_exec(unused struct cmd *self, unused struct cmd_ctx *ctx)
+{
+ server_lock();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-move-window.c b/tags/TMUX_0_8/cmd-move-window.c
new file mode 100644
index 00000000..b7f02091
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-move-window.c
@@ -0,0 +1,123 @@
+/* $Id: cmd-move-window.c,v 1.5 2009-01-23 16:59:14 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Move a window.
+ */
+
+int cmd_move_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_move_window_entry = {
+ "move-window", "movew",
+ "[-dk] " CMD_SRCDST_WINDOW_USAGE,
+ CMD_DFLAG|CMD_KFLAG,
+ cmd_srcdst_init,
+ cmd_srcdst_parse,
+ cmd_move_window_exec,
+ cmd_srcdst_send,
+ cmd_srcdst_recv,
+ cmd_srcdst_free,
+ cmd_srcdst_print
+};
+
+int
+cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_srcdst_data *data = self->data;
+ struct session *src, *dst;
+ struct winlink *wl_src, *wl_dst;
+ struct client *c;
+ u_int i;
+ int destroyed, idx;
+ char *cause;
+
+ if ((wl_src = cmd_find_window(ctx, data->src, &src)) == NULL)
+ return (-1);
+
+ if (arg_parse_window(data->dst, &dst, &idx) != 0) {
+ ctx->error(ctx, "bad window: %s", data->dst);
+ return (-1);
+ }
+ if (dst == NULL)
+ dst = ctx->cursession;
+ if (dst == NULL)
+ dst = cmd_current_session(ctx);
+ if (dst == NULL) {
+ ctx->error(ctx, "session not found: %s", data->dst);
+ return (-1);
+ }
+
+ wl_dst = NULL;
+ if (idx != -1)
+ wl_dst = winlink_find_by_index(&dst->windows, idx);
+ if (wl_dst != NULL) {
+ if (wl_dst->window == wl_src->window)
+ return (0);
+
+ if (data->flags & CMD_KFLAG) {
+ /*
+ * Can't use session_detach as it will destroy session
+ * if this makes it empty.
+ */
+ session_alert_cancel(dst, wl_dst);
+ winlink_stack_remove(&dst->lastw, wl_dst);
+ winlink_remove(&dst->windows, wl_dst);
+
+ /* Force select/redraw if current. */
+ if (wl_dst == dst->curw) {
+ data->flags &= ~CMD_DFLAG;
+ dst->curw = NULL;
+ }
+ }
+ }
+
+ wl_dst = session_attach(dst, wl_src->window, idx, &cause);
+ if (wl_dst == NULL) {
+ ctx->error(ctx, "attach window failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+
+ destroyed = session_detach(src, wl_src);
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session != src)
+ continue;
+ if (destroyed) {
+ c->session = NULL;
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ } else
+ server_redraw_client(c);
+ }
+
+ if (data->flags & CMD_DFLAG)
+ server_status_session(dst);
+ else {
+ session_select(dst, wl_dst->idx);
+ server_redraw_session(dst);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-new-session.c b/tags/TMUX_0_8/cmd-new-session.c
new file mode 100644
index 00000000..e5756d0d
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-new-session.c
@@ -0,0 +1,248 @@
+/* $Id: cmd-new-session.c,v 1.40 2009-04-01 18:21:24 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Create a new session and attach to the current terminal unless -d is given.
+ */
+
+int cmd_new_session_parse(struct cmd *, int, char **, char **);
+int cmd_new_session_exec(struct cmd *, struct cmd_ctx *);
+void cmd_new_session_send(struct cmd *, struct buffer *);
+void cmd_new_session_recv(struct cmd *, struct buffer *);
+void cmd_new_session_free(struct cmd *);
+void cmd_new_session_init(struct cmd *, int);
+size_t cmd_new_session_print(struct cmd *, char *, size_t);
+
+struct cmd_new_session_data {
+ char *newname;
+ char *winname;
+ char *cmd;
+ int flag_detached;
+};
+
+const struct cmd_entry cmd_new_session_entry = {
+ "new-session", "new",
+ "[-d] [-n window-name] [-s session-name] [command]",
+ CMD_STARTSERVER|CMD_CANTNEST,
+ cmd_new_session_init,
+ cmd_new_session_parse,
+ cmd_new_session_exec,
+ cmd_new_session_send,
+ cmd_new_session_recv,
+ cmd_new_session_free,
+ cmd_new_session_print
+};
+
+void
+cmd_new_session_init(struct cmd *self, unused int arg)
+{
+ struct cmd_new_session_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->flag_detached = 0;
+ data->newname = NULL;
+ data->winname = NULL;
+ data->cmd = NULL;
+}
+
+int
+cmd_new_session_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_new_session_data *data;
+ int opt;
+
+ self->entry->init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, "ds:n:")) != -1) {
+ switch (opt) {
+ case 'd':
+ data->flag_detached = 1;
+ break;
+ case 's':
+ if (data->newname == NULL)
+ data->newname = xstrdup(optarg);
+ break;
+ case 'n':
+ if (data->winname == NULL)
+ data->winname = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc != 0 && argc != 1)
+ goto usage;
+
+ if (argc == 1)
+ data->cmd = xstrdup(argv[0]);
+
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+ self->entry->free(self);
+ return (-1);
+}
+
+int
+cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_new_session_data *data = self->data;
+ struct client *c = ctx->cmdclient;
+ struct session *s;
+ char *cmd, *cwd, *cause;
+ u_int sx, sy;
+
+ if (ctx->curclient != NULL)
+ return (0);
+
+ if (!data->flag_detached) {
+ if (c == NULL) {
+ ctx->error(ctx, "no client to attach to");
+ return (-1);
+ }
+ if (!(c->flags & CLIENT_TERMINAL)) {
+ ctx->error(ctx, "not a terminal");
+ return (-1);
+ }
+ }
+
+ if (data->newname != NULL && session_find(data->newname) != NULL) {
+ ctx->error(ctx, "duplicate session: %s", data->newname);
+ return (-1);
+ }
+
+ cmd = data->cmd;
+ if (cmd == NULL)
+ cmd = options_get_string(&global_options, "default-command");
+ if (c == NULL || c->cwd == NULL)
+ cwd = options_get_string(&global_options, "default-path");
+ else
+ cwd = c->cwd;
+
+ sx = 80;
+ sy = 25;
+ if (!data->flag_detached) {
+ sx = c->tty.sx;
+ sy = c->tty.sy;
+ }
+
+ if (options_get_number(&global_options, "status")) {
+ if (sy == 0)
+ sy = 1;
+ else
+ sy--;
+ }
+
+ if (!data->flag_detached && tty_open(&c->tty, &cause) != 0) {
+ ctx->error(ctx, "open terminal failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+
+
+ s = session_create(data->newname, cmd, cwd, sx, sy, &cause);
+ if (s == NULL) {
+ ctx->error(ctx, "create session failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+ if (data->winname != NULL) {
+ xfree(s->curw->window->name);
+ s->curw->window->name = xstrdup(data->winname);
+ options_set_number(
+ &s->curw->window->options, "automatic-rename", 0);
+ }
+
+ if (data->flag_detached) {
+ if (c != NULL)
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ } else {
+ c->session = s;
+ server_write_client(c, MSG_READY, NULL, 0);
+ server_redraw_client(c);
+ }
+ recalculate_sizes();
+
+ return (1);
+}
+
+void
+cmd_new_session_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_new_session_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->newname);
+ cmd_send_string(b, data->winname);
+ cmd_send_string(b, data->cmd);
+}
+
+void
+cmd_new_session_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_new_session_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->newname = cmd_recv_string(b);
+ data->winname = cmd_recv_string(b);
+ data->cmd = cmd_recv_string(b);
+}
+
+void
+cmd_new_session_free(struct cmd *self)
+{
+ struct cmd_new_session_data *data = self->data;
+
+ if (data->newname != NULL)
+ xfree(data->newname);
+ if (data->winname != NULL)
+ xfree(data->winname);
+ if (data->cmd != NULL)
+ xfree(data->cmd);
+ xfree(data);
+}
+
+size_t
+cmd_new_session_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_new_session_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ if (off < len && data->flag_detached)
+ off += xsnprintf(buf + off, len - off, " -d");
+ if (off < len && data->newname != NULL)
+ off += cmd_prarg(buf + off, len - off, " -s ", data->newname);
+ if (off < len && data->winname != NULL)
+ off += cmd_prarg(buf + off, len - off, " -n ", data->winname);
+ if (off < len && data->cmd != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->cmd);
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-new-window.c b/tags/TMUX_0_8/cmd-new-window.c
new file mode 100644
index 00000000..76872b5a
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-new-window.c
@@ -0,0 +1,241 @@
+/* $Id: cmd-new-window.c,v 1.31 2009-01-23 16:59:14 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Create a new window.
+ */
+
+int cmd_new_window_parse(struct cmd *, int, char **, char **);
+int cmd_new_window_exec(struct cmd *, struct cmd_ctx *);
+void cmd_new_window_send(struct cmd *, struct buffer *);
+void cmd_new_window_recv(struct cmd *, struct buffer *);
+void cmd_new_window_free(struct cmd *);
+void cmd_new_window_init(struct cmd *, int);
+size_t cmd_new_window_print(struct cmd *, char *, size_t);
+
+struct cmd_new_window_data {
+ char *target;
+ char *name;
+ char *cmd;
+ int flag_detached;
+ int flag_kill;
+};
+
+const struct cmd_entry cmd_new_window_entry = {
+ "new-window", "neww",
+ "[-dk] [-n window-name] [-t target-window] [command]",
+ 0,
+ cmd_new_window_init,
+ cmd_new_window_parse,
+ cmd_new_window_exec,
+ cmd_new_window_send,
+ cmd_new_window_recv,
+ cmd_new_window_free,
+ cmd_new_window_print
+};
+
+void
+cmd_new_window_init(struct cmd *self, unused int arg)
+{
+ struct cmd_new_window_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ data->target = NULL;
+ data->name = NULL;
+ data->cmd = NULL;
+ data->flag_detached = 0;
+ data->flag_kill = 0;
+}
+
+int
+cmd_new_window_parse(struct cmd *self, int argc, char **argv, char **cause)
+{
+ struct cmd_new_window_data *data;
+ int opt;
+
+ self->entry->init(self, 0);
+ data = self->data;
+
+ while ((opt = getopt(argc, argv, "dkt:n:")) != -1) {
+ switch (opt) {
+ case 'd':
+ data->flag_detached = 1;
+ break;
+ case 'k':
+ data->flag_kill = 1;
+ break;
+ case 't':
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
+ break;
+ case 'n':
+ if (data->name == NULL)
+ data->name = xstrdup(optarg);
+ break;
+ default:
+ goto usage;
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc != 0 && argc != 1)
+ goto usage;
+
+ if (argc == 1)
+ data->cmd = xstrdup(argv[0]);
+
+ return (0);
+
+usage:
+ xasprintf(cause, "usage: %s %s", self->entry->name, self->entry->usage);
+
+ self->entry->free(self);
+ return (-1);
+}
+
+int
+cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_new_window_data *data = self->data;
+ struct session *s;
+ struct winlink *wl;
+ char *cmd, *cwd, *cause;
+ int idx;
+
+ if (data == NULL)
+ return (0);
+
+ if (arg_parse_window(data->target, &s, &idx) != 0) {
+ ctx->error(ctx, "bad window: %s", data->target);
+ return (-1);
+ }
+ if (s == NULL)
+ s = ctx->cursession;
+ if (s == NULL)
+ s = cmd_current_session(ctx);
+ if (s == NULL) {
+ ctx->error(ctx, "session not found: %s", data->target);
+ return (-1);
+ }
+
+ wl = NULL;
+ if (idx != -1)
+ wl = winlink_find_by_index(&s->windows, idx);
+ if (wl != NULL) {
+ if (data->flag_kill) {
+ /*
+ * Can't use session_detach as it will destroy session
+ * if this makes it empty.
+ */
+ session_alert_cancel(s, wl);
+ winlink_stack_remove(&s->lastw, wl);
+ winlink_remove(&s->windows, wl);
+
+ /* Force select/redraw if current. */
+ if (wl == s->curw) {
+ data->flag_detached = 0;
+ s->curw = NULL;
+ }
+ }
+ }
+
+ cmd = data->cmd;
+ if (cmd == NULL)
+ cmd = options_get_string(&s->options, "default-command");
+ if (ctx->cmdclient == NULL || ctx->cmdclient->cwd == NULL)
+ cwd = options_get_string(&global_options, "default-path");
+ else
+ cwd = ctx->cmdclient->cwd;
+
+ wl = session_new(s, data->name, cmd, cwd, idx, &cause);
+ if (wl == NULL) {
+ ctx->error(ctx, "create window failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+ if (!data->flag_detached) {
+ session_select(s, wl->idx);
+ server_redraw_session(s);
+ } else
+ server_status_session(s);
+
+ return (0);
+}
+
+void
+cmd_new_window_send(struct cmd *self, struct buffer *b)
+{
+ struct cmd_new_window_data *data = self->data;
+
+ buffer_write(b, data, sizeof *data);
+ cmd_send_string(b, data->target);
+ cmd_send_string(b, data->name);
+ cmd_send_string(b, data->cmd);
+}
+
+void
+cmd_new_window_recv(struct cmd *self, struct buffer *b)
+{
+ struct cmd_new_window_data *data;
+
+ self->data = data = xmalloc(sizeof *data);
+ buffer_read(b, data, sizeof *data);
+ data->target = cmd_recv_string(b);
+ data->name = cmd_recv_string(b);
+ data->cmd = cmd_recv_string(b);
+}
+
+void
+cmd_new_window_free(struct cmd *self)
+{
+ struct cmd_new_window_data *data = self->data;
+
+ if (data->target != NULL)
+ xfree(data->target);
+ if (data->name != NULL)
+ xfree(data->name);
+ if (data->cmd != NULL)
+ xfree(data->cmd);
+ xfree(data);
+}
+
+size_t
+cmd_new_window_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_new_window_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return (off);
+ if (off < len && data->flag_detached)
+ off += xsnprintf(buf + off, len - off, " -d");
+ if (off < len && data->target != NULL)
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
+ if (off < len && data->name != NULL)
+ off += cmd_prarg(buf + off, len - off, " -n ", data->name);
+ if (off < len && data->cmd != NULL)
+ off += cmd_prarg(buf + off, len - off, " ", data->cmd);
+ return (off);
+}
diff --git a/tags/TMUX_0_8/cmd-next-layout.c b/tags/TMUX_0_8/cmd-next-layout.c
new file mode 100644
index 00000000..f5f611f6
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-next-layout.c
@@ -0,0 +1,54 @@
+/* $Id: cmd-next-layout.c,v 1.1 2009-04-01 18:21:26 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Switch window to next layout.
+ */
+
+int cmd_next_layout_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_next_layout_entry = {
+ "next-layout", "nextl",
+ CMD_TARGET_WINDOW_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_next_layout_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_next_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ layout_next(wl->window);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-next-window.c b/tags/TMUX_0_8/cmd-next-window.c
new file mode 100644
index 00000000..cee90af9
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-next-window.c
@@ -0,0 +1,78 @@
+/* $Id: cmd-next-window.c,v 1.16 2009-03-28 14:08:09 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Move to next window.
+ */
+
+void cmd_next_window_init(struct cmd *, int);
+int cmd_next_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_next_window_entry = {
+ "next-window", "next",
+ CMD_TARGET_SESSION_USAGE,
+ CMD_AFLAG,
+ cmd_next_window_init,
+ cmd_target_parse,
+ cmd_next_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+void
+cmd_next_window_init(struct cmd *self, int key)
+{
+ struct cmd_target_data *data;
+
+ cmd_target_init(self, key);
+ data = self->data;
+
+ if (key == KEYC_ADDESC('n'))
+ data->flags |= CMD_AFLAG;
+}
+
+int
+cmd_next_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ int activity;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ activity = 0;
+ if (data->flags & CMD_AFLAG)
+ activity = 1;
+
+ if (session_next(s, activity) == 0)
+ server_redraw_session(s);
+ else {
+ ctx->error(ctx, "no next window");
+ return (-1);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-paste-buffer.c b/tags/TMUX_0_8/cmd-paste-buffer.c
new file mode 100644
index 00000000..2598b39d
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-paste-buffer.c
@@ -0,0 +1,78 @@
+/* $Id: cmd-paste-buffer.c,v 1.15 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Paste paste buffer if present.
+ */
+
+int cmd_paste_buffer_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_paste_buffer_entry = {
+ "paste-buffer", "pasteb",
+ "[-d] " CMD_BUFFER_WINDOW_USAGE,
+ CMD_DFLAG,
+ cmd_buffer_init,
+ cmd_buffer_parse,
+ cmd_paste_buffer_exec,
+ cmd_buffer_send,
+ cmd_buffer_recv,
+ cmd_buffer_free,
+ cmd_buffer_print
+};
+
+int
+cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_buffer_data *data = self->data;
+ struct winlink *wl;
+ struct window *w;
+ struct session *s;
+ struct paste_buffer *pb;
+
+ if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ return (-1);
+ w = wl->window;
+
+ if (data->buffer == -1)
+ pb = paste_get_top(&s->buffers);
+ else {
+ if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
+ }
+
+ if (pb != NULL)
+ buffer_write(w->active->out, pb->data, strlen(pb->data));
+
+ /* Delete the buffer if -d. */
+ if (data->flags & CMD_DFLAG) {
+ if (data->buffer == -1)
+ paste_free_top(&s->buffers);
+ else
+ paste_free_index(&s->buffers, data->buffer);
+ }
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-previous-window.c b/tags/TMUX_0_8/cmd-previous-window.c
new file mode 100644
index 00000000..e9c4124d
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-previous-window.c
@@ -0,0 +1,78 @@
+/* $Id: cmd-previous-window.c,v 1.16 2009-03-28 14:08:09 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Move to previous window.
+ */
+
+void cmd_previous_window_init(struct cmd *, int);
+int cmd_previous_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_previous_window_entry = {
+ "previous-window", "prev",
+ CMD_TARGET_SESSION_USAGE,
+ CMD_AFLAG,
+ cmd_previous_window_init,
+ cmd_target_parse,
+ cmd_previous_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+void
+cmd_previous_window_init(struct cmd *self, int key)
+{
+ struct cmd_target_data *data;
+
+ cmd_target_init(self, key);
+ data = self->data;
+
+ if (key == KEYC_ADDESC('p'))
+ data->flags |= CMD_AFLAG;
+}
+
+int
+cmd_previous_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ int activity;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ activity = 0;
+ if (data->flags & CMD_AFLAG)
+ activity = 1;
+
+ if (session_previous(s, activity) == 0)
+ server_redraw_session(s);
+ else {
+ ctx->error(ctx, "no previous window");
+ return (-1);
+ }
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-refresh-client.c b/tags/TMUX_0_8/cmd-refresh-client.c
new file mode 100644
index 00000000..31168045
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-refresh-client.c
@@ -0,0 +1,54 @@
+/* $Id: cmd-refresh-client.c,v 1.8 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Refresh client.
+ */
+
+int cmd_refresh_client_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_refresh_client_entry = {
+ "refresh-client", "refresh",
+ CMD_TARGET_CLIENT_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_refresh_client_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_refresh_client_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct client *c;
+
+ if ((c = cmd_find_client(ctx, data->target)) == NULL)
+ return (-1);
+
+ server_redraw_client(c);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-rename-session.c b/tags/TMUX_0_8/cmd-rename-session.c
new file mode 100644
index 00000000..02e59fdb
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-rename-session.c
@@ -0,0 +1,57 @@
+/* $Id: cmd-rename-session.c,v 1.15 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Change session name.
+ */
+
+int cmd_rename_session_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_rename_session_entry = {
+ "rename-session", "rename",
+ CMD_TARGET_SESSION_USAGE " new-name",
+ CMD_ARG1,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_rename_session_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_rename_session_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ xfree(s->name);
+ s->name = xstrdup(data->arg);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-rename-window.c b/tags/TMUX_0_8/cmd-rename-window.c
new file mode 100644
index 00000000..d19ca68e
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-rename-window.c
@@ -0,0 +1,61 @@
+/* $Id: cmd-rename-window.c,v 1.26 2009-01-20 19:35:03 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Rename a window.
+ */
+
+int cmd_rename_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_rename_window_entry = {
+ "rename-window", "renamew",
+ CMD_TARGET_WINDOW_USAGE " new-name",
+ CMD_ARG1,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_rename_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_rename_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct session *s;
+ struct winlink *wl;
+
+ if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ return (-1);
+
+ xfree(wl->window->name);
+ wl->window->name = xstrdup(data->arg);
+ options_set_number(&wl->window->options, "automatic-rename", 0);
+
+ server_status_session(s);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-resize-pane-down.c b/tags/TMUX_0_8/cmd-resize-pane-down.c
new file mode 100644
index 00000000..7f85614c
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-resize-pane-down.c
@@ -0,0 +1,122 @@
+/* $Id: cmd-resize-pane-down.c,v 1.8 2009-04-02 21:11:52 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Decrease pane size.
+ */
+
+void cmd_resize_pane_down_init(struct cmd *, int);
+int cmd_resize_pane_down_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_resize_pane_down_entry = {
+ "resize-pane-down", "resizep-down",
+ CMD_PANE_WINDOW_USAGE " [adjustment]",
+ CMD_ARG01,
+ cmd_resize_pane_down_init,
+ cmd_pane_parse,
+ cmd_resize_pane_down_exec,
+ cmd_pane_send,
+ cmd_pane_recv,
+ cmd_pane_free,
+ cmd_pane_print
+};
+
+void
+cmd_resize_pane_down_init(struct cmd *self, int key)
+{
+ struct cmd_pane_data *data;
+
+ cmd_pane_init(self, key);
+ data = self->data;
+
+ if (key == KEYC_ADDESC(KEYC_DOWN))
+ data->arg = xstrdup("5");
+}
+
+int
+cmd_resize_pane_down_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_pane_data *data = self->data;
+ struct winlink *wl;
+ const char *errstr;
+ struct window_pane *wp, *wq;
+ u_int adjust;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ if (wl->window->layout != 0) {
+ ctx->error(ctx, "window not in manual layout");
+ return (-1);
+ }
+ if (data->pane == -1)
+ wp = wl->window->active;
+ else {
+ wp = window_pane_at_index(wl->window, data->pane);
+ if (wp == NULL) {
+ ctx->error(ctx, "no pane: %d", data->pane);
+ return (-1);
+ }
+ }
+
+ if (data->arg == NULL)
+ adjust = 1;
+ else {
+ adjust = strtonum(data->arg, 1, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ ctx->error(ctx, "adjustment %s: %s", errstr, data->arg);
+ return (-1);
+ }
+ }
+
+ /*
+ * If this is not the last window, keep trying to increase size and
+ * remove it from the next windows. If it is the last, do so on the
+ * previous window.
+ */
+ if (TAILQ_NEXT(wp, entry) == NULL) {
+ if (wp == TAILQ_FIRST(&wl->window->panes)) {
+ /* Only one pane. */
+ return (0);
+ }
+ wp = TAILQ_PREV(wp, window_panes, entry);
+ }
+ while (adjust-- > 0) {
+ wq = wp;
+ while ((wq = TAILQ_NEXT(wq, entry)) != NULL) {
+ if (wq->sy > PANE_MINIMUM) {
+ window_pane_resize(wq, wq->sx, wq->sy - 1);
+ break;
+ }
+ }
+ if (wq == NULL)
+ break;
+ window_pane_resize(wp, wp->sx, wp->sy + 1);
+
+ }
+ window_update_panes(wl->window);
+
+ server_redraw_window(wl->window);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-resize-pane-up.c b/tags/TMUX_0_8/cmd-resize-pane-up.c
new file mode 100644
index 00000000..11d102b9
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-resize-pane-up.c
@@ -0,0 +1,117 @@
+/* $Id: cmd-resize-pane-up.c,v 1.8 2009-04-02 21:11:52 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Increase pane size.
+ */
+
+void cmd_resize_pane_up_init(struct cmd *, int);
+int cmd_resize_pane_up_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_resize_pane_up_entry = {
+ "resize-pane-up", "resizep-up",
+ CMD_PANE_WINDOW_USAGE " [adjustment]",
+ CMD_ARG01,
+ cmd_resize_pane_up_init,
+ cmd_pane_parse,
+ cmd_resize_pane_up_exec,
+ cmd_pane_send,
+ cmd_pane_recv,
+ cmd_pane_free,
+ cmd_pane_print
+};
+
+void
+cmd_resize_pane_up_init(struct cmd *self, int key)
+{
+ struct cmd_pane_data *data;
+
+ cmd_pane_init(self, key);
+ data = self->data;
+
+ if (key == KEYC_ADDESC(KEYC_UP))
+ data->arg = xstrdup("5");
+}
+
+int
+cmd_resize_pane_up_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_pane_data *data = self->data;
+ struct winlink *wl;
+ const char *errstr;
+ struct window_pane *wp, *wq;
+ u_int adjust;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ if (wl->window->layout != 0) {
+ ctx->error(ctx, "window not in manual layout");
+ return (-1);
+ }
+ if (data->pane == -1)
+ wp = wl->window->active;
+ else {
+ wp = window_pane_at_index(wl->window, data->pane);
+ if (wp == NULL) {
+ ctx->error(ctx, "no pane: %d", data->pane);
+ return (-1);
+ }
+ }
+
+ if (data->arg == NULL)
+ adjust = 1;
+ else {
+ adjust = strtonum(data->arg, 1, INT_MAX, &errstr);
+ if (errstr != NULL) {
+ ctx->error(ctx, "adjustment %s: %s", errstr, data->arg);
+ return (-1);
+ }
+ }
+
+ /*
+ * If this is not the last window, keep trying to reduce size and add
+ * to the following window. If it is the last, do so on the previous
+ * window.
+ */
+ wq = TAILQ_NEXT(wp, entry);
+ if (wq == NULL) {
+ if (wp == TAILQ_FIRST(&wl->window->panes)) {
+ /* Only one pane. */
+ return (0);
+ }
+ wq = wp;
+ wp = TAILQ_PREV(wq, window_panes, entry);
+ }
+ while (adjust-- > 0) {
+ if (wp->sy <= PANE_MINIMUM)
+ break;
+ window_pane_resize(wq, wq->sx, wq->sy + 1);
+ window_pane_resize(wp, wp->sx, wp->sy - 1);
+ }
+ window_update_panes(wl->window);
+
+ server_redraw_window(wl->window);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-respawn-window.c b/tags/TMUX_0_8/cmd-respawn-window.c
new file mode 100644
index 00000000..bf3bfa6c
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-respawn-window.c
@@ -0,0 +1,87 @@
+/* $Id: cmd-respawn-window.c,v 1.14 2009-03-04 17:24:07 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * Respawn a window (restart the command). Kill existing if -k given.
+ */
+
+int cmd_respawn_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_respawn_window_entry = {
+ "respawn-window", "respawnw",
+ "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
+ CMD_ARG01|CMD_KFLAG,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_respawn_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+ struct window *w;
+ struct window_pane *wp;
+ struct session *s;
+ const char **env;
+ char *cause;
+
+ if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
+ return (-1);
+ w = wl->window;
+
+ if (!(data->flags & CMD_KFLAG)) {
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ if (wp->fd == -1)
+ continue;
+ ctx->error(ctx,
+ "window still active: %s:%d", s->name, wl->idx);
+ return (-1);
+ }
+ }
+
+ env = server_fill_environ(s);
+
+ wp = TAILQ_FIRST(&w->panes);
+ TAILQ_REMOVE(&w->panes, wp, entry);
+ window_destroy_panes(w);
+ TAILQ_INSERT_HEAD(&w->panes, wp, entry);
+ window_pane_resize(wp, w->sx, w->sy);
+ if (window_pane_spawn(wp, data->arg, NULL, env, &cause) != 0) {
+ ctx->error(ctx, "respawn window failed: %s", cause);
+ xfree(cause);
+ return (-1);
+ }
+ screen_reinit(&wp->base);
+
+ recalculate_sizes();
+ server_redraw_window(w);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-rotate-window.c b/tags/TMUX_0_8/cmd-rotate-window.c
new file mode 100644
index 00000000..ce21d513
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-rotate-window.c
@@ -0,0 +1,111 @@
+/* $Id: cmd-rotate-window.c,v 1.2 2009-04-21 20:06:46 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Rotate the panes in a window.
+ */
+
+void cmd_rotate_window_init(struct cmd *, int);
+int cmd_rotate_window_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_rotate_window_entry = {
+ "rotate-window", "rotatew",
+ "[-DU] " CMD_TARGET_WINDOW_USAGE,
+ CMD_UPPERUFLAG|CMD_UPPERDFLAG,
+ cmd_rotate_window_init,
+ cmd_target_parse,
+ cmd_rotate_window_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+void
+cmd_rotate_window_init(struct cmd *self, int key)
+{
+ struct cmd_target_data *data;
+
+ cmd_target_init(self, key);
+ data = self->data;
+
+ if (key == KEYC_ADDESC('o'))
+ data->flags |= CMD_UPPERDFLAG;
+}
+
+int
+cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+ struct window *w;
+ struct window_pane *wp, *wp2;
+ u_int sx, sy, xoff, yoff;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ w = wl->window;
+
+ if (data->flags & CMD_UPPERDFLAG) {
+ wp = TAILQ_LAST(&w->panes, window_panes);
+ TAILQ_REMOVE(&w->panes, wp, entry);
+ TAILQ_INSERT_HEAD(&w->panes, wp, entry);
+
+ xoff = wp->xoff; yoff = wp->yoff;
+ sx = wp->sx; sy = wp->sy;
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ if ((wp2 = TAILQ_NEXT(wp, entry)) == NULL)
+ break;
+ wp->xoff = wp2->xoff; wp->yoff = wp2->yoff;
+ window_pane_resize(wp, wp2->sx, wp2->sy);
+ }
+ wp->xoff = xoff; wp->yoff = yoff;
+ window_pane_resize(wp, sx, sy);
+
+ if ((wp = TAILQ_PREV(w->active, window_panes, entry)) == NULL)
+ wp = TAILQ_LAST(&w->panes, window_panes);
+ window_set_active_pane(w, wp);
+ } else {
+ wp = TAILQ_FIRST(&w->panes);
+ TAILQ_REMOVE(&w->panes, wp, entry);
+ TAILQ_INSERT_TAIL(&w->panes, wp, entry);
+
+ xoff = wp->xoff; yoff = wp->yoff;
+ sx = wp->sx; sy = wp->sy;
+ TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
+ if ((wp2 = TAILQ_PREV(wp, window_panes, entry)) == NULL)
+ break;
+ wp->xoff = wp2->xoff; wp->yoff = wp2->yoff;
+ window_pane_resize(wp, wp2->sx, wp2->sy);
+ }
+ wp->xoff = xoff; wp->yoff = yoff;
+ window_pane_resize(wp, sx, sy);
+
+ if ((wp = TAILQ_NEXT(w->active, entry)) == NULL)
+ wp = TAILQ_FIRST(&w->panes);
+ window_set_active_pane(w, wp);
+ }
+
+ layout_refresh(w, 0);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-save-buffer.c b/tags/TMUX_0_8/cmd-save-buffer.c
new file mode 100644
index 00000000..a2bc29cd
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-save-buffer.c
@@ -0,0 +1,90 @@
+/* $Id: cmd-save-buffer.c,v 1.4 2009-02-08 13:36:40 tcunha Exp $ */
+
+/*
+ * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <string.h>
+
+#include "tmux.h"
+
+/*
+ * Saves a session paste buffer to a file.
+ */
+
+int cmd_save_buffer_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_save_buffer_entry = {
+ "save-buffer", "saveb",
+ "[-a] " CMD_BUFFER_SESSION_USAGE " path",
+ CMD_AFLAG|CMD_ARG1,
+ cmd_buffer_init,
+ cmd_buffer_parse,
+ cmd_save_buffer_exec,
+ cmd_buffer_send,
+ cmd_buffer_recv,
+ cmd_buffer_free,
+ cmd_buffer_print
+};
+
+int
+cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_buffer_data *data = self->data;
+ struct session *s;
+ struct paste_buffer *pb;
+ mode_t mask;
+ FILE *f;
+
+ if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (data->buffer == -1) {
+ if ((pb = paste_get_top(&s->buffers)) == NULL) {
+ ctx->error(ctx, "no buffers");
+ return (-1);
+ }
+ } else {
+ if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
+ }
+
+ mask = umask(S_IRWXG | S_IRWXO);
+ if (data->flags & CMD_AFLAG)
+ f = fopen(data->arg, "a");
+ else
+ f = fopen(data->arg, "w");
+ if (f == NULL) {
+ ctx->error(ctx, "%s: %s", data->arg, strerror(errno));
+ return (-1);
+ }
+
+ if (fwrite(pb->data, 1, strlen(pb->data), f) != strlen(pb->data)) {
+ ctx->error(ctx, "%s: fwrite error", data->arg);
+ fclose(f);
+ return (-1);
+ }
+
+ fclose(f);
+ umask(mask);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-scroll-mode.c b/tags/TMUX_0_8/cmd-scroll-mode.c
new file mode 100644
index 00000000..e6f9d721
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-scroll-mode.c
@@ -0,0 +1,72 @@
+/* $Id: cmd-scroll-mode.c,v 1.16 2009-01-27 23:35:44 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Enter scroll mode.
+ */
+
+void cmd_scroll_mode_init(struct cmd *, int);
+int cmd_scroll_mode_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_scroll_mode_entry = {
+ "scroll-mode", NULL,
+ CMD_TARGET_WINDOW_USAGE,
+ CMD_UFLAG,
+ cmd_scroll_mode_init,
+ cmd_target_parse,
+ cmd_scroll_mode_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+void
+cmd_scroll_mode_init(struct cmd *self, int key)
+{
+ struct cmd_target_data *data;
+
+ cmd_target_init(self, key);
+ data = self->data;
+
+ switch (key) {
+ case KEYC_PPAGE:
+ data->flags |= CMD_UFLAG;
+ break;
+ }
+}
+
+int
+cmd_scroll_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct winlink *wl;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+
+ window_pane_set_mode(wl->window->active, &window_scroll_mode);
+ if (data->flags & CMD_UFLAG)
+ window_scroll_pageup(wl->window->active);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-select-pane.c b/tags/TMUX_0_8/cmd-select-pane.c
new file mode 100644
index 00000000..71175942
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-select-pane.c
@@ -0,0 +1,69 @@
+/* $Id: cmd-select-pane.c,v 1.4 2009-04-01 21:10:08 nicm Exp $ */
+
+/*
+ * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include "tmux.h"
+
+/*
+ * Select pane.
+ */
+
+int cmd_select_pane_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_select_pane_entry = {
+ "select-pane", "selectp",
+ CMD_PANE_WINDOW_USAGE,
+ 0,
+ cmd_pane_init,
+ cmd_pane_parse,
+ cmd_select_pane_exec,
+ cmd_pane_send,
+ cmd_pane_recv,
+ cmd_pane_free,
+ cmd_pane_print
+};
+
+int
+cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_pane_data *data = self->data;
+ struct winlink *wl;
+ struct window_pane *wp;
+
+ if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ return (-1);
+ if (data->pane == -1)
+ wp = wl->window->active;
+ else {
+ wp = window_pane_at_index(wl->window, data->pane);
+ if (wp == NULL) {
+ ctx->error(ctx, "no pane: %d", data->pane);
+ return (-1);
+ }
+ }
+
+ if (wp->flags & PANE_HIDDEN) {
+ ctx->error(ctx, "pane %d is hidden", data->pane);
+ return (-1);
+ }
+ window_set_active_pane(wl->window, wp);
+ layout_refresh(wl->window, 1);
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-select-prompt.c b/tags/TMUX_0_8/cmd-select-prompt.c
new file mode 100644
index 00000000..8de9d158
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-select-prompt.c
@@ -0,0 +1,93 @@
+/* $Id: cmd-select-prompt.c,v 1.7 2009-02-13 18:57:55 nicm Exp $ */
+
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Prompt for window index and select it.
+ */
+
+int cmd_select_prompt_exec(struct cmd *, struct cmd_ctx *);
+
+int cmd_select_prompt_callback(void *, const char *);
+
+const struct cmd_entry cmd_select_prompt_entry = {
+ "select-prompt", NULL,
+ CMD_TARGET_CLIENT_USAGE,
+ 0,
+ cmd_target_init,
+ cmd_target_parse,
+ cmd_select_prompt_exec,
+ cmd_target_send,
+ cmd_target_recv,
+ cmd_target_free,
+ cmd_target_print
+};
+
+int
+cmd_select_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct cmd_target_data *data = self->data;
+ struct client *c;
+
+ if ((c = cmd_find_client(ctx, data->target)) == NULL)
+ return (-1);
+
+ if (c->prompt_string != NULL)
+ return (0);
+
+ status_prompt_set(c, "index ", cmd_select_prompt_callback, c, 0);
+
+ return (0);
+}
+
+int
+cmd_select_prompt_callback(void *data, const char *s)
+{
+ struct client *c = data;
+ const char *errstr;
+ char msg[128];
+ u_int idx;
+
+ if (s == NULL)
+ return (0);
+
+ idx = strtonum(s, 0, UINT_MAX, &errstr);
+ if (errstr != NULL) {
+ xsnprintf(msg, sizeof msg, "Index %s: %s", errstr, s);
+ status_message_set(c, msg);
+ return (0);
+ }
+
+ if (winlink_find_by_index(&c->session->windows, idx) == NULL) {
+ xsnprintf(msg, sizeof msg,
+ "Window not found: %s:%d", c->session->name, idx);
+ status_message_set(c, msg);
+ return (0);
+ }
+
+ if (session_select(c->session, idx) == 0)
+ server_redraw_session(c->session);
+ recalculate_sizes();
+
+ return (0);
+}
diff --git a/tags/TMUX_0_8/cmd-select-window.c b/tags/TMUX_0_8/cmd-select-window.c
new file mode 100644
index 00000000..a5780769
--- /dev/null
+++ b/tags/TMUX_0_8/cmd-select-window.c
@@ -0,0 +1,71 @@
+/* $Id: cmd-select-window.c,v 1.21 2009-01-19 18:23:40 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+#include "tmux.h"
+
+/*
+ * Sel