summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-07-11 07:10:15 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-07-11 07:10:15 +0000
commitede8312d59c5d08990f83f38682c26434823525b (patch)
treebdf66e80ca1d71548a554804f4ab6656a828a821 /tmux.h
parentdf912e3540968a2a0b266e523ecc08bb2dc0ca20 (diff)
Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix problems with using some commands in a command sequence. Most of the work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/tmux.h b/tmux.h
index 2538a97f..d189385f 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1331,6 +1331,13 @@ struct cmd_list {
TAILQ_HEAD(, cmd) list;
};
+enum cmd_retval {
+ CMD_RETURN_ERROR = -1,
+ CMD_RETURN_NORMAL = 0,
+ CMD_RETURN_YIELD,
+ CMD_RETURN_ATTACH
+};
+
struct cmd_entry {
const char *name;
const char *alias;
@@ -1349,7 +1356,7 @@ struct cmd_entry {
void (*key_binding)(struct cmd *, int);
int (*check)(struct args *);
- int (*exec)(struct cmd *, struct cmd_ctx *);
+ enum cmd_retval (*exec)(struct cmd *, struct cmd_ctx *);
};
/* Key binding. */
@@ -1641,7 +1648,7 @@ int cmd_unpack_argv(char *, size_t, int, char ***);
char **cmd_copy_argv(int, char *const *);
void cmd_free_argv(int, char **);
struct cmd *cmd_parse(int, char **, char **);
-int cmd_exec(struct cmd *, struct cmd_ctx *);
+enum cmd_retval cmd_exec(struct cmd *, struct cmd_ctx *);
void cmd_free(struct cmd *);
size_t cmd_print(struct cmd *, char *, size_t);
struct session *cmd_current_session(struct cmd_ctx *, int);
@@ -1745,7 +1752,7 @@ extern const struct cmd_entry cmd_up_pane_entry;
/* cmd-list.c */
struct cmd_list *cmd_list_parse(int, char **, char **);
-int cmd_list_exec(struct cmd_list *, struct cmd_ctx *);
+enum cmd_retval cmd_list_exec(struct cmd_list *, struct cmd_ctx *);
void cmd_list_free(struct cmd_list *);
size_t cmd_list_print(struct cmd_list *, char *, size_t);