diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-08-02 18:35:22 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-08-02 18:35:22 +0000 |
commit | 8ae7c3fdc5cfd6a41bbef6f30bc08b65b313bdd0 (patch) | |
tree | ec430543cab50463c7e203d9654cd3563eedc58b /usr.bin/tmux/cmd.c | |
parent | e9b702b74b6db0e19a446441c14ad9025dcf6b46 (diff) |
Log command arguments.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r-- | usr.bin/tmux/cmd.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index ac69f21db24..b152e81840e 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.139 2017/05/30 21:44:59 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.140 2018/08/02 18:35:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -201,6 +201,15 @@ const struct cmd_entry *cmd_table[] = { NULL }; +void +cmd_log_argv(int argc, char **argv, const char *prefix) +{ + int i; + + for (i = 0; i < argc; i++) + log_debug("%s: argv[%d]=%s", prefix, i, argv[i]); +} + int cmd_pack_argv(int argc, char **argv, char *buf, size_t len) { @@ -209,6 +218,7 @@ cmd_pack_argv(int argc, char **argv, char *buf, size_t len) if (argc == 0) return (0); + cmd_log_argv(argc, argv, __func__); *buf = '\0'; for (i = 0; i < argc; i++) { @@ -241,9 +251,11 @@ cmd_unpack_argv(char *buf, size_t len, int argc, char ***argv) arglen = strlen(buf) + 1; (*argv)[i] = xstrdup(buf); + buf += arglen; len -= arglen; } + cmd_log_argv(argc, *argv, __func__); return (0); } @@ -402,6 +414,7 @@ retry: xasprintf(cause, "unknown command: %s", name); return (NULL); } + cmd_log_argv(argc, argv, entry->name); args = args_parse(entry->args.template, argc, argv); if (args == NULL) |