diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-09-02 01:02:44 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-09-02 01:02:44 +0000 |
commit | a3a150faf22fe1d8303e8e92aa2a6d92e7e10b5c (patch) | |
tree | d1ab94890474f4ecb77b3d482390ad7f61f4033e /cmd-split-window.c | |
parent | ce5c441f0fddc70c9ac982eb4741d3d0230d51a2 (diff) | |
download | rtmux-a3a150faf22fe1d8303e8e92aa2a6d92e7e10b5c.tar.gz rtmux-a3a150faf22fe1d8303e8e92aa2a6d92e7e10b5c.tar.bz2 rtmux-a3a150faf22fe1d8303e8e92aa2a6d92e7e10b5c.zip |
Sync OpenBSD patchset 305:
When using tmux as a login shell, there is currently no way to specify a shell
to be used as a login shell inside tmux, so add a default-shell session option.
This sets the shell invoked as a login shell when the default-command option is
empty.
The default option value is whichever of $SHELL, getpwuid(getuid())'s pw_shell
or /bin/sh is valid first.
Based on a diff from martynas@, changed by me to be a session option rather
than a window option.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index f33ad562..8bee56d2 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-split-window.c,v 1.24 2009-08-25 16:52:42 tcunha Exp $ */ +/* $Id: cmd-split-window.c,v 1.25 2009-09-02 01:02:44 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -18,6 +18,7 @@ #include <sys/types.h> +#include <paths.h> #include <stdlib.h> #include <unistd.h> @@ -151,6 +152,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct window_pane *wp; struct environ env; char *cmd, *cwd, *cause; + const char *shell; u_int hlimit; int size; enum layout_type type; @@ -183,8 +185,12 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) if (data->flag_horizontal) type = LAYOUT_LEFTRIGHT; + shell = options_get_string(&s->options, "default-shell"); + if (*shell == '\0' || areshell(shell)) + shell = _PATH_BSHELL; + wp = window_add_pane(w, hlimit); - if (window_pane_spawn(wp, cmd, cwd, &env, &s->tio, &cause) != 0) + if (window_pane_spawn(wp, cmd, shell, cwd, &env, &s->tio, &cause) != 0) goto error; if (layout_split_pane(w->active, type, size, wp) != 0) { cause = xstrdup("pane too small"); |