aboutsummaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-09-02 01:02:44 +0000
committerTiago Cunha <tcunha@gmx.com>2009-09-02 01:02:44 +0000
commita3a150faf22fe1d8303e8e92aa2a6d92e7e10b5c (patch)
treed1ab94890474f4ecb77b3d482390ad7f61f4033e /session.c
parentce5c441f0fddc70c9ac982eb4741d3d0230d51a2 (diff)
downloadrtmux-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 'session.c')
-rw-r--r--session.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/session.c b/session.c
index eedee301..39873082 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.62 2009-08-16 19:16:27 tcunha Exp $ */
+/* $Id: session.c,v 1.63 2009-09-02 01:02:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/time.h>
+#include <paths.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -207,6 +208,7 @@ session_new(struct session *s,
{
struct window *w;
struct environ env;
+ const char *shell;
u_int hlimit;
environ_init(&env);
@@ -214,9 +216,13 @@ session_new(struct session *s,
environ_copy(&s->environ, &env);
server_fill_environ(s, &env);
+ shell = options_get_string(&s->options, "default-shell");
+ if (*shell == '\0' || areshell(shell))
+ shell = _PATH_BSHELL;
+
hlimit = options_get_number(&s->options, "history-limit");
w = window_create(
- name, cmd, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause);
+ name, cmd, shell, cwd, &env, &s->tio, s->sx, s->sy, hlimit, cause);
if (w == NULL) {
environ_free(&env);
return (NULL);