From dd77f0d37e6b1f73c68bd6155356590477289422 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 23 Oct 2014 14:40:38 +0200 Subject: command: print executed commands with -v --- input/cmd_parse.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'input/cmd_parse.c') diff --git a/input/cmd_parse.c b/input/cmd_parse.c index 335d0d96b4..90d2650cf9 100644 --- a/input/cmd_parse.c +++ b/input/cmd_parse.c @@ -423,6 +423,27 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd) return ret; } +void mp_cmd_dump(struct mp_log *log, int msgl, char *header, struct mp_cmd *cmd) +{ + if (!mp_msg_test(log, msgl)) + return; + if (header) + mp_msg(log, msgl, "%s: ", header); + if (!cmd) { + mp_msg(log, msgl, "(NULL)\n"); + return; + } + mp_msg(log, msgl, "%s, flags=%d args=[", cmd->name, cmd->flags); + for (int n = 0; n < cmd->nargs; n++) { + char *s = m_option_print(cmd->args[n].type, &cmd->args[n].v); + if (n) + mp_msg(log, msgl, ", "); + mp_msg(log, msgl, "%s", s ? s : "(NULL)"); + talloc_free(s); + } + mp_msg(log, msgl, "]\n"); +} + static int parse_cycle_dir(struct mp_log *log, const struct m_option *opt, struct bstr name, struct bstr param, void *dst) { -- cgit v1.2.3