summaryrefslogtreecommitdiffstats
path: root/names.c
diff options
context:
space:
mode:
authornicm <nicm>2014-05-13 08:08:32 +0000
committernicm <nicm>2014-05-13 08:08:32 +0000
commitb3e8d440ed0477e88232c3ba1779c67eafce3a48 (patch)
tree09e92eb59a30d393132b4da6d8cc3d3623f755b2 /names.c
parentb1a06ef22e54e943d733db8dcc98fe60051c93de (diff)
If multiple arguments are given to new-session, new-window,
split-window, respawn-window or respawn-pane, pass them directly to execvp() to help avoid quoting problems. One argument still goes to "sh -c" like before. Requested by many over the years. Patch from J Raynor.
Diffstat (limited to 'names.c')
-rw-r--r--names.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/names.c b/names.c
index cfdaff83..8e01d347 100644
--- a/names.c
+++ b/names.c
@@ -68,9 +68,15 @@ window_name_callback(unused int fd, unused short events, void *data)
char *
default_window_name(struct window *w)
{
- if (w->active->cmd != NULL && *w->active->cmd != '\0')
- return (parse_window_name(w->active->cmd));
- return (parse_window_name(w->active->shell));
+ char *cmd, *s;
+
+ cmd = cmd_stringify_argv(w->active->argc, w->active->argv);
+ if (cmd != NULL && *cmd != '\0')
+ s = parse_window_name(cmd);
+ else
+ s = parse_window_name(w->active->shell);
+ free(cmd);
+ return (s);
}
char *