summaryrefslogtreecommitdiffstats
authortcunha <tcunha>2009-11-14 17:56:39 (GMT)
committer tcunha <tcunha>2009-11-14 17:56:39 (GMT)
commit7951cec793f5bc0d99e2265bc663759405566f23 (patch) (side-by-side diff)
treefb70d6157abd81a0965ffa28677547f0b3db4a85
parentf93bf3ef78c19c44a27fa611e45f679bca121d16 (diff)
downloadtmux-old-7951cec793f5bc0d99e2265bc663759405566f23.zip
tmux-old-7951cec793f5bc0d99e2265bc663759405566f23.tar.gz
tmux-old-7951cec793f5bc0d99e2265bc663759405566f23.tar.bz2
Sync OpenBSD patchset 539:
Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the command entry structs and a couple of functions to check/set the flags.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-attach-session.c8
-rw-r--r--cmd-bind-key.c4
-rw-r--r--cmd-break-pane.c6
-rw-r--r--cmd-choose-client.c4
-rw-r--r--cmd-choose-session.c4
-rw-r--r--cmd-choose-window.c4
-rw-r--r--cmd-clear-history.c4
-rw-r--r--cmd-clock-mode.c4
-rw-r--r--cmd-command-prompt.c4
-rw-r--r--cmd-confirm-before.c4
-rw-r--r--cmd-copy-buffer.c4
-rw-r--r--cmd-copy-mode.c8
-rw-r--r--cmd-delete-buffer.c4
-rw-r--r--cmd-detach-client.c4
-rw-r--r--cmd-display-message.c4
-rw-r--r--cmd-display-panes.c4
-rw-r--r--cmd-down-pane.c4
-rw-r--r--cmd-find-window.c4
-rw-r--r--cmd-generic.c90
-rw-r--r--cmd-has-session.c4
-rw-r--r--cmd-if-shell.c4
-rw-r--r--cmd-kill-pane.c6
-rw-r--r--cmd-kill-server.c4
-rw-r--r--cmd-kill-session.c4
-rw-r--r--cmd-kill-window.c4
-rw-r--r--cmd-last-window.c4
-rw-r--r--cmd-link-window.c8
-rw-r--r--cmd-list-buffers.c4
-rw-r--r--cmd-list-clients.c4
-rw-r--r--cmd-list-commands.c4
-rw-r--r--cmd-list-keys.c4
-rw-r--r--cmd-list-panes.c4
-rw-r--r--cmd-list-sessions.c4
-rw-r--r--cmd-list-windows.c4
-rw-r--r--cmd-load-buffer.c4
-rw-r--r--cmd-lock-client.c4
-rw-r--r--cmd-lock-server.c4
-rw-r--r--cmd-lock-session.c4
-rw-r--r--cmd-move-window.c8
-rw-r--r--cmd-new-session.c4
-rw-r--r--cmd-new-window.c4
-rw-r--r--cmd-next-layout.c4
-rw-r--r--cmd-next-window.c8
-rw-r--r--cmd-paste-buffer.c8
-rw-r--r--cmd-pipe-pane.c6
-rw-r--r--cmd-previous-layout.c4
-rw-r--r--cmd-previous-window.c8
-rw-r--r--cmd-refresh-client.c4
-rw-r--r--cmd-rename-session.c4
-rw-r--r--cmd-rename-window.c4
-rw-r--r--cmd-resize-pane.c36
-rw-r--r--cmd-respawn-window.c6
-rw-r--r--cmd-rotate-window.c8
-rw-r--r--cmd-run-shell.c4
-rw-r--r--cmd-save-buffer.c6
-rw-r--r--cmd-select-layout.c4
-rw-r--r--cmd-select-pane.c4
-rw-r--r--cmd-select-prompt.c4
-rw-r--r--cmd-select-window.c4
-rw-r--r--cmd-send-keys.c4
-rw-r--r--cmd-send-prefix.c4
-rw-r--r--cmd-server-info.c4
-rw-r--r--cmd-set-buffer.c4
-rw-r--r--cmd-set-environment.c10
-rw-r--r--cmd-set-option.c12
-rw-r--r--cmd-set-window-option.c12
-rw-r--r--cmd-show-buffer.c4
-rw-r--r--cmd-show-environment.c6
-rw-r--r--cmd-show-options.c6
-rw-r--r--cmd-show-window-options.c6
-rw-r--r--cmd-source-file.c4
-rw-r--r--cmd-split-window.c4
-rw-r--r--cmd-start-server.c4
-rw-r--r--cmd-suspend-client.c4
-rw-r--r--cmd-swap-pane.c15
-rw-r--r--cmd-swap-window.c6
-rw-r--r--cmd-switch-client.c4
-rw-r--r--cmd-unbind-key.c4
-rw-r--r--cmd-unlink-window.c6
-rw-r--r--cmd-up-pane.c4
-rw-r--r--tmux.h9
81 files changed, 266 insertions, 266 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index f07f5a0..baf36cc 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.33 2009/11/13 16:51:49 tcunha Exp $ */
+/* $Id: cmd-attach-session.c,v 1.34 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, CMD_CHFLAG('d'),
+ CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d",
cmd_target_init,
cmd_target_parse,
cmd_attach_session_exec,
@@ -58,7 +58,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (0);
if (ctx->cmdclient == NULL) {
- if (data->chflags & CMD_CHFLAG('d')) {
+ if (cmd_check_flag(data->chflags, 'd')) {
/*
* Can't use server_write_session in case attaching to
* the same session as currently attached to.
@@ -89,7 +89,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if (data->chflags & CMD_CHFLAG('d'))
+ if (cmd_check_flag(data->chflags, 'd'))
server_write_session(s, MSG_DETACH, NULL, 0);
ctx->cmdclient->session = s;
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 281a068..432b57e 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-bind-key.c,v 1.26 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -46,7 +46,7 @@ struct cmd_bind_key_data {
const struct cmd_entry cmd_bind_key_entry = {
"bind-key", "bind",
"[-cnr] [-t key-table] key command [arguments]",
- 0, 0,
+ 0, "",
NULL,
cmd_bind_key_parse,
cmd_bind_key_exec,
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 02e3c47..3ac0d16 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-break-pane.c,v 1.9 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-break-pane.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_break_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_break_pane_entry = {
"break-pane", "breakp",
CMD_TARGET_PANE_USAGE " [-d]",
- 0, CMD_CHFLAG('d'),
+ 0, "d",
cmd_target_init,
cmd_target_parse,
cmd_break_pane_exec,
@@ -74,7 +74,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
base_idx = options_get_number(&s->options, "base-index");
wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
- if (!(data->chflags & CMD_CHFLAG('d')))
+ if (!cmd_check_flag(data->chflags, 'd'))
session_select(s, wl->idx);
server_redraw_session(s);
diff --git a/cmd-choose-client.c b/cmd-choose-client.c
index 89589af..045a42e 100644
--- a/cmd-choose-client.c
+++ b/cmd-choose-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-client.c,v 1.3 2009/09/07 23:59:19 tcunha Exp $ */
+/* $Id: cmd-choose-client.c,v 1.4 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -34,7 +34,7 @@ void cmd_choose_client_free(void *);
const struct cmd_entry cmd_choose_client_entry = {
"choose-client", NULL,
CMD_TARGET_WINDOW_USAGE " [template]",
- CMD_ARG01, 0,
+ CMD_ARG01, "",
cmd_target_init,
cmd_target_parse,
cmd_choose_client_exec,
diff --git a/cmd-choose-session.c b/cmd-choose-session.c
index 5d05bb8..7d9cdd4 100644
--- a/cmd-choose-session.c
+++ b/cmd-choose-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-session.c,v 1.14 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-choose-session.c,v 1.15 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -34,7 +34,7 @@ void cmd_choose_session_free(void *);
const struct cmd_entry cmd_choose_session_entry = {
"choose-session", NULL,
CMD_TARGET_WINDOW_USAGE " [template]",
- CMD_ARG01, 0,
+ CMD_ARG01, "",
cmd_target_init,
cmd_target_parse,
cmd_choose_session_exec,
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index 0d05e5a..bd00eb4 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-window.c,v 1.18 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-choose-window.c,v 1.19 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -34,7 +34,7 @@ void cmd_choose_window_free(void *);
const struct cmd_entry cmd_choose_window_entry = {
"choose-window", NULL,
CMD_TARGET_WINDOW_USAGE " [template]",
- CMD_ARG01, 0,
+ CMD_ARG01, "",
cmd_target_init,
cmd_target_parse,
cmd_choose_window_exec,
diff --git a/cmd-clear-history.c b/cmd-clear-history.c
index 525a8d2..a8a828d 100644
--- a/cmd-clear-history.c
+++ b/cmd-clear-history.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-clear-history.c,v 1.8 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_clear_history_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_clear_history_entry = {
"clear-history", "clearhist",
CMD_TARGET_PANE_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_clear_history_exec,
diff --git a/cmd-clock-mode.c b/cmd-clock-mode.c
index 6a1c78f..136fae0 100644
--- a/cmd-clock-mode.c
+++ b/cmd-clock-mode.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-clock-mode.c,v 1.6 2009/08/20 11:37:46 tcunha Exp $ */
+/* $Id: cmd-clock-mode.c,v 1.7 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_clock_mode_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_clock_mode_entry = {
"clock-mode", NULL,
CMD_TARGET_PANE_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_clock_mode_exec,
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index 6e869cb..5317913 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-command-prompt.c,v 1.26 2009/09/22 14:06:40 tcunha Exp $ */
+/* $Id: cmd-command-prompt.c,v 1.27 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -39,7 +39,7 @@ void cmd_command_prompt_cfree(void *);
const struct cmd_entry cmd_command_prompt_entry = {
"command-prompt", NULL,
CMD_TARGET_CLIENT_USAGE " [-p prompts] [template]",
- 0, 0,
+ 0, "",
cmd_command_prompt_init,
cmd_command_prompt_parse,
cmd_command_prompt_exec,
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index 67b32fe..8777176 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-confirm-before.c,v 1.11 2009/08/24 16:24:18 tcunha Exp $ */
+/* $Id: cmd-confirm-before.c,v 1.12 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -34,7 +34,7 @@ void cmd_confirm_before_free(void *);
const struct cmd_entry cmd_confirm_before_entry = {
"confirm-before", "confirm",
CMD_TARGET_CLIENT_USAGE " command",
- CMD_ARG1, 0,
+ CMD_ARG1, "",
cmd_confirm_before_init,
cmd_target_parse,
cmd_confirm_before_exec,
diff --git a/cmd-copy-buffer.c b/cmd-copy-buffer.c
index 9367346..35db6ec 100644
--- a/cmd-copy-buffer.c
+++ b/cmd-copy-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-copy-buffer.c,v 1.5 2009/09/22 14:06:40 tcunha Exp $ */
+/* $Id: cmd-copy-buffer.c,v 1.6 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -43,7 +43,7 @@ struct cmd_copy_buffer_data {
const struct cmd_entry cmd_copy_buffer_entry = {
"copy-buffer", "copyb",
"[-a src-index] [-b dst-index] [-s src-session] [-t dst-session]",
- 0, 0,
+ 0, "",
cmd_copy_buffer_init,
cmd_copy_buffer_parse,
cmd_copy_buffer_exec,
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index a4d0fce..fa40de0 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-copy-mode.c,v 1.24 2009/10/06 14:14:06 tcunha Exp $ */
+/* $Id: cmd-copy-mode.c,v 1.25 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -30,7 +30,7 @@ int cmd_copy_mode_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_copy_mode_entry = {
"copy-mode", NULL,
"[-u] " CMD_TARGET_PANE_USAGE,
- 0, CMD_CHFLAG('u'),
+ 0, "u",
cmd_copy_mode_init,
cmd_target_parse,
cmd_copy_mode_exec,
@@ -48,7 +48,7 @@ cmd_copy_mode_init(struct cmd *self, int key)
switch (key) {
case KEYC_PPAGE:
- data->chflags |= CMD_CHFLAG('u');
+ cmd_set_flag(&data->chflags, 'u');
break;
}
}
@@ -63,7 +63,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
window_pane_set_mode(wp, &window_copy_mode);
- if (wp->mode == &window_copy_mode && data->chflags & CMD_CHFLAG('u'))
+ if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u'))
window_copy_pageup(wp);
return (0);
diff --git a/cmd-delete-buffer.c b/cmd-delete-buffer.c
index bc1c2c7..2c1c0ea 100644
--- a/cmd-delete-buffer.c
+++ b/cmd-delete-buffer.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-delete-buffer.c,v 1.8 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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, 0,
+ 0, "",
cmd_buffer_init,
cmd_buffer_parse,
cmd_delete_buffer_exec,
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 225578c..efffc46 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-detach-client.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_detach_client_exec,
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 4c00ed7..3dad144 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-display-message.c,v 1.3 2009/10/11 23:55:26 tcunha Exp $ */
+/* $Id: cmd-display-message.c,v 1.4 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -31,7 +31,7 @@ int cmd_display_message_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_display_message_entry = {
"display-message", "display",
CMD_TARGET_CLIENT_USAGE " [message]",
- CMD_ARG01, 0,
+ CMD_ARG01, "",
cmd_target_init,
cmd_target_parse,
cmd_display_message_exec,
diff --git a/cmd-display-panes.c b/cmd-display-panes.c
index 0c0f76f..804425a 100644
--- a/cmd-display-panes.c
+++ b/cmd-display-panes.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-display-panes.c,v 1.1 2009/08/31 22:30:15 tcunha Exp $ */
+/* $Id: cmd-display-panes.c,v 1.2 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_display_panes_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_display_panes_entry = {
"display-panes", "displayp",
CMD_TARGET_CLIENT_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_display_panes_exec,
diff --git a/cmd-down-pane.c b/cmd-down-pane.c
index d74c2d3..24668cb 100644
--- a/cmd-down-pane.c
+++ b/cmd-down-pane.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-down-pane.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_down_pane_exec,
diff --git a/cmd-find-window.c b/cmd-find-window.c
index 793505f..bd3eadf 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-find-window.c,v 1.14 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -34,7 +34,7 @@ void cmd_find_window_callback(void *, int);
const struct cmd_entry cmd_find_window_entry = {
"find-window", "findw",
CMD_TARGET_WINDOW_USAGE " match-string",
- CMD_ARG1, 0,
+ CMD_ARG1, "",
cmd_target_init,
cmd_target_parse,
cmd_find_window_exec,
diff --git a/cmd-generic.c b/cmd-generic.c
index 993eda1..dfd381f 100644
--- a/cmd-generic.c
+++ b/cmd-generic.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-generic.c,v 1.34 2009/08/26 22:13:52 tcunha Exp $ */
+/* $Id: cmd-generic.c,v 1.35 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -23,8 +23,8 @@
#include "tmux.h"
-int cmd_getopt(int, char **, const char *, uint64_t);
-int cmd_flags(int, uint64_t, uint64_t *);
+int cmd_getopt(int, char **, const char *, const char *);
+int cmd_parse_flags(int, const char *, uint64_t *);
size_t cmd_print_flags(char *, size_t, size_t, uint64_t);
int cmd_fill_argument(int, char **, char **, int, char **);
@@ -36,51 +36,53 @@ cmd_prarg(char *buf, size_t len, const char *prefix, char *arg)
return (xsnprintf(buf, len, "%s%s", prefix, arg));
}
-/* Prepend flags from chflags onto flagstr and call getopt. */
+/* Append two flag strings together and call getopt. */
int
-cmd_getopt(int argc, char **argv, const char *flagstr, uint64_t chflags)
+cmd_getopt(int argc, char **argv, const char *flagstr, const char *chflagstr)
{
- u_char ch;
- char buf[128];
- size_t len, off;
-
- *buf = '\0';
+ char tmp[BUFSIZ];
- len = sizeof buf;
- off = 0;
+ if (strlcpy(tmp, flagstr, sizeof tmp) >= sizeof tmp)
+ fatalx("strlcpy overflow");
+ if (strlcat(tmp, chflagstr, sizeof tmp) >= sizeof tmp)
+ fatalx("strlcat overflow");
+ return (getopt(argc, argv, tmp));
+}
- for (ch = 0; ch < 26; ch++) {
- if (chflags & CMD_CHFLAG('a' + ch))
- off += xsnprintf(buf + off, len - off, "%c", 'a' + ch);
- if (chflags & CMD_CHFLAG('A' + ch))
- off += xsnprintf(buf + off, len - off, "%c", 'A' + ch);
- }
-
- strlcat(buf, flagstr, sizeof buf);
+/* Return if flag character is set. */
+int
+cmd_check_flag(uint64_t chflags, int flag)
+{
+ if (flag >= 'A' && flag <= 'Z')
+ flag = 26 + flag - 'A';
+ else if (flag >= 'a' && flag <= 'z')
+ flag = flag - 'a';
+ else
+ return (0);
+ return ((chflags & (1ULL << flag)) != 0);
+}
- return (getopt(argc, argv, buf));
+/* Set flag character. */
+void
+cmd_set_flag(uint64_t *chflags, int flag)
+{
+ if (flag >= 'A' && flag <= 'Z')
+ flag = 26 + flag - 'A';
+ else if (flag >= 'a' && flag <= 'z')
+ flag = flag - 'a';
+ else
+ return;
+ (*chflags) |= (1ULL << flag);
}
-/*
- * If this option is expected (in ichflags), set it in ochflags, otherwise
- * return -1.
- */
+/* If this option is expected, set it in chflags, otherwise return -1. */
int
-cmd_flags(int opt, uint64_t ichflags, uint64_t *ochflags)
+cmd_parse_flags(int opt, const char *chflagstr, uint64_t *chflags)
{
- u_char ch;
-
- for (ch = 0; ch < 26; ch++) {
- if (opt == 'a' + ch && ichflags & CMD_CHFLAG(opt)) {
- (*ochflags) |= CMD_CHFLAG(opt);
- return (0);
- }
- if (opt == 'A' + ch && ichflags & CMD_CHFLAG(opt)) {
- (*ochflags) |= CMD_CHFLAG(opt);
- return (0);
- }
- }
- return (-1);
+ if (strchr(chflagstr, opt) == NULL)
+ return (-1);
+ cmd_set_flag(chflags, opt);
+ return (0);
}
/* Print the flags supported in chflags. */
@@ -95,9 +97,9 @@ cmd_print_flags(char *buf, size_t len, size_t off, uint64_t chflags)
off += xsnprintf(buf + off, len - off, " -");
for (ch = 0; ch < 26; ch++) {
- if (chflags & CMD_CHFLAG('a' + ch))
+ if (cmd_check_flag(chflags, 'a' + ch))
off += xsnprintf(buf + off, len - off, "%c", 'a' + ch);
- if (chflags & CMD_CHFLAG('A' + ch))
+ if (cmd_check_flag(chflags, 'A' + ch))
off += xsnprintf(buf + off, len - off, "%c", 'A' + ch);
}
return (off - boff);
@@ -170,7 +172,7 @@ cmd_target_parse(struct cmd *self, int argc, char **argv, char **cause)
data = self->data;
while ((opt = cmd_getopt(argc, argv, "t:", entry->chflags)) != -1) {
- if (cmd_flags(opt, entry->chflags, &data->chflags) == 0)
+ if (cmd_parse_flags(opt, entry->chflags, &data->chflags) == 0)
continue;
switch (opt) {
case 't':
@@ -253,7 +255,7 @@ cmd_srcdst_parse(struct cmd *self, int argc, char **argv, char **cause)
data = self->data;
while ((opt = cmd_getopt(argc, argv, "s:t:", entry->chflags)) != -1) {
- if (cmd_flags(opt, entry->chflags, &data->chflags) == 0)
+ if (cmd_parse_flags(opt, entry->chflags, &data->chflags) == 0)
continue;
switch (opt) {
case 's':
@@ -345,7 +347,7 @@ cmd_buffer_parse(struct cmd *self, int argc, char **argv, char **cause)
data = self->data;
while ((opt = cmd_getopt(argc, argv, "b:t:", entry->chflags)) != -1) {
- if (cmd_flags(opt, entry->chflags, &data->chflags) == 0)
+ if (cmd_parse_flags(opt, entry->chflags, &data->chflags) == 0)
continue;
switch (opt) {
case 'b':
diff --git a/cmd-has-session.c b/cmd-has-session.c
index 3b3d70d..fe81099 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-has-session.c,v 1.15 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_has_session_exec,
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index 9e646b6..ae296b9 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-if-shell.c,v 1.7 2009/11/02 21:38:26 tcunha Exp $ */
+/* $Id: cmd-if-shell.c,v 1.8 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -36,7 +36,7 @@ void cmd_if_shell_free(void *);
const struct cmd_entry cmd_if_shell_entry = {
"if-shell", "if",
"shell-command command",
- CMD_ARG2, 0,
+ CMD_ARG2, "",
cmd_target_init,
cmd_target_parse,
cmd_if_shell_exec,
diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
index 74dc85f..7df68b7 100644
--- a/cmd-kill-pane.c
+++ b/cmd-kill-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-pane.c,v 1.14 2009/10/25 10:41:03 tcunha Exp $ */
+/* $Id: cmd-kill-pane.c,v 1.15 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_kill_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_pane_entry = {
"kill-pane", "killp",
"[-a] " CMD_TARGET_PANE_USAGE,
- 0, CMD_CHFLAG('a'),
+ 0, "a",
cmd_target_init,
cmd_target_parse,
cmd_kill_pane_exec,
@@ -56,7 +56,7 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
return (0);
}
- if (data->chflags & CMD_CHFLAG('a')) {
+ if (cmd_check_flag(data->chflags, 'a')) {
loopwp = TAILQ_FIRST(&wl->window->panes);
while (loopwp != NULL) {
nextwp = TAILQ_NEXT(loopwp, entry);
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 99e51d6..aaeb12f 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-server.c,v 1.9 2009/11/08 22:40:36 tcunha Exp $ */
+/* $Id: cmd-kill-server.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_kill_server_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_server_entry = {
"kill-server", NULL,
"",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_kill_server_exec,
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index 2ff4928..f269dfd 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-session.c,v 1.15 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-kill-session.c,v 1.16 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_kill_session_exec,
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 1e778dc..8b97c64 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-window.c,v 1.20 2009/09/20 22:15:32 tcunha Exp $ */
+/* $Id: cmd-kill-window.c,v 1.21 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_kill_window_exec,
diff --git a/cmd-last-window.c b/cmd-last-window.c
index bdfa5f9..c004ea0 100644
--- a/cmd-last-window.c
+++ b/cmd-last-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-last-window.c,v 1.19 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_last_window_exec,
diff --git a/cmd-link-window.c b/cmd-link-window.c
index 1a6b08b..34d0c31 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-link-window.c,v 1.35 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-link-window.c,v 1.36 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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,
- 0, CMD_CHFLAG('d')|CMD_CHFLAG('k'),
+ 0, "dk",
cmd_srcdst_init,
cmd_srcdst_parse,
cmd_link_window_exec,
@@ -53,8 +53,8 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((idx = cmd_find_index(ctx, data->dst, &dst)) == -2)
return (-1);
- kflag = data->chflags & CMD_CHFLAG('k');
- dflag = data->chflags & CMD_CHFLAG('d');
+ kflag = cmd_check_flag(data->chflags, 'k');
+ dflag = cmd_check_flag(data->chflags, 'd');
if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) {
ctx->error(ctx, "can't link window: %s", cause);
xfree(cause);
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index dc3f90f..6a50c83 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-buffers.c,v 1.12 2009/09/07 23:48:54 tcunha Exp $ */
+/* $Id: cmd-list-buffers.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_list_buffers_exec,
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index 3b89b3b..a040312 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-list-clients.c,v 1.19 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_list_clients_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_clients_entry = {
"list-clients", "lsc",
"",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_list_clients_exec,
diff --git a/cmd-list-commands.c b/cmd-list-commands.c
index 103eeb7..3d7024f 100644
--- a/cmd-list-commands.c
+++ b/cmd-list-commands.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-list-commands.c,v 1.6 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_list_commands_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_commands_entry = {
"list-commands", "lscm",
"",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_list_commands_exec,
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index 542bd72..5a6ee0f 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-keys.c,v 1.21 2009/11/08 23:30:42 tcunha Exp $ */
+/* $Id: cmd-list-keys.c,v 1.22 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -33,7 +33,7 @@ int cmd_list_keys_table(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_keys_entry = {
"list-keys", "lsk",
"[-t key-table]",
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_list_keys_exec,
diff --git a/cmd-list-panes.c b/cmd-list-panes.c
index dc1905a..aedb7e0 100644
--- a/cmd-list-panes.c
+++ b/cmd-list-panes.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-panes.c,v 1.2 2009/10/15 20:10:28 tcunha Exp $ */
+/* $Id: cmd-list-panes.c,v 1.3 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_list_panes_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_panes_entry = {
"list-panes", "lsp",
CMD_TARGET_WINDOW_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_list_panes_exec,
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index 77427bb..87313be 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-sessions.c,v 1.23 2009/11/04 22:42:31 tcunha Exp $ */
+/* $Id: cmd-list-sessions.c,v 1.24 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_list_sessions_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_sessions_entry = {
"list-sessions", "ls", "",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_list_sessions_exec,
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index a080e7d..0997f89 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-windows.c,v 1.41 2009/10/12 00:08:12 tcunha Exp $ */
+/* $Id: cmd-list-windows.c,v 1.42 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_list_windows_exec,
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index 1517391..6142c6c 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-load-buffer.c,v 1.11 2009/10/28 23:10:05 tcunha Exp $ */
+/* $Id: cmd-load-buffer.c,v 1.12 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -35,7 +35,7 @@ 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, 0,
+ CMD_ARG1, "",
cmd_buffer_init,
cmd_buffer_parse,
cmd_load_buffer_exec,
diff --git a/cmd-lock-client.c b/cmd-lock-client.c
index 90e0332..691be44 100644
--- a/cmd-lock-client.c
+++ b/cmd-lock-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-lock-client.c,v 1.1 2009/09/25 17:51:39 tcunha Exp $ */
+/* $Id: cmd-lock-client.c,v 1.2 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_lock_client_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_lock_client_entry = {
"lock-client", "lockc",
CMD_TARGET_CLIENT_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_lock_client_exec,
diff --git a/cmd-lock-server.c b/cmd-lock-server.c
index e14e94c..733106b 100644
--- a/cmd-lock-server.c
+++ b/cmd-lock-server.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-lock-server.c,v 1.7 2009/09/25 17:47:42 tcunha Exp $ */
+/* $Id: cmd-lock-server.c,v 1.8 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -33,7 +33,7 @@ int cmd_lock_server_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_lock_server_entry = {
"lock-server", "lock",
"",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_lock_server_exec,
diff --git a/cmd-lock-session.c b/cmd-lock-session.c
index 874c1f0..75cc6da 100644
--- a/cmd-lock-session.c
+++ b/cmd-lock-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-lock-session.c,v 1.1 2009/09/25 17:51:39 tcunha Exp $ */
+/* $Id: cmd-lock-session.c,v 1.2 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_lock_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_lock_session_entry = {
"lock-session", "locks",
CMD_TARGET_SESSION_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_lock_session_exec,
diff --git a/cmd-move-window.c b/cmd-move-window.c
index 8eb9333..4cc018b 100644
--- a/cmd-move-window.c
+++ b/cmd-move-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-move-window.c,v 1.12 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-move-window.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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,
- 0, CMD_CHFLAG('d')|CMD_CHFLAG('k'),
+ 0, "dk",
cmd_srcdst_init,
cmd_srcdst_parse,
cmd_move_window_exec,
@@ -53,8 +53,8 @@ cmd_move_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((idx = cmd_find_index(ctx, data->dst, &dst)) == -2)
return (-1);
- kflag = data->chflags & CMD_CHFLAG('k');
- dflag = data->chflags & CMD_CHFLAG('d');
+ kflag = cmd_check_flag(data->chflags, 'k');
+ dflag = cmd_check_flag(data->chflags, 'd');
if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) {
ctx->error(ctx, "can't move window: %s", cause);
xfree(cause);
diff --git a/cmd-new-session.c b/cmd-new-session.c
index bfb7ef8..ca95603 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.70 2009/11/13 16:51:49 tcunha Exp $ */
+/* $Id: cmd-new-session.c,v 1.71 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -44,7 +44,7 @@ struct cmd_new_session_data {
const struct cmd_entry cmd_new_session_entry = {
"new-session", "new",
"[-d] [-n window-name] [-s session-name] [-t target-session] [command]",
- CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, 0,
+ CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, "",
cmd_new_session_init,
cmd_new_session_parse,
cmd_new_session_exec,
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 9480eed..81970a0 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-window.c,v 1.39 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-new-window.c,v 1.40 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -43,7 +43,7 @@ struct cmd_new_window_data {
const struct cmd_entry cmd_new_window_entry = {
"new-window", "neww",
"[-dk] [-n window-name] [-t target-window] [command]",
- 0, 0,
+ 0, "",
cmd_new_window_init,
cmd_new_window_parse,
cmd_new_window_exec,
diff --git a/cmd-next-layout.c b/cmd-next-layout.c
index a8ba8d0..efc931c 100644
--- a/cmd-next-layout.c
+++ b/cmd-next-layout.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-next-layout.c,v 1.6 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_next_layout_exec,
diff --git a/cmd-next-window.c b/cmd-next-window.c
index ef473bc..16003f0 100644
--- a/cmd-next-window.c
+++ b/cmd-next-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-next-window.c,v 1.21 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -30,7 +30,7 @@ int cmd_next_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_next_window_entry = {
"next-window", "next",
"[-a] " CMD_TARGET_SESSION_USAGE,
- 0, CMD_CHFLAG('a'),
+ 0, "a",
cmd_next_window_init,
cmd_target_parse,
cmd_next_window_exec,
@@ -47,7 +47,7 @@ cmd_next_window_init(struct cmd *self, int key)
data = self->data;
if (key == ('n' | KEYC_ESCAPE))
- data->chflags |= CMD_CHFLAG('a');
+ cmd_set_flag(&data->chflags, 'a');
}
int
@@ -61,7 +61,7 @@ cmd_next_window_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
activity = 0;
- if (data->chflags & CMD_CHFLAG('a'))
+ if (cmd_check_flag(data->chflags, 'a'))
activity = 1;
if (session_next(s, activity) == 0)
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index 50ed6f5..8809c79 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-paste-buffer.c,v 1.21 2009/11/08 23:02:56 tcunha Exp $ */
+/* $Id: cmd-paste-buffer.c,v 1.22 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ void cmd_paste_buffer_lf2cr(struct window_pane *, const char *, size_t);
const struct cmd_entry cmd_paste_buffer_entry = {
"paste-buffer", "pasteb",
"[-dr] " CMD_BUFFER_WINDOW_USAGE,
- 0, CMD_CHFLAG('d')|CMD_CHFLAG('r'),
+ 0, "dr",
cmd_buffer_init,
cmd_buffer_parse,
cmd_paste_buffer_exec,
@@ -64,14 +64,14 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
if (pb != NULL && *pb->data != '\0') {
/* -r means raw data without LF->CR conversion. */
- if (data->chflags & CMD_CHFLAG('r'))
+ if (cmd_check_flag(data->chflags, 'r'))
bufferevent_write(wp->event, pb->data, pb->size);
else
cmd_paste_buffer_lf2cr(wp, pb->data, pb->size);
}
/* Delete the buffer if -d. */
- if (data->chflags & CMD_CHFLAG('d')) {
+ if (cmd_check_flag(data->chflags, 'd')) {
if (data->buffer == -1)
paste_free_top(&s->buffers);
else
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 1bd8793..b1467f3 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-pipe-pane.c,v 1.7 2009/11/14 17:52:04 tcunha Exp $ */
+/* $Id: cmd-pipe-pane.c,v 1.8 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -37,7 +37,7 @@ void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *);
const struct cmd_entry cmd_pipe_pane_entry = {
"pipe-pane", "pipep",
CMD_TARGET_PANE_USAGE "[-o] [command]",
- CMD_ARG01, CMD_CHFLAG('o'),
+ CMD_ARG01, "o",
cmd_target_init,
cmd_target_parse,
cmd_pipe_pane_exec,
@@ -73,7 +73,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
*
* bind ^p pipep -o 'cat >>~/output'
*/
- if (data->chflags & CMD_CHFLAG('o') && old_fd != -1)
+ if (cmd_check_flag(data->chflags, 'o') && old_fd != -1)
return (0);
/* Open the new pipe. */
diff --git a/cmd-previous-layout.c b/cmd-previous-layout.c
index b94329c..e6b9536 100644
--- a/cmd-previous-layout.c
+++ b/cmd-previous-layout.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-previous-layout.c,v 1.5 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_previous_layout_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_previous_layout_entry = {
"previous-layout", "prevl",
CMD_TARGET_WINDOW_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_previous_layout_exec,
diff --git a/cmd-previous-window.c b/cmd-previous-window.c
index 82950e9..925f35e 100644
--- a/cmd-previous-window.c
+++ b/cmd-previous-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-previous-window.c,v 1.21 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -30,7 +30,7 @@ int cmd_previous_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_previous_window_entry = {
"previous-window", "prev",
"[-a] " CMD_TARGET_SESSION_USAGE,
- 0, CMD_CHFLAG('a'),
+ 0, "a",
cmd_previous_window_init,
cmd_target_parse,
cmd_previous_window_exec,
@@ -47,7 +47,7 @@ cmd_previous_window_init(struct cmd *self, int key)
data = self->data;
if (key == ('p' | KEYC_ESCAPE))
- data->chflags |= CMD_CHFLAG('a');
+ cmd_set_flag(&data->chflags, 'a');
}
int
@@ -61,7 +61,7 @@ cmd_previous_window_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
activity = 0;
- if (data->chflags & CMD_CHFLAG('a'))
+ if (cmd_check_flag(data->chflags, 'a'))
activity = 1;
if (session_previous(s, activity) == 0)
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c
index 2eb936a..44fc6a5 100644
--- a/cmd-refresh-client.c
+++ b/cmd-refresh-client.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-refresh-client.c,v 1.11 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ 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, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_refresh_client_exec,
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index f811e5c..b8527ee 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-rename-session.c,v 1.19 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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, 0,
+ CMD_ARG1, "",
cmd_target_init,
cmd_target_parse,
cmd_rename_session_exec,
diff --git a/cmd-rename-window.c b/cmd-rename-window.c
index 755b53f..5d9dbf8 100644
--- a/cmd-rename-window.c
+++ b/cmd-rename-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-rename-window.c,v 1.30 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-rename-window.c,v 1.31 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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, 0,
+ CMD_ARG1, "",
cmd_target_init,
cmd_target_parse,
cmd_rename_window_exec,
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index af1b5b0..a447fc4 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-resize-pane.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -31,9 +31,8 @@ int cmd_resize_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_resize_pane_entry = {
"resize-pane", "resizep",
- "[-DU] " CMD_TARGET_PANE_USAGE " [adjustment]",
- CMD_ARG01,
- CMD_CHFLAG('D')|CMD_CHFLAG('L')|CMD_CHFLAG('R')|CMD_CHFLAG('U'),
+ "[-DLRU] " CMD_TARGET_PANE_USAGE " [adjustment]",
+ CMD_ARG01, "DLRU",
cmd_resize_pane_init,
cmd_target_parse,
cmd_resize_pane_exec,
@@ -50,28 +49,28 @@ cmd_resize_pane_init(struct cmd *self, int key)
data = self->data;
if (key == (KEYC_UP | KEYC_CTRL))
- data->chflags |= CMD_CHFLAG('U');
+ cmd_set_flag(&data->chflags, 'U');
if (key == (KEYC_DOWN | KEYC_CTRL))
- data->chflags |= CMD_CHFLAG('D');
+ cmd_set_flag(&data->chflags, 'D');
if (key == (KEYC_LEFT | KEYC_CTRL))
- data->chflags |= CMD_CHFLAG('L');
+ cmd_set_flag(&data->chflags, 'L');
if (key == (KEYC_RIGHT | KEYC_CTRL))
- data->chflags |= CMD_CHFLAG('R');
+ cmd_set_flag(&data->chflags, 'R');
if (key == (KEYC_UP | KEYC_ESCAPE)) {
- data->chflags |= CMD_CHFLAG('U');
+ cmd_set_flag(&data->chflags, 'U');
data->arg = xstrdup("5");
}
if (key == (KEYC_DOWN | KEYC_ESCAPE)) {
- data->chflags |= CMD_CHFLAG('D');
+ cmd_set_flag(&data->chflags, 'D');
data->arg = xstrdup("5");
}
if (key == (KEYC_LEFT | KEYC_ESCAPE)) {
- data->chflags |= CMD_CHFLAG('L');
+ cmd_set_flag(&data->chflags, 'L');
data->arg = xstrdup("5");
}
if (key == (KEYC_RIGHT | KEYC_ESCAPE)) {
- data->chflags |= CMD_CHFLAG('R');
+ cmd_set_flag(&data->chflags, 'R');
data->arg = xstrdup("5");
}
}
@@ -98,15 +97,14 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
}
}
- if (data->chflags & (CMD_CHFLAG('L')|CMD_CHFLAG('R'))) {
- if (data->chflags & CMD_CHFLAG('L'))
- adjust = -adjust;
+ if (cmd_check_flag(data->chflags, 'L'))
+ layout_resize_pane(wp, LAYOUT_LEFTRIGHT, -adjust);
+ else if (cmd_check_flag(data->chflags, 'R'))
layout_resize_pane(wp, LAYOUT_LEFTRIGHT, adjust);
- } else {
- if (data->chflags & CMD_CHFLAG('U'))
- adjust = -adjust;
+ else if (cmd_check_flag(data->chflags, 'U'))
+ layout_resize_pane(wp, LAYOUT_TOPBOTTOM, -adjust);
+ else if (cmd_check_flag(data->chflags, 'D'))
layout_resize_pane(wp, LAYOUT_TOPBOTTOM, adjust);
- }
server_redraw_window(wl->window);
return (0);
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index d747e50..b0cfa92 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-respawn-window.c,v 1.23 2009/11/14 17:48:39 tcunha Exp $ */
+/* $Id: cmd-respawn-window.c,v 1.24 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ 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_CHFLAG('k'),
+ CMD_ARG01, "k",
cmd_target_init,
cmd_target_parse,
cmd_respawn_window_exec,
@@ -54,7 +54,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
w = wl->window;
- if (!(data->chflags & CMD_CHFLAG('k'))) {
+ if (!cmd_check_flag(data->chflags, 'k')) {
TAILQ_FOREACH(wp, &w->panes, entry) {
if (wp->fd == -1)
continue;
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 87c6f83..44426e7 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-rotate-window.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -30,7 +30,7 @@ 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,
- 0, CMD_CHFLAG('D')|CMD_CHFLAG('U'),
+ 0, "DU",
cmd_rotate_window_init,
cmd_target_parse,
cmd_rotate_window_exec,
@@ -47,7 +47,7 @@ cmd_rotate_window_init(struct cmd *self, int key)
data = self->data;
if (key == ('o' | KEYC_ESCAPE))
- data->chflags |= CMD_CHFLAG('D');
+ cmd_set_flag(&data->chflags, 'D');
}
int
@@ -64,7 +64,7 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
w = wl->window;
- if (data->chflags & CMD_CHFLAG('D')) {
+ if (cmd_check_flag(data->chflags, 'D')) {
wp = TAILQ_LAST(&w->panes, window_panes);
TAILQ_REMOVE(&w->panes, wp, entry);
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 79fc2a9..a706832 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-run-shell.c,v 1.5 2009/11/08 22:56:04 tcunha Exp $ */
+/* $Id: cmd-run-shell.c,v 1.6 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -36,7 +36,7 @@ void cmd_run_shell_free(void *);
const struct cmd_entry cmd_run_shell_entry = {
"run-shell", "run",
"command",
- CMD_ARG1, 0,
+ CMD_ARG1, "",
cmd_target_init,
cmd_target_parse,
cmd_run_shell_exec,
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index def2935..9eca4cc 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-save-buffer.c,v 1.9 2009/10/28 23:08:52 tcunha Exp $ */
+/* $Id: cmd-save-buffer.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <[email protected]>
@@ -33,7 +33,7 @@ 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_ARG1, CMD_CHFLAG('a'),
+ CMD_ARG1, "a",
cmd_buffer_init,
cmd_buffer_parse,
cmd_save_buffer_exec,
@@ -66,7 +66,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
}
mask = umask(S_IRWXG | S_IRWXO);
- if (data->chflags & CMD_CHFLAG('a'))
+ if (cmd_check_flag(data->chflags, 'a'))
f = fopen(data->arg, "ab");
else
f = fopen(data->arg, "wb");
diff --git a/cmd-select-layout.c b/cmd-select-layout.c
index bf27630..e3fe8fb 100644
--- a/cmd-select-layout.c
+++ b/cmd-select-layout.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-select-layout.c,v 1.9 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -30,7 +30,7 @@ int cmd_select_layout_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_select_layout_entry = {
"select-layout", "selectl",
CMD_TARGET_WINDOW_USAGE " [layout-name]",
- CMD_ARG01, 0,
+ CMD_ARG01, "",
cmd_select_layout_init,
cmd_target_parse,
cmd_select_layout_exec,
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index d9132a1..32caf68 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-select-pane.c,v 1.11 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_select_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp",
CMD_TARGET_PANE_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_select_pane_exec,
diff --git a/cmd-select-prompt.c b/cmd-select-prompt.c
index f2ad5ca..88cde0b 100644
--- a/cmd-select-prompt.c
+++ b/cmd-select-prompt.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-select-prompt.c,v 1.12 2009/08/16 19:29:24 tcunha Exp $ */
+/* $Id: cmd-select-prompt.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -33,7 +33,7 @@ int cmd_select_prompt_callback(void *, const char *);
const struct cmd_entry cmd_select_prompt_entry = {
"select-prompt", NULL,
CMD_TARGET_CLIENT_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_select_prompt_exec,
diff --git a/cmd-select-window.c b/cmd-select-window.c
index 0dfb5f0..11a4b43 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-select-window.c,v 1.24 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_select_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_select_window_entry = {
"select-window", "selectw",
CMD_TARGET_WINDOW_USAGE,
- 0, 0,
+ 0, "",
cmd_select_window_init,
cmd_target_parse,
cmd_select_window_exec,
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 18d1f5f..72a715b 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-keys.c,v 1.22 2009/09/22 14:03:11 tcunha Exp $ */
+/* $Id: cmd-send-keys.c,v 1.23 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -40,7 +40,7 @@ struct cmd_send_keys_data {
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
"[-t target-pane] key ...",
- 0, 0,
+ 0, "",
NULL,
cmd_send_keys_parse,
cmd_send_keys_exec,
diff --git a/cmd-send-prefix.c b/cmd-send-prefix.c
index e2af292..092354c 100644
--- a/cmd-send-prefix.c
+++ b/cmd-send-prefix.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-prefix.c,v 1.27 2009/09/22 14:22:20 tcunha Exp $ */
+/* $Id: cmd-send-prefix.c,v 1.28 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_send_prefix_entry = {
"send-prefix", NULL,
CMD_TARGET_PANE_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_send_prefix_exec,
diff --git a/cmd-server-info.c b/cmd-server-info.c
index 5e5993a..bd0475c 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-server-info.c,v 1.33 2009/11/04 22:42:31 tcunha Exp $ */
+/* $Id: cmd-server-info.c,v 1.34 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -35,7 +35,7 @@ int cmd_server_info_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_server_info_entry = {
"server-info", "info",
"",
- 0, 0,
+ 0, "",
NULL,
NULL,
cmd_server_info_exec,
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 8ed265c..9c1e25f 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-buffer.c,v 1.10 2009/09/07 23:48:54 tcunha Exp $ */
+/* $Id: cmd-set-buffer.c,v 1.11 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_set_buffer_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_set_buffer_entry = {
"set-buffer", "setb",
CMD_BUFFER_SESSION_USAGE " data",
- CMD_ARG1, 0,
+ CMD_ARG1, "",
cmd_buffer_init,
cmd_buffer_parse,
cmd_set_buffer_exec,
diff --git a/cmd-set-environment.c b/cmd-set-environment.c
index 78025f5..b95f1e7 100644
--- a/cmd-set-environment.c
+++ b/cmd-set-environment.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-environment.c,v 1.2 2009/08/11 14:42:59 nicm Exp $ */
+/* $Id: cmd-set-environment.c,v 1.3 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_set_environment_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_set_environment_entry = {
"set-environment", "setenv",
"[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
- CMD_ARG12, CMD_CHFLAG('g')|CMD_CHFLAG('r')|CMD_CHFLAG('u'),
+ CMD_ARG12, "gru",
NULL,
cmd_target_parse,
cmd_set_environment_exec,
@@ -56,7 +56,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
env = &global_environ;
else {
if ((s = cmd_find_session(ctx, data->target)) == NULL)
@@ -64,13 +64,13 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_ctx *ctx)
env = &s->environ;
}
- if (data->chflags & CMD_CHFLAG('u')) {
+ if (cmd_check_flag(data->chflags, 'u')) {
if (data->arg2 != NULL) {
ctx->error(ctx, "can't specify a value with -u");
return (-1);
}
environ_unset(env, data->arg);
- } else if (data->chflags & CMD_CHFLAG('r')) {
+ } else if (cmd_check_flag(data->chflags, 'r')) {
if (data->arg2 != NULL) {
ctx->error(ctx, "can't specify a value with -r");
return (-1);
diff --git a/cmd-set-option.c b/cmd-set-option.c
index dfd3455..b178ba8 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.85 2009/11/02 21:38:26 tcunha Exp $ */
+/* $Id: cmd-set-option.c,v 1.86 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_set_option_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_set_option_entry = {
"set-option", "set",
"[-agu] " CMD_TARGET_SESSION_USAGE " option [value]",
- CMD_ARG12, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'),
+ CMD_ARG12, "agu",
NULL,
cmd_target_parse,
cmd_set_option_exec,
@@ -113,7 +113,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
u_int i;
int try_again;
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
oo = &global_s_options;
else {
if ((s = cmd_find_session(ctx, data->target)) == NULL)
@@ -145,8 +145,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if (data->chflags & CMD_CHFLAG('u')) {
- if (data->chflags & CMD_CHFLAG('g')) {
+ if (cmd_check_flag(data->chflags, 'u')) {
+ if (cmd_check_flag(data->chflags, 'g')) {
ctx->error(ctx,
"can't unset global option: %s", entry->name);
return (-1);
@@ -163,7 +163,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
switch (entry->type) {
case SET_OPTION_STRING:
set_option_string(ctx, oo, entry,
- data->arg2, data->chflags & CMD_CHFLAG('a'));
+ data->arg2, cmd_check_flag(data->chflags, 'a'));
break;
case SET_OPTION_NUMBER:
set_option_number(ctx, oo, entry, data->arg2);
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c
index cb18bd9..dd1cc24 100644
--- a/cmd-set-window-option.c
+++ b/cmd-set-window-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-window-option.c,v 1.40 2009/10/09 13:07:04 tcunha Exp $ */
+/* $Id: cmd-set-window-option.c,v 1.41 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_set_window_option_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_set_window_option_entry = {
"set-window-option", "setw",
"[-agu] " CMD_TARGET_WINDOW_USAGE " option [value]",
- CMD_ARG12, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'),
+ CMD_ARG12, "agu",
NULL,
cmd_target_parse,
cmd_set_window_option_exec,
@@ -86,7 +86,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
const struct set_option_entry *entry, *opt;
u_int i;
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
oo = &global_w_options;
else {
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
@@ -118,8 +118,8 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if (data->chflags & CMD_CHFLAG('u')) {
- if (data->chflags & CMD_CHFLAG('g')) {
+ if (cmd_check_flag(data->chflags, 'u')) {
+ if (cmd_check_flag(data->chflags, 'g')) {
ctx->error(ctx,
"can't unset global option: %s", entry->name);
return (-1);
@@ -136,7 +136,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
switch (entry->type) {
case SET_OPTION_STRING:
set_option_string(ctx, oo, entry,
- data->arg2, data->chflags & CMD_CHFLAG('a'));
+ data->arg2, cmd_check_flag(data->chflags, 'a'));
break;
case SET_OPTION_NUMBER:
set_option_number(ctx, oo, entry, data->arg2);
diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c
index b06128f..21c5dc6 100644
--- a/cmd-show-buffer.c
+++ b/cmd-show-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-buffer.c,v 1.10 2009/09/07 23:48:54 tcunha Exp $ */
+/* $Id: cmd-show-buffer.c,v 1.11 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_buffer_entry = {
"show-buffer", "showb",
CMD_BUFFER_SESSION_USAGE,
- 0, 0,
+ 0, "",
cmd_buffer_init,
cmd_buffer_parse,
cmd_show_buffer_exec,
diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index 6ee7419..ed12f27 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-environment.c,v 1.1 2009/08/09 17:48:55 tcunha Exp $ */
+/* $Id: cmd-show-environment.c,v 1.2 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_show_environment_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_environment_entry = {
"show-environment", "showenv",
"[-g] " CMD_TARGET_SESSION_USAGE,
- 0, CMD_CHFLAG('g'),
+ 0, "g",
cmd_target_init,
cmd_target_parse,
cmd_show_environment_exec,
@@ -48,7 +48,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_ctx *ctx)
struct environ *env;
struct environ_entry *envent;
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
env = &global_environ;
else {
if ((s = cmd_find_session(ctx, data->target)) == NULL)
diff --git a/cmd-show-options.c b/cmd-show-options.c
index cb807b5..d77fac0 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-options.c,v 1.17 2009/09/22 13:56:02 tcunha Exp $ */
+/* $Id: cmd-show-options.c,v 1.18 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_show_options_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_options_entry = {
"show-options", "show",
"[-g] " CMD_TARGET_SESSION_USAGE,
- 0, CMD_CHFLAG('g'),
+ 0, "g",
cmd_target_init,
cmd_target_parse,
cmd_show_options_exec,
@@ -50,7 +50,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
const struct set_option_entry *entry;
const char *optval;
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
oo = &global_s_options;
else {
if ((s = cmd_find_session(ctx, data->target)) == NULL)
diff --git a/cmd-show-window-options.c b/cmd-show-window-options.c
index 9ee5b36..56dfda7 100644
--- a/cmd-show-window-options.c
+++ b/cmd-show-window-options.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-window-options.c,v 1.13 2009/09/22 13:56:02 tcunha Exp $ */
+/* $Id: cmd-show-window-options.c,v 1.14 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_show_window_options_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_window_options_entry = {
"show-window-options", "showw",
"[-g] " CMD_TARGET_WINDOW_USAGE,
- 0, CMD_CHFLAG('g'),
+ 0, "g",
cmd_target_init,
cmd_target_parse,
cmd_show_window_options_exec,
@@ -50,7 +50,7 @@ cmd_show_window_options_exec(struct cmd *self, struct cmd_ctx *ctx)
const struct set_option_entry *entry;
const char *optval;
- if (data->chflags & CMD_CHFLAG('g'))
+ if (cmd_check_flag(data->chflags, 'g'))
oo = &global_w_options;
else {
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
diff --git a/cmd-source-file.c b/cmd-source-file.c
index a1d12a4..3a0d381 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-source-file.c,v 1.9 2009/09/22 14:06:40 tcunha Exp $ */
+/* $Id: cmd-source-file.c,v 1.10 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2008 Tiago Cunha <[email protected]>
@@ -37,7 +37,7 @@ struct cmd_source_file_data {
const struct cmd_entry cmd_source_file_entry = {
"source-file", "source",
"path",
- 0, 0,
+ 0, "",
cmd_source_file_init,
cmd_source_file_parse,
cmd_source_file_exec,
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 8f7e041..9982657 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-split-window.c,v 1.28 2009/09/22 14:06:40 tcunha Exp $ */
+/* $Id: cmd-split-window.c,v 1.29 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -45,7 +45,7 @@ struct cmd_split_window_data {
const struct cmd_entry cmd_split_window_entry = {
"split-window", "splitw",
"[-dhv] [-p percentage|-l size] [-t target-window] [command]",
- 0, 0,
+ 0, "",
cmd_split_window_init,
cmd_split_window_parse,
cmd_split_window_exec,
diff --git a/cmd-start-server.c b/cmd-start-server.c
index d58656a..d48c7d0 100644
--- a/cmd-start-server.c
+++ b/cmd-start-server.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-start-server.c,v 1.9 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_start_server_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_start_server_entry = {
"start-server", "start",
"",
- CMD_STARTSERVER, 0,
+ CMD_STARTSERVER, "",
NULL,
NULL,
cmd_start_server_exec,
diff --git a/cmd-suspend-client.c b/cmd-suspend-client.c
index 0e0c186..1bfadb0 100644
--- a/cmd-suspend-client.c
+++ b/cmd-suspend-client.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-suspend-client.c,v 1.5 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -37,7 +37,7 @@ struct cmd_suspend_client_data {
const struct cmd_entry cmd_suspend_client_entry = {
"suspend-client", "suspendc",
"[-c target-client]",
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_suspend_client_exec,
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
index 7e6d962..4716a92 100644
--- a/cmd-swap-pane.c
+++ b/cmd-swap-pane.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-swap-pane.c,v 1.14 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -32,7 +32,7 @@ int cmd_swap_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_swap_pane_entry = {
"swap-pane", "swapp",
"[-dDU] " CMD_SRCDST_PANE_USAGE,
- 0, CMD_CHFLAG('d')|CMD_CHFLAG('D')|CMD_CHFLAG('U'),
+ 0, "dDU",
cmd_swap_pane_init,
cmd_srcdst_parse,
cmd_swap_pane_exec,
@@ -49,11 +49,12 @@ cmd_swap_pane_init(struct cmd *self, int key)
data = self->data;
if (key == '{')
- data->chflags |= CMD_CHFLAG('U');
+ cmd_set_flag(&data->chflags, 'U');
else if (key == '}')
- data->chflags |= CMD_CHFLAG('D');
+ cmd_set_flag(&data->chflags, 'D');
}
+
int
cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
@@ -73,11 +74,11 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (data->src == NULL) {
src_w = dst_w;
- if (data->chflags & CMD_CHFLAG('D')) {
+ if (cmd_check_flag(data->chflags, 'D')) {
src_wp = TAILQ_NEXT(dst_wp, entry);
if (src_wp == NULL)
src_wp = TAILQ_FIRST(&dst_w->panes);
- } else if (data->chflags & CMD_CHFLAG('U')) {
+ } else if (cmd_check_flag(data->chflags, 'U')) {
src_wp = TAILQ_PREV(dst_wp, window_panes, entry);
if (src_wp == NULL)
src_wp = TAILQ_LAST(&dst_w->panes, window_panes);
@@ -120,7 +121,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
dst_wp->xoff = xoff; dst_wp->yoff = yoff;
window_pane_resize(dst_wp, sx, sy);
- if (!(data->chflags & CMD_CHFLAG('d'))) {
+ if (!cmd_check_flag(data->chflags, 'd')) {
if (src_w != dst_w) {
window_set_active_pane(src_w, dst_wp);
window_set_active_pane(dst_w, src_wp);
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index 89baf33..e12c29e 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-swap-window.c,v 1.18 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-swap-window.c,v 1.19 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -31,7 +31,7 @@ int cmd_swap_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_swap_window_entry = {
"swap-window", "swapw",
"[-d] " CMD_SRCDST_WINDOW_USAGE,
- 0, CMD_CHFLAG('d'),
+ 0, "d",
cmd_srcdst_init,
cmd_srcdst_parse,
cmd_swap_window_exec,
@@ -68,7 +68,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
wl_dst->window = wl_src->window;
wl_src->window = w;
- if (!(data->chflags & CMD_CHFLAG('d'))) {
+ if (!cmd_check_flag(data->chflags, 'd')) {
session_select(dst, wl_dst->idx);
if (src != dst)
session_select(src, wl_src->idx);
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 16ab957..2f59f24 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-switch-client.c,v 1.18 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -40,7 +40,7 @@ struct cmd_switch_client_data {
const struct cmd_entry cmd_switch_client_entry = {
"switch-client", "switchc",
"[-c target-client] [-t target-session]",
- 0, 0,
+ 0, "",
NULL,
cmd_switch_client_parse,
cmd_switch_client_exec,
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index 5831222..464186a 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-unbind-key.c,v 1.21 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -40,7 +40,7 @@ struct cmd_unbind_key_data {
const struct cmd_entry cmd_unbind_key_entry = {
"unbind-key", "unbind",
"[-cn] [-t key-table] key",
- 0, 0,
+ 0, "",
NULL,
cmd_unbind_key_parse,
cmd_unbind_key_exec,
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index e2b2551..62a83d8 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unlink-window.c,v 1.19 2009/10/11 23:38:16 tcunha Exp $ */
+/* $Id: cmd-unlink-window.c,v 1.20 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_unlink_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_unlink_window_entry = {
"unlink-window", "unlinkw",
"[-k] " CMD_TARGET_WINDOW_USAGE,
- 0, CMD_CHFLAG('k'),
+ 0, "k",
cmd_target_init,
cmd_target_parse,
cmd_unlink_window_exec,
@@ -59,7 +59,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
} else
references = 1;
- if (!(data->chflags & CMD_CHFLAG('k')) && w->references == references) {
+ if (!cmd_check_flag(data->chflags, 'k') && w->references == references) {
ctx->error(ctx, "window is only linked to one session");
return (-1);
}
diff --git a/cmd-up-pane.c b/cmd-up-pane.c
index 96e90a0..c5281b4 100644
--- a/cmd-up-pane.c
+++ b/cmd-up-pane.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: cmd-up-pane.c,v 1.13 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -29,7 +29,7 @@ int cmd_up_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_up_pane_entry = {
"up-pane", "upp",
CMD_TARGET_WINDOW_USAGE,
- 0, 0,
+ 0, "",
cmd_target_init,
cmd_target_parse,
cmd_up_pane_exec,
diff --git a/tmux.h b/tmux.h
index 3fffae2..76b5767 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.515 2009/11/14 17:48:39 tcunha Exp $ */
+/* $Id: tmux.h,v 1.516 2009/11/14 17:56:39 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -1149,10 +1149,7 @@ struct cmd_entry {
#define CMD_ARG12 0x40
int flags;
-#define CMD_CHFLAG(flag) \
- ((flag) >= 'a' && (flag) <= 'z' ? 1ULL << ((flag) - 'a') : \
- (flag) >= 'A' && (flag) <= 'Z' ? 1ULL << (26 + (flag) - 'A') : 0)
- uint64_t chflags;
+ const char *chflags;
void (*init)(struct cmd *, int);
int (*parse)(struct cmd *, int, char **, char **);
@@ -1501,6 +1498,8 @@ int cmd_string_parse(const char *, struct cmd_list **, char **);
/* cmd-generic.c */
size_t cmd_prarg(char *, size_t, const char *, char *);
+int cmd_check_flag(uint64_t, int);
+void cmd_set_flag(uint64_t *, int);
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
#define CMD_TARGET_SESSION_USAGE "[-t target-session]"