aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2021-08-21 12:01:41 +0100
committerThomas Adam <thomas@xteddy.org>2021-08-21 12:01:41 +0100
commit62036121fa3f69a93031f90956e659e090d79a1f (patch)
treeff1f52ad0c756d30e0dcc53adf8efd775da80c5a
parentb0da0cee4d54aa64db0f49eee509a76fd89d6f68 (diff)
parent110ba767e591946d6784acef87737850f2ad3ae9 (diff)
downloadrtmux-62036121fa3f69a93031f90956e659e090d79a1f.tar.gz
rtmux-62036121fa3f69a93031f90956e659e090d79a1f.tar.bz2
rtmux-62036121fa3f69a93031f90956e659e090d79a1f.zip
Merge branch 'obsd-master' into master
-rw-r--r--arguments.c21
-rw-r--r--cmd-attach-session.c2
-rw-r--r--cmd-bind-key.c2
-rw-r--r--cmd-break-pane.c2
-rw-r--r--cmd-capture-pane.c4
-rw-r--r--cmd-choose-tree.c8
-rw-r--r--cmd-command-prompt.c2
-rw-r--r--cmd-confirm-before.c2
-rw-r--r--cmd-copy-mode.c4
-rw-r--r--cmd-detach-client.c4
-rw-r--r--cmd-display-menu.c4
-rw-r--r--cmd-display-message.c2
-rw-r--r--cmd-display-panes.c2
-rw-r--r--cmd-find-window.c2
-rw-r--r--cmd-if-shell.c2
-rw-r--r--cmd-join-pane.c4
-rw-r--r--cmd-kill-pane.c2
-rw-r--r--cmd-kill-server.c4
-rw-r--r--cmd-kill-session.c2
-rw-r--r--cmd-kill-window.c4
-rw-r--r--cmd-list-buffers.c2
-rw-r--r--cmd-list-clients.c2
-rw-r--r--cmd-list-keys.c4
-rw-r--r--cmd-list-panes.c2
-rw-r--r--cmd-list-sessions.c2
-rw-r--r--cmd-list-windows.c2
-rw-r--r--cmd-load-buffer.c2
-rw-r--r--cmd-lock-server.c6
-rw-r--r--cmd-move-window.c4
-rw-r--r--cmd-new-session.c6
-rw-r--r--cmd-new-window.c4
-rw-r--r--cmd-paste-buffer.c2
-rw-r--r--cmd-pipe-pane.c2
-rw-r--r--cmd-queue.c2
-rw-r--r--cmd-refresh-client.c6
-rw-r--r--cmd-rename-session.c2
-rw-r--r--cmd-rename-window.c2
-rw-r--r--cmd-resize-pane.c5
-rw-r--r--cmd-resize-window.c5
-rw-r--r--cmd-respawn-pane.c4
-rw-r--r--cmd-respawn-window.c4
-rw-r--r--cmd-rotate-window.c2
-rw-r--r--cmd-run-shell.c2
-rw-r--r--cmd-save-buffer.c4
-rw-r--r--cmd-select-layout.c6
-rw-r--r--cmd-select-pane.c4
-rw-r--r--cmd-select-window.c8
-rw-r--r--cmd-send-keys.c4
-rw-r--r--cmd-set-buffer.c4
-rw-r--r--cmd-set-environment.c2
-rw-r--r--cmd-set-option.c6
-rw-r--r--cmd-show-environment.c2
-rw-r--r--cmd-show-messages.c2
-rw-r--r--cmd-show-options.c6
-rw-r--r--cmd-show-prompt-history.c4
-rw-r--r--cmd-source-file.c2
-rw-r--r--cmd-split-window.c4
-rw-r--r--cmd-swap-pane.c2
-rw-r--r--cmd-swap-window.c2
-rw-r--r--cmd-switch-client.c2
-rw-r--r--cmd-unbind-key.c2
-rw-r--r--cmd-wait-for.c2
-rw-r--r--cmd.c3
-rw-r--r--tmux.h19
64 files changed, 123 insertions, 120 deletions
diff --git a/arguments.c b/arguments.c
index 92072ad5..6466ea76 100644
--- a/arguments.c
+++ b/arguments.c
@@ -78,7 +78,7 @@ args_create(void)
/* Parse an argv and argc into a new argument set. */
struct args *
-args_parse(const char *template, int argc, char **argv, int lower, int upper)
+args_parse(const struct args_parse *parse, int argc, char **argv)
{
struct args *args;
int opt;
@@ -88,10 +88,10 @@ args_parse(const char *template, int argc, char **argv, int lower, int upper)
optarg = NULL;
args = args_create();
- while ((opt = getopt(argc, argv, template)) != -1) {
+ while ((opt = getopt(argc, argv, parse->template)) != -1) {
if (opt < 0)
continue;
- if (opt == '?' || strchr(template, opt) == NULL) {
+ if (opt == '?' || strchr(parse->template, opt) == NULL) {
args_free(args);
return (NULL);
}
@@ -104,7 +104,8 @@ args_parse(const char *template, int argc, char **argv, int lower, int upper)
args->argc = argc;
args->argv = cmd_copy_argv(argc, argv);
- if ((lower != -1 && argc < lower) || (upper != -1 && argc > upper)) {
+ if ((parse->lower != -1 && argc < parse->lower) ||
+ (parse->upper != -1 && argc > parse->upper)) {
args_free(args);
return (NULL);
}
@@ -126,7 +127,7 @@ args_free(struct args *args)
RB_REMOVE(args_tree, &args->tree, entry);
TAILQ_FOREACH_SAFE(value, &entry->values, entry, value1) {
TAILQ_REMOVE(&entry->values, value, entry);
- free(value->value);
+ free(value->string);
free(value);
}
free(entry);
@@ -208,7 +209,7 @@ args_print(struct args *args)
args_print_add(&buf, &len, " -%c", entry->flag);
else
args_print_add(&buf, &len, "-%c", entry->flag);
- args_print_add_argument(&buf, &len, value->value);
+ args_print_add_argument(&buf, &len, value->string);
}
}
@@ -297,7 +298,7 @@ args_set(struct args *args, u_char flag, const char *s)
if (s != NULL) {
value = xcalloc(1, sizeof *value);
- value->value = xstrdup(s);
+ value->string = xstrdup(s);
TAILQ_INSERT_TAIL(&entry->values, value, entry);
}
}
@@ -312,7 +313,7 @@ args_get(struct args *args, u_char flag)
return (NULL);
if (TAILQ_EMPTY(&entry->values))
return (NULL);
- return (TAILQ_LAST(&entry->values, args_values)->value);
+ return (TAILQ_LAST(&entry->values, args_values)->string);
}
/* Get first argument. */
@@ -385,7 +386,7 @@ args_strtonum(struct args *args, u_char flag, long long minval,
}
value = TAILQ_LAST(&entry->values, args_values);
- ll = strtonum(value->value, minval, maxval, &errstr);
+ ll = strtonum(value->string, minval, maxval, &errstr);
if (errstr != NULL) {
*cause = xstrdup(errstr);
return (0);
@@ -407,7 +408,7 @@ args_percentage(struct args *args, u_char flag, long long minval,
*cause = xstrdup("missing");
return (0);
}
- value = TAILQ_LAST(&entry->values, args_values)->value;
+ value = TAILQ_LAST(&entry->values, args_values)->string;
return (args_string_percentage(value, minval, maxval, curval, cause));
}
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index c2074f4f..cc795b22 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -37,7 +37,7 @@ const struct cmd_entry cmd_attach_session_entry = {
.name = "attach-session",
.alias = "attach",
- .args = { "c:dEf:rt:x", 0, 0 },
+ .args = { "c:dEf:rt:x", 0, 0, NULL },
.usage = "[-dErx] [-c working-directory] [-f flags] "
CMD_TARGET_SESSION_USAGE,
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 87dd3cf7..a16d054e 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_bind_key_entry = {
.name = "bind-key",
.alias = "bind",
- .args = { "nrN:T:", 1, -1 },
+ .args = { "nrN:T:", 1, -1, NULL },
.usage = "[-nr] [-T key-table] [-N note] key "
"[command [arguments]]",
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 4c436405..4f38d4bd 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_break_pane_entry = {
.name = "break-pane",
.alias = "breakp",
- .args = { "abdPF:n:s:t:", 0, 0 },
+ .args = { "abdPF:n:s:t:", 0, 0, NULL },
.usage = "[-abdP] [-F format] [-n window-name] [-s src-pane] "
"[-t dst-window]",
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index 6f37bc8f..964f831e 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane",
.alias = "capturep",
- .args = { "ab:CeE:JNpPqS:t:", 0, 0 },
+ .args = { "ab:CeE:JNpPqS:t:", 0, 0, NULL },
.usage = "[-aCeJNpPq] " CMD_BUFFER_USAGE " [-E end-line] "
"[-S start-line] " CMD_TARGET_PANE_USAGE,
@@ -53,7 +53,7 @@ const struct cmd_entry cmd_clear_history_entry = {
.name = "clear-history",
.alias = "clearhist",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c
index 81209ee3..9258f366 100644
--- a/cmd-choose-tree.c
+++ b/cmd-choose-tree.c
@@ -30,7 +30,7 @@ const struct cmd_entry cmd_choose_tree_entry = {
.name = "choose-tree",
.alias = NULL,
- .args = { "F:f:GK:NO:rst:wZ", 0, 1 },
+ .args = { "F:f:GK:NO:rst:wZ", 0, 1, NULL },
.usage = "[-GNrswZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_choose_client_entry = {
.name = "choose-client",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1 },
+ .args = { "F:f:K:NO:rt:Z", 0, 1, NULL },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -58,7 +58,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
.name = "choose-buffer",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1 },
+ .args = { "F:f:K:NO:rt:Z", 0, 1, NULL },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
@@ -72,7 +72,7 @@ const struct cmd_entry cmd_customize_mode_entry = {
.name = "customize-mode",
.alias = NULL,
- .args = { "F:f:Nt:Z", 0, 0 },
+ .args = { "F:f:Nt:Z", 0, 0, NULL },
.usage = "[-NZ] [-F format] [-f filter] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index 25ec6817..f80760ce 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -40,7 +40,7 @@ const struct cmd_entry cmd_command_prompt_entry = {
.name = "command-prompt",
.alias = NULL,
- .args = { "1bFkiI:Np:t:T:", 0, 1 },
+ .args = { "1bFkiI:Np:t:T:", 0, 1, NULL },
.usage = "[-1bFkiN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE
" [-T type] [template]",
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index 9f179aaf..580c379a 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_confirm_before_entry = {
.name = "confirm-before",
.alias = "confirm",
- .args = { "bp:t:", 1, 1 },
+ .args = { "bp:t:", 1, 1, NULL },
.usage = "[-b] [-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
.flags = CMD_CLIENT_TFLAG,
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index d8b4fd3e..8f698ce8 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -30,7 +30,7 @@ const struct cmd_entry cmd_copy_mode_entry = {
.name = "copy-mode",
.alias = NULL,
- .args = { "eHMs:t:uq", 0, 0 },
+ .args = { "eHMs:t:uq", 0, 0, NULL },
.usage = "[-eHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE,
.source = { 's', CMD_FIND_PANE, 0 },
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_clock_mode_entry = {
.name = "clock-mode",
.alias = NULL,
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 02a43f4e..661293ae 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_detach_client_entry = {
.name = "detach-client",
.alias = "detach",
- .args = { "aE:s:t:P", 0, 0 },
+ .args = { "aE:s:t:P", 0, 0, NULL },
.usage = "[-aP] [-E shell-command] "
"[-s target-session] " CMD_TARGET_CLIENT_USAGE,
@@ -47,7 +47,7 @@ const struct cmd_entry cmd_suspend_client_entry = {
.name = "suspend-client",
.alias = "suspendc",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_CLIENT_USAGE,
.flags = CMD_CLIENT_TFLAG,
diff --git a/cmd-display-menu.c b/cmd-display-menu.c
index 49ddf13d..f57cf464 100644
--- a/cmd-display-menu.c
+++ b/cmd-display-menu.c
@@ -36,7 +36,7 @@ const struct cmd_entry cmd_display_menu_entry = {
.name = "display-menu",
.alias = "menu",
- .args = { "c:t:OT:x:y:", 1, -1 },
+ .args = { "c:t:OT:x:y:", 1, -1, NULL },
.usage = "[-O] [-c target-client] " CMD_TARGET_PANE_USAGE " [-T title] "
"[-x position] [-y position] name key command ...",
@@ -50,7 +50,7 @@ const struct cmd_entry cmd_display_popup_entry = {
.name = "display-popup",
.alias = "popup",
- .args = { "BCc:d:Eh:t:w:x:y:", 0, -1 },
+ .args = { "BCc:d:Eh:t:w:x:y:", 0, -1, NULL },
.usage = "[-BCE] [-c target-client] [-d start-directory] [-h height] "
CMD_TARGET_PANE_USAGE " [-w width] "
"[-x position] [-y position] [command]",
diff --git a/cmd-display-message.c b/cmd-display-message.c
index f4d41e6c..596f0b5c 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_display_message_entry = {
.name = "display-message",
.alias = "display",
- .args = { "ac:d:INpt:F:v", 0, 1 },
+ .args = { "ac:d:INpt:F:v", 0, 1, NULL },
.usage = "[-aINpv] [-c target-client] [-d delay] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
diff --git a/cmd-display-panes.c b/cmd-display-panes.c
index 59484872..bc171638 100644
--- a/cmd-display-panes.c
+++ b/cmd-display-panes.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_display_panes_entry = {
.name = "display-panes",
.alias = "displayp",
- .args = { "bd:Nt:", 0, 1 },
+ .args = { "bd:Nt:", 0, 1, NULL },
.usage = "[-bN] [-d duration] " CMD_TARGET_CLIENT_USAGE " [template]",
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG,
diff --git a/cmd-find-window.c b/cmd-find-window.c
index 691baf85..804e8fe4 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_find_window_entry = {
.name = "find-window",
.alias = "findw",
- .args = { "CiNrt:TZ", 1, 1 },
+ .args = { "CiNrt:TZ", 1, 1, NULL },
.usage = "[-CiNrTZ] " CMD_TARGET_PANE_USAGE " match-string",
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index df06a0b6..28e9b5d1 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_if_shell_entry = {
.name = "if-shell",
.alias = "if",
- .args = { "bFt:", 2, 3 },
+ .args = { "bFt:", 2, 3, NULL },
.usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command "
"[command]",
diff --git a/cmd-join-pane.c b/cmd-join-pane.c
index d860eeb1..cb3fb343 100644
--- a/cmd-join-pane.c
+++ b/cmd-join-pane.c
@@ -35,7 +35,7 @@ const struct cmd_entry cmd_join_pane_entry = {
.name = "join-pane",
.alias = "joinp",
- .args = { "bdfhvp:l:s:t:", 0, 0 },
+ .args = { "bdfhvp:l:s:t:", 0, 0, NULL },
.usage = "[-bdfhv] [-l size] " CMD_SRCDST_PANE_USAGE,
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
@@ -49,7 +49,7 @@ const struct cmd_entry cmd_move_pane_entry = {
.name = "move-pane",
.alias = "movep",
- .args = { "bdfhvp:l:s:t:", 0, 0 },
+ .args = { "bdfhvp:l:s:t:", 0, 0, NULL },
.usage = "[-bdfhv] [-l size] " CMD_SRCDST_PANE_USAGE,
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
index 3bf6e26e..e1134a1e 100644
--- a/cmd-kill-pane.c
+++ b/cmd-kill-pane.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_kill_pane_entry = {
.name = "kill-pane",
.alias = "killp",
- .args = { "at:", 0, 0 },
+ .args = { "at:", 0, 0, NULL },
.usage = "[-a] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 76bcf267..7bb79e3d 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_kill_server_entry = {
.name = "kill-server",
.alias = NULL,
- .args = { "", 0, 0 },
+ .args = { "", 0, 0, NULL },
.usage = "",
.flags = 0,
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_start_server_entry = {
.name = "start-server",
.alias = "start",
- .args = { "", 0, 0 },
+ .args = { "", 0, 0, NULL },
.usage = "",
.flags = CMD_STARTSERVER,
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index c10efba6..19a8d495 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_kill_session_entry = {
.name = "kill-session",
.alias = NULL,
- .args = { "aCt:", 0, 0 },
+ .args = { "aCt:", 0, 0, NULL },
.usage = "[-aC] " CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 430f667e..f5ff05f8 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -30,7 +30,7 @@ const struct cmd_entry cmd_kill_window_entry = {
.name = "kill-window",
.alias = "killw",
- .args = { "at:", 0, 0 },
+ .args = { "at:", 0, 0, NULL },
.usage = "[-a] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
@@ -43,7 +43,7 @@ const struct cmd_entry cmd_unlink_window_entry = {
.name = "unlink-window",
.alias = "unlinkw",
- .args = { "kt:", 0, 0 },
+ .args = { "kt:", 0, 0, NULL },
.usage = "[-k] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 45d5a4ee..8b12f0b3 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -36,7 +36,7 @@ const struct cmd_entry cmd_list_buffers_entry = {
.name = "list-buffers",
.alias = "lsb",
- .args = { "F:f:", 0, 0 },
+ .args = { "F:f:", 0, 0, NULL },
.usage = "[-F format] [-f filter]",
.flags = CMD_AFTERHOOK,
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index d450f017..a5b7d147 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_list_clients_entry = {
.name = "list-clients",
.alias = "lsc",
- .args = { "F:t:", 0, 0 },
+ .args = { "F:t:", 0, 0, NULL },
.usage = "[-F format] " CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index 1484af6d..ae9f995c 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -36,7 +36,7 @@ const struct cmd_entry cmd_list_keys_entry = {
.name = "list-keys",
.alias = "lsk",
- .args = { "1aNP:T:", 0, 1 },
+ .args = { "1aNP:T:", 0, 1, NULL },
.usage = "[-1aN] [-P prefix-string] [-T key-table] [key]",
.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
@@ -47,7 +47,7 @@ const struct cmd_entry cmd_list_commands_entry = {
.name = "list-commands",
.alias = "lscm",
- .args = { "F:", 0, 1 },
+ .args = { "F:", 0, 1, NULL },
.usage = "[-F format] [command]",
.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
diff --git a/cmd-list-panes.c b/cmd-list-panes.c
index c6dcff23..a29a4032 100644
--- a/cmd-list-panes.c
+++ b/cmd-list-panes.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_list_panes_entry = {
.name = "list-panes",
.alias = "lsp",
- .args = { "asF:f:t:", 0, 0 },
+ .args = { "asF:f:t:", 0, 0, NULL },
.usage = "[-as] [-F format] [-f filter] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index fbc3db1d..e448524e 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -42,7 +42,7 @@ const struct cmd_entry cmd_list_sessions_entry = {
.name = "list-sessions",
.alias = "ls",
- .args = { "F:f:", 0, 0 },
+ .args = { "F:f:", 0, 0, NULL },
.usage = "[-F format] [-f filter]",
.flags = CMD_AFTERHOOK,
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index d6cc0b7a..035471d4 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -49,7 +49,7 @@ const struct cmd_entry cmd_list_windows_entry = {
.name = "list-windows",
.alias = "lsw",
- .args = { "F:f:at:", 0, 0 },
+ .args = { "F:f:at:", 0, 0, NULL },
.usage = "[-a] [-F format] [-f filter] " CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index 318a7467..59810dea 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -37,7 +37,7 @@ const struct cmd_entry cmd_load_buffer_entry = {
.name = "load-buffer",
.alias = "loadb",
- .args = { "b:t:w", 1, 1 },
+ .args = { "b:t:w", 1, 1, NULL },
.usage = CMD_BUFFER_USAGE " " CMD_TARGET_CLIENT_USAGE " path",
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG|CMD_CLIENT_CANFAIL,
diff --git a/cmd-lock-server.c b/cmd-lock-server.c
index a0df95b0..bd61dcff 100644
--- a/cmd-lock-server.c
+++ b/cmd-lock-server.c
@@ -30,7 +30,7 @@ const struct cmd_entry cmd_lock_server_entry = {
.name = "lock-server",
.alias = "lock",
- .args = { "", 0, 0 },
+ .args = { "", 0, 0, NULL },
.usage = "",
.flags = CMD_AFTERHOOK,
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_lock_session_entry = {
.name = "lock-session",
.alias = "locks",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
@@ -54,7 +54,7 @@ const struct cmd_entry cmd_lock_client_entry = {
.name = "lock-client",
.alias = "lockc",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_CLIENT_USAGE,
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG,
diff --git a/cmd-move-window.c b/cmd-move-window.c
index 61128771..4b90e70f 100644
--- a/cmd-move-window.c
+++ b/cmd-move-window.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_move_window_entry = {
.name = "move-window",
.alias = "movew",
- .args = { "abdkrs:t:", 0, 0 },
+ .args = { "abdkrs:t:", 0, 0, NULL },
.usage = "[-abdkr] " CMD_SRCDST_WINDOW_USAGE,
.source = { 's', CMD_FIND_WINDOW, 0 },
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_link_window_entry = {
.name = "link-window",
.alias = "linkw",
- .args = { "abdks:t:", 0, 0 },
+ .args = { "abdks:t:", 0, 0, NULL },
.usage = "[-abdk] " CMD_SRCDST_WINDOW_USAGE,
.source = { 's', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 0cc6b9da..93c7e7b4 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_new_session_entry = {
.name = "new-session",
.alias = "new",
- .args = { "Ac:dDe:EF:f:n:Ps:t:x:Xy:", 0, -1 },
+ .args = { "Ac:dDe:EF:f:n:Ps:t:x:Xy:", 0, -1, NULL },
.usage = "[-AdDEPX] [-c start-directory] [-e environment] [-F format] "
"[-f flags] [-n window-name] [-s session-name] "
CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]",
@@ -54,7 +54,7 @@ const struct cmd_entry cmd_has_session_entry = {
.name = "has-session",
.alias = "has",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
@@ -271,7 +271,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
environ_update(global_s_options, c->environ, env);
av = args_first_value(args, 'e');
while (av != NULL) {
- environ_put(env, av->value, 0);
+ environ_put(env, av->string, 0);
av = args_next_value(av);
}
s = session_create(prefix, newname, cwd, env, oo, tiop);
diff --git a/cmd-new-window.c b/cmd-new-window.c
index f24de8e9..e88795c2 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_new_window_entry = {
.name = "new-window",
.alias = "neww",
- .args = { "abc:de:F:kn:PSt:", 0, -1 },
+ .args = { "abc:de:F:kn:PSt:", 0, -1, NULL },
.usage = "[-abdkPS] [-c start-directory] [-e environment] [-F format] "
"[-n window-name] " CMD_TARGET_WINDOW_USAGE " [command]",
@@ -110,7 +110,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
av = args_first_value(args, 'e');
while (av != NULL) {
- environ_put(sc.environ, av->value, 0);
+ environ_put(sc.environ, av->string, 0);
av = args_next_value(av);
}
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index c8447426..36326e18 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
.name = "paste-buffer",
.alias = "pasteb",
- .args = { "db:prs:t:", 0, 0 },
+ .args = { "db:prs:t:", 0, 0, NULL },
.usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " "
CMD_TARGET_PANE_USAGE,
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 909858a9..20318492 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -43,7 +43,7 @@ const struct cmd_entry cmd_pipe_pane_entry = {
.name = "pipe-pane",
.alias = "pipep",
- .args = { "IOot:", 0, 1 },
+ .args = { "IOot:", 0, 1, NULL },
.usage = "[-IOo] " CMD_TARGET_PANE_USAGE " [shell-command]",
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-queue.c b/cmd-queue.c
index 687d037f..806f1cbb 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -413,7 +413,7 @@ cmdq_insert_hook(struct session *s, struct cmdq_item *item,
av = args_first_value(args, flag);
while (av != NULL) {
xsnprintf(tmp, sizeof tmp, "hook_flag_%c_%d", flag, i);
- cmdq_add_format(new_state, tmp, "%s", av->value);
+ cmdq_add_format(new_state, tmp, "%s", av->string);
i++;
av = args_next_value(av);
}
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c
index 93845024..24a49dcb 100644
--- a/cmd-refresh-client.c
+++ b/cmd-refresh-client.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_refresh_client_entry = {
.name = "refresh-client",
.alias = "refresh",
- .args = { "A:B:cC:Df:F:lLRSt:U", 0, 1 },
+ .args = { "A:B:cC:Df:F:lLRSt:U", 0, 1, NULL },
.usage = "[-cDlLRSU] [-A pane:state] [-B name:what:format] "
"[-C XxY] [-f flags] " CMD_TARGET_CLIENT_USAGE " [adjustment]",
@@ -187,7 +187,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
goto not_control_client;
av = args_first_value(args, 'A');
while (av != NULL) {
- cmd_refresh_client_update_offset(tc, av->value);
+ cmd_refresh_client_update_offset(tc, av->string);
av = args_next_value(av);
}
return (CMD_RETURN_NORMAL);
@@ -197,7 +197,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
goto not_control_client;
av = args_first_value(args, 'B');
while (av != NULL) {
- cmd_refresh_client_update_subscription(tc, av->value);
+ cmd_refresh_client_update_subscription(tc, av->string);
av = args_next_value(av);
}
return (CMD_RETURN_NORMAL);
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index 8ec070bf..694f3c97 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_rename_session_entry = {
.name = "rename-session",
.alias = "rename",
- .args = { "t:", 1, 1 },
+ .args = { "t:", 1, 1, NULL },
.usage = CMD_TARGET_SESSION_USAGE " new-name",
.target = { 't', CMD_FIND_SESSION, 0 },
diff --git a/cmd-rename-window.c b/cmd-rename-window.c
index 66c119f2..472b571b 100644
--- a/cmd-rename-window.c
+++ b/cmd-rename-window.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_rename_window_entry = {
.name = "rename-window",
.alias = "renamew",
- .args = { "t:", 1, 1 },
+ .args = { "t:", 1, 1, NULL },
.usage = CMD_TARGET_WINDOW_USAGE " new-name",
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index 98d500db..81744f72 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -36,7 +36,7 @@ const struct cmd_entry cmd_resize_pane_entry = {
.name = "resize-pane",
.alias = "resizep",
- .args = { "DLMRTt:Ux:y:Z", 0, 1 },
+ .args = { "DLMRTt:Ux:y:Z", 0, 1, NULL },
.usage = "[-DLMRTUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " "
"[adjustment]",
@@ -98,8 +98,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
if (args_count(args) == 0)
adjust = 1;
else {
- adjust = strtonum(args_string(args, 0), 1, INT_MAX,
- &errstr);
+ adjust = strtonum(args_string(args, 0), 1, INT_MAX, &errstr);
if (errstr != NULL) {
cmdq_error(item, "adjustment %s", errstr);
return (CMD_RETURN_ERROR);
diff --git a/cmd-resize-window.c b/cmd-resize-window.c
index 3e33f771..24d73c87 100644
--- a/cmd-resize-window.c
+++ b/cmd-resize-window.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_resize_window_entry = {
.name = "resize-window",
.alias = "resizew",
- .args = { "aADLRt:Ux:y:", 0, 1 },
+ .args = { "aADLRt:Ux:y:", 0, 1, NULL },
.usage = "[-aADLRU] [-x width] [-y height] " CMD_TARGET_WINDOW_USAGE " "
"[adjustment]",
@@ -59,8 +59,7 @@ cmd_resize_window_exec(struct cmd *self, struct cmdq_item *item)
if (args_count(args) == 0)
adjust = 1;
else {
- adjust = strtonum(args_string(args, 0), 1, INT_MAX,
- &errstr);
+ adjust = strtonum(args_string(args, 0), 1, INT_MAX, &errstr);
if (errstr != NULL) {
cmdq_error(item, "adjustment %s", errstr);
return (CMD_RETURN_ERROR);
diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c
index 14f9abf2..652ef755 100644
--- a/cmd-respawn-pane.c
+++ b/cmd-respawn-pane.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
.name = "respawn-pane",
.alias = "respawnp",
- .args = { "c:e:kt:", 0, -1 },
+ .args = { "c:e:kt:", 0, -1, NULL },
.usage = "[-k] [-c start-directory] [-e environment] "
CMD_TARGET_PANE_USAGE " [command]",
@@ -69,7 +69,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmdq_item *item)
av = args_first_value(args, 'e');
while (av != NULL) {
- environ_put(sc.environ, av->value, 0);
+ environ_put(sc.environ, av->string, 0);
av = args_next_value(av);
}
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 25288bad..4e6dc2a9 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
.name = "respawn-window",
.alias = "respawnw",
- .args = { "c:e:kt:", 0, -1 },
+ .args = { "c:e:kt:", 0, -1, NULL },
.usage = "[-k] [-c start-directory] [-e environment] "
CMD_TARGET_WINDOW_USAGE " [command]",
@@ -67,7 +67,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmdq_item *item)
av = args_first_value(args, 'e');
while (av != NULL) {
- environ_put(sc.environ, av->value, 0);
+ environ_put(sc.environ, av->string, 0);
av = args_next_value(av);
}
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 450ffc17..0e2ed852 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -31,7 +31,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
.name = "rotate-window",
.alias = "rotatew",
- .args = { "Dt:UZ", 0, 0 },
+ .args = { "Dt:UZ", 0, 0, NULL },
.usage = "[-DUZ] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index a0115f0a..207e4710 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_run_shell_entry = {
.name = "run-shell",
.alias = "run",
- .args = { "bd:Ct:", 0, 1 },
+ .args = { "bd:Ct:", 0, 1, NULL },
.usage = "[-bC] [-d delay] " CMD_TARGET_PANE_USAGE " [shell-command]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index 7e5286a0..7d678372 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -37,7 +37,7 @@ const struct cmd_entry cmd_save_buffer_entry = {
.name = "save-buffer",
.alias = "saveb",
- .args = { "ab:", 1, 1 },
+ .args = { "ab:", 1, 1, NULL },
.usage = "[-a] " CMD_BUFFER_USAGE " path",
.flags = CMD_AFTERHOOK,
@@ -48,7 +48,7 @@ const struct cmd_entry cmd_show_buffer_entry = {
.name = "show-buffer",
.alias = "showb",
- .args = { "b:", 0, 0 },
+ .args = { "b:", 0, 0, NULL },
.usage = CMD_BUFFER_USAGE,
.flags = CMD_AFTERHOOK,
diff --git a/cmd-select-layout.c b/cmd-select-layout.c
index f9a29047..c857a0e1 100644
--- a/cmd-select-layout.c
+++ b/cmd-select-layout.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_select_layout_entry = {
.name = "select-layout",
.alias = "selectl",
- .args = { "Enopt:", 0, 1 },
+ .args = { "Enopt:", 0, 1, NULL },
.usage = "[-Enop] " CMD_TARGET_PANE_USAGE " [layout-name]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_next_layout_entry = {
.name = "next-layout",
.alias = "nextl",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
@@ -59,7 +59,7 @@ const struct cmd_entry cmd_previous_layout_entry = {
.name = "previous-layout",
.alias = "prevl",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index c5b4ee13..ae21d4ce 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_select_pane_entry = {
.name = "select-pane",
.alias = "selectp",
- .args = { "DdegLlMmP:RT:t:UZ", 0, 0 }, /* -P and -g deprecated */
+ .args = { "DdegLlMmP:RT:t:UZ", 0, 0, NULL }, /* -P and -g deprecated */
.usage = "[-DdeLlMmRUZ] [-T title] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_last_pane_entry = {
.name = "last-pane",
.alias = "lastp",
- .args = { "det:Z", 0, 0 },
+ .args = { "det:Z", 0, 0, NULL },
.usage = "[-deZ] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
diff --git a/cmd-select-window.c b/cmd-select-window.c
index 8dd358b0..4aca3e60 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_select_window_entry = {
.name = "select-window",
.alias = "selectw",
- .args = { "lnpTt:", 0, 0 },
+ .args = { "lnpTt:", 0, 0, NULL },
.usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
.target = { 't', CMD_FIND_WINDOW, 0 },
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_next_window_entry = {
.name = "next-window",
.alias = "next",
- .args = { "at:", 0, 0 },
+ .args = { "at:", 0, 0, NULL },
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
@@ -59,7 +59,7 @@ const struct cmd_entry cmd_previous_window_entry = {
.name = "previous-window",
.alias = "prev",
- .args = { "at:", 0, 0 },
+ .args = { "at:", 0, 0, NULL },
.usage = "[-a] " CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
@@ -72,7 +72,7 @@ const struct cmd_entry cmd_last_window_entry = {
.name = "last-window",
.alias = "last",
- .args = { "t:", 0, 0 },
+ .args = { "t:", 0, 0, NULL },
.usage = CMD_TARGET_SESSION_USAGE,
.target = { 't', CMD_FIND_SESSION, 0 },
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 351bd919..44b796ba 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_send_keys_entry = {
.name = "send-keys",
.alias = "send",
- .args = { "FHlMN:Rt:X", 0, -1 },
+ .args = { "FHlMN:Rt:X", 0, -1, NULL },
.usage = "[-FHlMRX] [-N repeat-count] " CMD_TARGET_PANE_USAGE
" key ...",
@@ -47,7 +47,7 @@ const struct cmd_entry cmd_send_prefix_entry = {
.name = "send-prefix",
.alias = NULL,
- .args = { "2t:", 0, 0 },
+ .args = { "2t:", 0, 0, NULL },
.usage = "[-2] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 3005e62d..9112683f 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_set_buffer_entry = {
.name = "set-buffer",
.alias = "setb",
- .args = { "ab:t:n:w", 0, 1 },
+ .args = { "ab:t:n:w", 0, 1, NULL },
.usage = "[-aw] " CMD_BUFFER_USAGE " [-n new-buffer-name] "
CMD_TARGET_CLIENT_USAGE " data",
@@ -45,7 +45,7 @@ const struct cmd_entry cmd_delete_buffer_entry = {
.name = "delete-buffer",
.alias = "deleteb",
- .args = { "b:", 0, 0 },
+ .args = { "b:", 0, 0, NULL },
.usage = CMD_BUFFER_USAGE,
.flags = CMD_AFTERHOOK,
diff --git a/cmd-set-environment.c b/cmd-set-environment.c
index e60240a8..cec1f3e3 100644
--- a/cmd-set-environment.c
+++ b/cmd-set-environment.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_set_environment_entry = {
.name = "set-environment",
.alias = "setenv",
- .args = { "Fhgrt:u", 1, 2 },
+ .args = { "Fhgrt:u", 1, 2, NULL },
.usage = "[-Fhgru] " CMD_TARGET_SESSION_USAGE " name [value]",
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 48e04eed..8839dc0d 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -33,7 +33,7 @@ const struct cmd_entry cmd_set_option_entry = {
.name = "set-option",
.alias = "set",
- .args = { "aFgopqst:uUw", 1, 2 },
+ .args = { "aFgopqst:uUw", 1, 2, NULL },
.usage = "[-aFgopqsuUw] " CMD_TARGET_PANE_USAGE " option [value]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@@ -46,7 +46,7 @@ const struct cmd_entry cmd_set_window_option_entry = {
.name = "set-window-option",
.alias = "setw",
- .args = { "aFgoqt:u", 1, 2 },
+ .args = { "aFgoqt:u", 1, 2, NULL },
.usage = "[-aFgoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
@@ -59,7 +59,7 @@ const struct cmd_entry cmd_set_hook_entry = {
.name = "set-hook",
.alias = NULL,
- .args = { "agpRt:uw", 1, 2 },
+ .args = { "agpRt:uw", 1, 2, NULL },
.usage = "[-agpRuw] " CMD_TARGET_PANE_USAGE " hook [command]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index 7ea1aeec..b52db366 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_show_environment_entry = {
.name = "show-environment",
.alias = "showenv",
- .args = { "hgst:", 0, 1 },
+ .args = { "hgst:", 0, 1, NULL },
.usage = "[-hgs] " CMD_TARGET_SESSION_USAGE " [name]",
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
diff --git a/cmd-show-messages.c b/cmd-show-messages.c
index d2f8289f..dca3ab31 100644
--- a/cmd-show-messages.c
+++ b/cmd-show-messages.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_show_messages_entry = {
.name = "show-messages",
.alias = "showmsgs",
- .args = { "JTt:", 0, 0 },
+ .args = { "JTt:", 0, 0, NULL },
.usage = "[-JT] " CMD_TARGET_CLIENT_USAGE,
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG,
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 0b230875..0e973ea0 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -38,7 +38,7 @@ const struct cmd_entry cmd_show_options_entry = {
.name = "show-options",
.alias = "show",
- .args = { "AgHpqst:vw", 0, 1 },
+ .args = { "AgHpqst:vw", 0, 1, NULL },
.usage = "[-AgHpqsvw] " CMD_TARGET_PANE_USAGE " [option]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@@ -51,7 +51,7 @@ const struct cmd_entry cmd_show_window_options_entry = {
.name = "show-window-options",
.alias = "showw",
- .args = { "gvt:", 0, 1 },
+ .args = { "gvt:", 0, 1, NULL },
.usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
@@ -64,7 +64,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
.name = "show-hooks",
.alias = NULL,
- .args = { "gpt:w", 0, 1 },
+ .args = { "gpt:w", 0, 1, NULL },
.usage = "[-gpw] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
diff --git a/cmd-show-prompt-history.c b/cmd-show-prompt-history.c
index 2091ac9d..c85950b0 100644
--- a/cmd-show-prompt-history.c
+++ b/cmd-show-prompt-history.c
@@ -31,7 +31,7 @@ const struct cmd_entry cmd_show_prompt_history_entry = {
.name = "show-prompt-history",
.alias = "showphist",
- .args = { "T:", 0, 0 },
+ .args = { "T:", 0, 0, NULL },
.usage = "[-T type]",
.flags = CMD_AFTERHOOK,
@@ -42,7 +42,7 @@ const struct cmd_entry cmd_clear_prompt_history_entry = {
.name = "clear-prompt-history",
.alias = "clearphist",
- .args = { "T:", 0, 0 },
+ .args = { "T:", 0, 0, NULL },
.usage = "[-T type]",
.flags = CMD_AFTERHOOK,
diff --git a/cmd-source-file.c b/cmd-source-file.c
index 54daa4a3..44a88fea 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -35,7 +35,7 @@ const struct cmd_entry cmd_source_file_entry = {
.name = "source-file",
.alias = "source",
- .args = { "Fnqv", 1, -1 },
+ .args = { "Fnqv", 1, -1, NULL },
.usage = "[-Fnqv] path ...",
.flags = 0,
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 1648c16b..109c587b 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -39,7 +39,7 @@ const struct cmd_entry cmd_split_window_entry = {
.name = "split-window",
.alias = "splitw",
- .args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1 },
+ .args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1, NULL },
.usage = "[-bdefhIPvZ] [-c start-directory] [-e environment] "
"[-F format] [-l size] " CMD_TARGET_PANE_USAGE " [command]",
@@ -141,7 +141,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
av = args_first_value(args, 'e');
while (av != NULL) {
- environ_put(sc.environ, av->value, 0);
+ environ_put(sc.environ, av->string, 0);
av = args_next_value(av);
}
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
index 12bc20b4..7d477739 100644
--- a/cmd-swap-pane.c
+++ b/cmd-swap-pane.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_swap_pane_entry = {
.name = "swap-pane",
.alias = "swapp",
- .args = { "dDs:t:UZ", 0, 0 },
+ .args = { "dDs:t:UZ", 0, 0, NULL },
.usage = "[-dDUZ] " CMD_SRCDST_PANE_USAGE,
.source = { 's', CMD_FIND_PANE, CMD_FIND_DEFAULT_MARKED },
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index 651a44da..b765112b 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_swap_window_entry = {
.name = "swap-window",
.alias = "swapw",
- .args = { "ds:t:", 0, 0 },
+ .args = { "ds:t:", 0, 0, NULL },
.usage = "[-d] " CMD_SRCDST_WINDOW_USAGE,
.source = { 's', CMD_FIND_WINDOW, CMD_FIND_DEFAULT_MARKED },
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index bc6baa6a..dc1b621a 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_switch_client_entry = {
.name = "switch-client",
.alias = "switchc",
- .args = { "lc:EFnpt:rT:Z", 0, 0 },
+ .args = { "lc:EFnpt:rT:Z", 0, 0, NULL },
.usage = "[-ElnprZ] [-c target-client] [-t target-session] "
"[-T key-table]",
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index 202a07f4..6d91d7cc 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -32,7 +32,7 @@ const struct cmd_entry cmd_unbind_key_entry = {
.name = "unbind-key",
.alias = "unbind",
- .args = { "anqT:", 0, 1 },
+ .args = { "anqT:", 0, 1, NULL },
.usage = "[-anq] [-T key-table] key",
.flags = CMD_AFTERHOOK,
diff --git a/cmd-wait-for.c b/cmd-wait-for.c
index 027700b4..8a6aa259 100644
--- a/cmd-wait-for.c
+++ b/cmd-wait-for.c
@@ -34,7 +34,7 @@ const struct cmd_entry cmd_wait_for_entry = {
.name = "wait-for",
.alias = "wait",
- .args = { "LSU", 1, 1 },
+ .args = { "LSU", 1, 1, NULL },
.usage = "[-L|-S|-U] channel",
.flags = 0,
diff --git a/cmd.c b/cmd.c
index 3daa705d..c4c62fc6 100644
--- a/cmd.c
+++ b/cmd.c
@@ -517,8 +517,7 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause)
return (NULL);
cmd_log_argv(argc, argv, "%s: %s", __func__, entry->name);
- args = args_parse(entry->args.template, argc, argv, entry->args.lower,
- entry->args.upper);
+ args = args_parse(&entry->args, argc, argv);
if (args == NULL)
goto usage;
diff --git a/tmux.h b/tmux.h
index e8a46ca0..1437b2f9 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1358,7 +1358,7 @@ TAILQ_HEAD(message_list, message_entry);
/* Argument value. */
struct args_value {
- char *value;
+ char *string;
TAILQ_ENTRY(args_value) entry;
};
@@ -1366,6 +1366,15 @@ struct args_value {
struct args_entry;
RB_HEAD(args_tree, args_entry);
+/* Arguments parsing state. */
+typedef enum args_type (*args_parse_cb)(struct args *, u_int);
+struct args_parse {
+ const char *template;
+ int lower;
+ int upper;
+ args_parse_cb cb;
+};
+
/* Command find structures. */
enum cmd_find_type {
CMD_FIND_PANE,
@@ -1454,11 +1463,7 @@ struct cmd_entry {
const char *name;
const char *alias;
- struct {
- const char *template;
- int lower;
- int upper;
- } args;
+ struct args_parse args;
const char *usage;
struct cmd_entry_flag source;
@@ -2184,7 +2189,7 @@ int tty_keys_next(struct tty *);
/* arguments.c */
void args_set(struct args *, u_char, const char *);
struct args *args_create(void);
-struct args *args_parse(const char *, int, char **, int, int);
+struct args *args_parse(const struct args_parse *, int, char **);
void args_vector(struct args *, int *, char ***);
void args_free(struct args *);
char *args_print(struct args *);