Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2018-08-02 21:02:25 +01:00
commit 33f9b316a3
3 changed files with 15 additions and 2 deletions

13
cmd.c
View File

@ -200,6 +200,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)
{
@ -208,6 +217,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++) {
@ -240,9 +250,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);
}
@ -401,6 +413,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)

1
tmux.h
View File

@ -1764,6 +1764,7 @@ int cmd_find_from_mouse(struct cmd_find_state *,
int cmd_find_from_nothing(struct cmd_find_state *, int);
/* cmd.c */
void cmd_log_argv(int, char **, const char *);
int cmd_pack_argv(int, char **, char *, size_t);
int cmd_unpack_argv(char *, size_t, int, char ***);
char **cmd_copy_argv(int, char **);

View File

@ -924,8 +924,7 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
log_debug("%s: shell=%s", __func__, wp->shell);
log_debug("%s: cmd=%s", __func__, cmd);
log_debug("%s: cwd=%s", __func__, cwd);
for (i = 0; i < wp->argc; i++)
log_debug("%s: argv[%d]=%s", __func__, i, wp->argv[i]);
cmd_log_argv(wp->argc, wp->argv, __func__);
environ_log(env, "%s: environment ", __func__);
memset(&ws, 0, sizeof ws);