Clean up and simplify tmux command argument parsing.
commit7502cb3adbb26a2f94445a35626e64041d6769f9
authorNicholas Marriott <nicm@openbsd.org>
Tue, 4 Jan 2011 00:42:46 +0000 (4 00:42 +0000)
committerNicholas Marriott <nicm@openbsd.org>
Tue, 4 Jan 2011 00:42:46 +0000 (4 00:42 +0000)
tree6ae4f33f69dc0a470dbe905b5140216fb19b8f01
parentac3b78a84178a308536a56ea114b0f6f8ce6fb47
Clean up and simplify tmux command argument parsing.

Originally, tmux commands were parsed in the client process into a
struct with the command data which was then serialised and sent to the
server to be executed. The parsing was later moved into the server (an
argv was sent from the client), but the parse step and intermediate
struct was kept.

This change removes that struct and the separate parse step. Argument
parsing and printing is now common to all commands (in arguments.c) with
each command left with just an optional check function (to validate the
arguments at parse time), the exec function and a function to set up any
key bindings (renamed from the old init function).

This is overall more simple and consistent.

There should be no changes to any commands behaviour or syntax although
as this touches every command please watch for any unexpected changes.
86 files changed:
Makefile
arguments.c [new file with mode: 0644]
cmd-attach-session.c
cmd-bind-key.c
cmd-break-pane.c
cmd-capture-pane.c
cmd-choose-buffer.c
cmd-choose-client.c
cmd-choose-session.c
cmd-choose-window.c
cmd-clear-history.c
cmd-clock-mode.c
cmd-command-prompt.c
cmd-confirm-before.c
cmd-copy-mode.c
cmd-delete-buffer.c
cmd-detach-client.c
cmd-display-message.c
cmd-display-panes.c
cmd-find-window.c
cmd-generic.c [deleted file]
cmd-has-session.c
cmd-if-shell.c
cmd-join-pane.c
cmd-kill-pane.c
cmd-kill-server.c
cmd-kill-session.c
cmd-kill-window.c
cmd-last-pane.c
cmd-last-window.c
cmd-link-window.c
cmd-list-buffers.c
cmd-list-clients.c
cmd-list-commands.c
cmd-list-keys.c
cmd-list-panes.c
cmd-list-sessions.c
cmd-list-windows.c
cmd-load-buffer.c
cmd-lock-client.c
cmd-lock-server.c
cmd-lock-session.c
cmd-move-window.c
cmd-new-session.c
cmd-new-window.c
cmd-next-layout.c
cmd-next-window.c
cmd-paste-buffer.c
cmd-pipe-pane.c
cmd-previous-layout.c
cmd-previous-window.c
cmd-refresh-client.c
cmd-rename-session.c
cmd-rename-window.c
cmd-resize-pane.c
cmd-respawn-window.c
cmd-rotate-window.c
cmd-run-shell.c
cmd-save-buffer.c
cmd-select-layout.c
cmd-select-pane.c
cmd-select-window.c
cmd-send-keys.c [copied from cmd-lock-server.c with 55% similarity]
cmd-send-prefix.c
cmd-server-info.c
cmd-set-buffer.c
cmd-set-environment.c
cmd-set-option.c
cmd-set-window-option.c
cmd-show-buffer.c
cmd-show-environment.c
cmd-show-messages.c
cmd-show-options.c
cmd-show-window-options.c
cmd-source-file.c
cmd-split-window.c
cmd-start-server.c
cmd-suspend-client.c
cmd-swap-pane.c
cmd-swap-window.c
cmd-switch-client.c
cmd-unbind-key.c
cmd-unlink-window.c
cmd.c
key-bindings.c
tmux.h