mirror of
https://github.com/tmux/tmux.git
synced 2026-10-09 19:54:22 +00:00
Fix some errors.
This commit is contained in:
18
cmd-invoke.c
18
cmd-invoke.c
@@ -453,20 +453,26 @@ cmd_invoke_fire(struct cmdq_item *item, struct cmd_invoke_state *is)
|
|||||||
break;
|
break;
|
||||||
case CMD_PARSE_ASSIGN:
|
case CMD_PARSE_ASSIGN:
|
||||||
case CMD_PARSE_HIDDEN_ASSIGN:
|
case CMD_PARSE_HIDDEN_ASSIGN:
|
||||||
if (cmd_invoke_assignment(item, is, node) != 0)
|
if (cmd_invoke_assignment(item, is, node) != 0) {
|
||||||
return (CMD_RETURN_ERROR);
|
cmdq_error(item, "bad assignment");
|
||||||
|
cmd_invoke_skip_sequence(is);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_PARSE_IF:
|
case CMD_PARSE_IF:
|
||||||
if (cmd_invoke_if(item, is, node) != 0)
|
if (cmd_invoke_if(item, is, node) != 0) {
|
||||||
return (CMD_RETURN_ERROR);
|
cmdq_error(item, "bad condition");
|
||||||
|
cmd_invoke_skip_sequence(is);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_PARSE_ELIF:
|
case CMD_PARSE_ELIF:
|
||||||
case CMD_PARSE_ELSE:
|
case CMD_PARSE_ELSE:
|
||||||
break;
|
break;
|
||||||
case CMD_PARSE_COMMAND:
|
case CMD_PARSE_COMMAND:
|
||||||
cmd = cmd_invoke_build_command(item, is, node);
|
cmd = cmd_invoke_build_command(item, is, node);
|
||||||
if (cmd == NULL)
|
if (cmd == NULL) {
|
||||||
return (CMD_RETURN_ERROR);
|
cmd_invoke_skip_sequence(is);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Queue one command followed by this walker. WAIT and
|
* Queue one command followed by this walker. WAIT and
|
||||||
|
|||||||
10
cmd-parse.y
10
cmd-parse.y
@@ -660,18 +660,18 @@ cmd_parse_from_string(const char *s, struct cmd_parse_input *pi, char **cause)
|
|||||||
{
|
{
|
||||||
struct cmd_parse_input input;
|
struct cmd_parse_input input;
|
||||||
|
|
||||||
if (pi == NULL) {
|
if (pi != NULL)
|
||||||
|
memcpy(&input, pi, sizeof input);
|
||||||
|
else
|
||||||
memset(&input, 0, sizeof input);
|
memset(&input, 0, sizeof input);
|
||||||
pi = &input;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When parsing a string, put commands in one group even if there are
|
* When parsing a string, put commands in one group even if there are
|
||||||
* multiple lines. This means { a \n b } is identical to "a ; b" when
|
* multiple lines. This means { a \n b } is identical to "a ; b" when
|
||||||
* given as an argument to another command.
|
* given as an argument to another command.
|
||||||
*/
|
*/
|
||||||
pi->flags |= CMD_PARSE_ONEGROUP;
|
input.flags |= CMD_PARSE_ONEGROUP;
|
||||||
return (cmd_parse_from_buffer(s, strlen(s), pi, cause));
|
return (cmd_parse_from_buffer(s, strlen(s), &input, cause));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cmd_parse_tree *
|
struct cmd_parse_tree *
|
||||||
|
|||||||
@@ -44,19 +44,4 @@ void log_debug(const char *, ...) printflike(1, 2);
|
|||||||
__dead void fatal(const char *, ...) printflike(1, 2);
|
__dead void fatal(const char *, ...) printflike(1, 2);
|
||||||
__dead void fatalx(const char *, ...) printflike(1, 2);
|
__dead void fatalx(const char *, ...) printflike(1, 2);
|
||||||
|
|
||||||
/*
|
|
||||||
* Parser input. The real struct has more fields, but the AST parser only
|
|
||||||
* touches flags, file and line.
|
|
||||||
*/
|
|
||||||
struct cmd_parse_input {
|
|
||||||
int flags;
|
|
||||||
#define CMD_PARSE_QUIET 0x1
|
|
||||||
#define CMD_PARSE_PARSEONLY 0x2
|
|
||||||
#define CMD_PARSE_NOALIAS 0x4
|
|
||||||
#define CMD_PARSE_VERBOSE 0x8
|
|
||||||
#define CMD_PARSE_ONEGROUP 0x10
|
|
||||||
const char *file;
|
|
||||||
u_int line;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TMUX_TEST_STUB_H */
|
#endif /* TMUX_TEST_STUB_H */
|
||||||
|
|||||||
@@ -38,7 +38,29 @@
|
|||||||
|
|
||||||
struct cmd_parse_tree;
|
struct cmd_parse_tree;
|
||||||
struct cmd_parse_node;
|
struct cmd_parse_node;
|
||||||
struct cmd_parse_input;
|
|
||||||
|
enum cmd_parse_status {
|
||||||
|
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 /* XXX */
|
||||||
|
#define CMD_PARSE_NOALIAS 0x4 /* XXX */
|
||||||
|
#define CMD_PARSE_VERBOSE 0x8 /* XXX */
|
||||||
|
#define CMD_PARSE_ONEGROUP 0x10
|
||||||
|
|
||||||
|
const char *file;
|
||||||
|
u_int line;
|
||||||
|
};
|
||||||
|
|
||||||
enum cmd_parse_node_type {
|
enum cmd_parse_node_type {
|
||||||
CMD_PARSE_ROOT,
|
CMD_PARSE_ROOT,
|
||||||
|
|||||||
41
tmux.h
41
tmux.h
@@ -1939,32 +1939,6 @@ enum cmd_retval {
|
|||||||
CMD_RETURN_STOP
|
CMD_RETURN_STOP
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Command parse result. */
|
|
||||||
enum cmd_parse_status {
|
|
||||||
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
|
|
||||||
#define CMD_PARSE_VERBOSE 0x8
|
|
||||||
#define CMD_PARSE_ONEGROUP 0x10
|
|
||||||
|
|
||||||
const char *file;
|
|
||||||
u_int line;
|
|
||||||
|
|
||||||
struct cmdq_item *item;
|
|
||||||
struct client *c;
|
|
||||||
struct cmd_find_state fs;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Command queue flags. */
|
/* Command queue flags. */
|
||||||
#define CMDQ_STATE_REPEAT 0x1
|
#define CMDQ_STATE_REPEAT 0x1
|
||||||
#define CMDQ_STATE_CONTROL 0x2
|
#define CMDQ_STATE_CONTROL 0x2
|
||||||
@@ -3011,21 +2985,6 @@ char *cmd_template_replace(const char *, const char *, int);
|
|||||||
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
|
enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
|
||||||
int, const char *, int, const char *);
|
int, const char *, int, const char *);
|
||||||
|
|
||||||
/* cmd-parse.c */
|
|
||||||
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 *);
|
|
||||||
enum cmd_parse_status cmd_parse_and_insert(const char *,
|
|
||||||
struct cmd_parse_input *, struct cmdq_item *,
|
|
||||||
struct cmdq_state *, char **);
|
|
||||||
enum cmd_parse_status cmd_parse_and_append(const char *,
|
|
||||||
struct cmd_parse_input *, struct client *,
|
|
||||||
struct cmdq_state *, char **);
|
|
||||||
struct cmd_parse_result *cmd_parse_from_buffer(const void *, size_t,
|
|
||||||
struct cmd_parse_input *);
|
|
||||||
struct cmd_parse_result *cmd_parse_from_arguments(struct args_value *, u_int,
|
|
||||||
struct cmd_parse_input *);
|
|
||||||
|
|
||||||
/* cmd-invoke.c */
|
/* cmd-invoke.c */
|
||||||
struct cmdq_item *cmd_invoke_get(struct cmd_parse_tree *, struct cmdq_state *,
|
struct cmdq_item *cmd_invoke_get(struct cmd_parse_tree *, struct cmdq_state *,
|
||||||
int, char **);
|
int, char **);
|
||||||
|
|||||||
Reference in New Issue
Block a user