version 1.750, 2017/04/21 20:26:34 |
version 1.751, 2017/04/22 10:22:39 |
|
|
#define CMD_FIND_DEFAULT_MARKED 0x8 |
#define CMD_FIND_DEFAULT_MARKED 0x8 |
#define CMD_FIND_EXACT_SESSION 0x10 |
#define CMD_FIND_EXACT_SESSION 0x10 |
#define CMD_FIND_EXACT_WINDOW 0x20 |
#define CMD_FIND_EXACT_WINDOW 0x20 |
|
#define CMD_FIND_CANFAIL 0x40 |
|
|
/* Context for command being executed. */ |
|
struct cmd_state { |
|
struct client *c; |
|
struct cmd_find_state tflag; |
|
struct cmd_find_state sflag; |
|
}; |
|
|
|
/* Command and list of commands. */ |
/* Command and list of commands. */ |
struct cmd { |
struct cmd { |
const struct cmd_entry *entry; |
const struct cmd_entry *entry; |
|
|
#define CMDQ_NOHOOKS 0x4 |
#define CMDQ_NOHOOKS 0x4 |
|
|
struct cmdq_shared *shared; |
struct cmdq_shared *shared; |
|
struct cmd_find_state source; |
|
struct cmd_find_state target; |
|
|
struct cmd_list *cmdlist; |
struct cmd_list *cmdlist; |
struct cmd *cmd; |
struct cmd *cmd; |
|
|
cmdq_cb cb; |
cmdq_cb cb; |
void *data; |
void *data; |
|
|
struct cmd_state state; |
|
|
|
TAILQ_ENTRY(cmdq_item) entry; |
TAILQ_ENTRY(cmdq_item) entry; |
}; |
}; |
TAILQ_HEAD(cmdq_list, cmdq_item); |
TAILQ_HEAD(cmdq_list, cmdq_item); |
|
|
/* Command -c, -t or -s flags. */ |
/* Command definition flag. */ |
enum cmd_entry_flag { |
struct cmd_entry_flag { |
CMD_NONE, |
char flag; |
|
enum cmd_find_type type; |
CMD_CLIENT, |
int flags; |
CMD_CLIENT_CANFAIL, |
|
|
|
CMD_SESSION, |
|
CMD_SESSION_CANFAIL, |
|
CMD_SESSION_PREFERUNATTACHED, |
|
CMD_SESSION_WITHPANE, /* implies PREFERUNATTACHED */ |
|
|
|
CMD_WINDOW, |
|
CMD_WINDOW_CANFAIL, |
|
CMD_WINDOW_MARKED, |
|
CMD_WINDOW_INDEX, |
|
|
|
CMD_PANE, |
|
CMD_PANE_CANFAIL, |
|
CMD_PANE_MARKED, |
|
|
|
CMD_MOVEW_R, |
|
}; |
}; |
|
|
/* Command definition. */ |
/* Command definition. */ |
|
|
} args; |
} args; |
const char *usage; |
const char *usage; |
|
|
enum cmd_entry_flag tflag; |
struct cmd_entry_flag source; |
enum cmd_entry_flag sflag; |
struct cmd_entry_flag target; |
enum cmd_entry_flag cflag; |
|
|
|
#define CMD_STARTSERVER 0x1 |
#define CMD_STARTSERVER 0x1 |
#define CMD_READONLY 0x2 |
#define CMD_READONLY 0x2 |
#define CMD_AFTERHOOK 0x4 |
#define CMD_AFTERHOOK 0x4 |
int flags; |
int flags; |
|
|
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *); |
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *); |
}; |
}; |
|
|
/* Client connection. */ |
/* Client connection. */ |
|
|
void cmd_free_argv(int, char **); |
void cmd_free_argv(int, char **); |
char *cmd_stringify_argv(int, char **); |
char *cmd_stringify_argv(int, char **); |
struct cmd *cmd_parse(int, char **, const char *, u_int, char **); |
struct cmd *cmd_parse(int, char **, const char *, u_int, char **); |
int cmd_prepare_state(struct cmd *, struct cmdq_item *); |
|
char *cmd_print(struct cmd *); |
char *cmd_print(struct cmd *); |
int cmd_mouse_at(struct window_pane *, struct mouse_event *, |
int cmd_mouse_at(struct window_pane *, struct mouse_event *, |
u_int *, u_int *, int); |
u_int *, u_int *, int); |
|
|
extern const struct cmd_entry *cmd_table[]; |
extern const struct cmd_entry *cmd_table[]; |
|
|
/* cmd-attach-session.c */ |
/* cmd-attach-session.c */ |
enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *, |
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int, |
int); |
const char *, int); |
|
|
/* cmd-list.c */ |
/* cmd-list.c */ |
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **); |
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **); |