mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 21:14:21 +00:00
Log func also.
This commit is contained in:
18
cmd-parse.y
18
cmd-parse.y
@@ -831,34 +831,36 @@ cmd_parse_escape(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cmd_parse_log_one_node(struct cmd_parse_node *node, u_int depth)
|
cmd_parse_log_one_node(const char *prefix, struct cmd_parse_node *node,
|
||||||
|
u_int depth)
|
||||||
{
|
{
|
||||||
struct cmd_parse_node *child;
|
struct cmd_parse_node *child;
|
||||||
const char *type = cmd_parse_node_type_string(node->type);
|
const char *type = cmd_parse_node_type_string(node->type);
|
||||||
char *escaped;
|
char *escaped;
|
||||||
|
|
||||||
if (node->value == NULL)
|
if (node->value == NULL)
|
||||||
log_debug("%*s%s", depth * 2, "", type);
|
log_debug("%s: %*s%s", prefix, depth * 2, "", type);
|
||||||
else {
|
else {
|
||||||
escaped = cmd_parse_escape(node->value);
|
escaped = cmd_parse_escape(node->value);
|
||||||
log_debug("%*s%s value=\"%s\"", depth * 2, "", type, escaped);
|
log_debug("%s: %*s%s value=\"%s\"", prefix, depth * 2, "",
|
||||||
|
type, escaped);
|
||||||
free(escaped);
|
free(escaped);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(child, &node->children, entry)
|
TAILQ_FOREACH(child, &node->children, entry)
|
||||||
cmd_parse_log_one_node(child, depth + 1);
|
cmd_parse_log_one_node(prefix, child, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_parse_log_node(struct cmd_parse_node *node)
|
cmd_parse_log_node(const char *prefix, struct cmd_parse_node *node)
|
||||||
{
|
{
|
||||||
cmd_parse_log_one_node(node, 0);
|
cmd_parse_log_one_node(prefix, node, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_parse_log(struct cmd_parse_tree *tree)
|
cmd_parse_log(const char *prefix, struct cmd_parse_tree *tree)
|
||||||
{
|
{
|
||||||
cmd_parse_log_node(tree->root);
|
cmd_parse_log_node(prefix, tree->root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does this literal text need quoting to reparse as itself? */
|
/* Does this literal text need quoting to reparse as itself? */
|
||||||
|
|||||||
@@ -81,8 +81,9 @@ struct cmd_parse_tree *cmd_parse_add_ref(struct cmd_parse_tree *);
|
|||||||
void cmd_parse_free(struct cmd_parse_tree *);
|
void cmd_parse_free(struct cmd_parse_tree *);
|
||||||
struct cmd_parse_node *cmd_parse_root(struct cmd_parse_tree *);
|
struct cmd_parse_node *cmd_parse_root(struct cmd_parse_tree *);
|
||||||
char *cmd_parse_print(struct cmd_parse_tree *);
|
char *cmd_parse_print(struct cmd_parse_tree *);
|
||||||
void cmd_parse_log(struct cmd_parse_tree *);
|
void cmd_parse_log(const char *, struct cmd_parse_tree *);
|
||||||
void cmd_parse_log_node(struct cmd_parse_node *);
|
void cmd_parse_log_node(const char *,
|
||||||
|
struct cmd_parse_node *);
|
||||||
enum cmd_parse_node_type cmd_parse_node_type(struct cmd_parse_node *);
|
enum cmd_parse_node_type cmd_parse_node_type(struct cmd_parse_node *);
|
||||||
const char *cmd_parse_node_type_string(enum cmd_parse_node_type);
|
const char *cmd_parse_node_type_string(enum cmd_parse_node_type);
|
||||||
const char *cmd_parse_node_value(struct cmd_parse_node *);
|
const char *cmd_parse_node_value(struct cmd_parse_node *);
|
||||||
|
|||||||
Reference in New Issue
Block a user