diff options
Diffstat (limited to 'usr.bin/tmux/tmux.h')
-rw-r--r-- | usr.bin/tmux/tmux.h | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 3a57a6f11eb..7d5b49606e8 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.901 2019/05/20 13:23:32 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.902 2019/05/23 11:13:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1279,18 +1279,25 @@ struct cmd_find_state { /* Command and list of commands. */ struct cmd { - const struct cmd_entry *entry; - struct args *args; + const struct cmd_entry *entry; + struct args *args; + u_int group; - char *file; - u_int line; + char *file; + u_int line; + + char *alias; + int argc; + char **argv; - TAILQ_ENTRY(cmd) qentry; + TAILQ_ENTRY(cmd) qentry; }; +TAILQ_HEAD(cmds, cmd); struct cmd_list { - int references; - TAILQ_HEAD(, cmd) list; + int references; + u_int group; + struct cmds list; }; /* Command return values. */ @@ -1301,6 +1308,31 @@ enum cmd_retval { CMD_RETURN_STOP }; +/* Command parse result. */ +enum cmd_parse_status { + CMD_PARSE_EMPTY, + CMD_PARSE_ERROR, + CMD_PARSE_SUCCESS +}; +struct cmd_parse_result { + enum cmd_parse_status status; + struct cmd_list *cmdlist; + char *error; +}; +struct cmd_parse_input { + int flags; +#define CMD_PARSE_QUIET 0x1 +#define CMD_PARSE_PARSEONLY 0x2 +#define CMD_PARSE_NOALIAS 0x4 + + const char *file; + u_int line; + + struct cmdq_item *item; + struct client *c; + struct cmd_find_state fs; +}; + /* Command queue item type. */ enum cmdq_type { CMDQ_COMMAND, @@ -1671,7 +1703,6 @@ void proc_toggle_log(struct tmuxproc *); /* cfg.c */ extern int cfg_finished; extern struct client *cfg_client; -#define CFG_QUIET 0x1 void start_cfg(void); int load_cfg(const char *, struct client *, struct cmdq_item *, int, struct cmdq_item **); @@ -1956,12 +1987,16 @@ int cmd_find_from_nothing(struct cmd_find_state *, int); /* cmd.c */ void cmd_log_argv(int, char **, const char *); +void cmd_prepend_argv(int *, char ***, char *); +void cmd_append_argv(int *, char ***, char *); int cmd_pack_argv(int, char **, char *, size_t); int cmd_unpack_argv(char *, size_t, int, char ***); char **cmd_copy_argv(int, char **); void cmd_free_argv(int, char **); char *cmd_stringify_argv(int, char **); +char *cmd_get_alias(const char *); struct cmd *cmd_parse(int, char **, const char *, u_int, char **); +void cmd_free(struct cmd *); char *cmd_print(struct cmd *); int cmd_mouse_at(struct window_pane *, struct mouse_event *, u_int *, u_int *, int); @@ -1975,7 +2010,16 @@ extern const struct cmd_entry *cmd_table[]; enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int, const char *, int); +/* cmd-parse.c */ +void cmd_parse_empty(struct cmd_parse_input *); +struct cmd_parse_result *cmd_parse_from_file(FILE *, struct cmd_parse_input *); +struct cmd_parse_result *cmd_parse_from_string(const char *, + struct cmd_parse_input *); + /* cmd-list.c */ +struct cmd_list *cmd_list_new(void); +void cmd_list_append(struct cmd_list *, struct cmd *); +void cmd_list_move(struct cmd_list *, struct cmd_list *); struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **); void cmd_list_free(struct cmd_list *); char *cmd_list_print(struct cmd_list *); @@ -1997,10 +2041,6 @@ void cmdq_guard(struct cmdq_item *, const char *, int); void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...); void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...); -/* cmd-string.c */ -int cmd_string_split(const char *, int *, char ***); -struct cmd_list *cmd_string_parse(const char *, const char *, u_int, char **); - /* cmd-wait-for.c */ void cmd_wait_for_flush(void); |