mirror of
https://github.com/tmate-io/tmate.git
synced 2025-02-08 22:40:02 +01:00
Add default-command option and change default to be $SHELL rather than $SHELL -l. Also try to read shell from passwd db if $SHELL isn't present.
This commit is contained in:
parent
8d09be0cb1
commit
f2f1b8fc81
7
CHANGES
7
CHANGES
@ -1,3 +1,8 @@
|
|||||||
|
20 October 2007
|
||||||
|
|
||||||
|
* (nicm) Add default-command option and change default to be $SHELL rather than
|
||||||
|
$SHELL -l. Also try to read shell from passwd db if $SHELL isn't present.
|
||||||
|
|
||||||
19 October 2007
|
19 October 2007
|
||||||
|
|
||||||
* (nicm) -n on new-session is now -s, and -n is now the initial window name.
|
* (nicm) -n on new-session is now -s, and -n is now the initial window name.
|
||||||
@ -139,5 +144,5 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.45 2007-10-19 17:15:28 nicm Exp $
|
$Id: CHANGES,v 1.46 2007-10-20 09:57:08 nicm Exp $
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-set-option.c,v 1.9 2007-10-19 10:21:33 nicm Exp $ */
|
/* $Id: cmd-set-option.c,v 1.10 2007-10-20 09:57:08 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -186,6 +186,13 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
|
|||||||
ctx->error(ctx, "unknown bell-action: %s", data->value);
|
ctx->error(ctx, "unknown bell-action: %s", data->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(data->option, "default-command") == 0) {
|
||||||
|
if (data->value == NULL) {
|
||||||
|
ctx->error(ctx, "invalid value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xfree(default_command);
|
||||||
|
default_command = xstrdup(data->value);
|
||||||
} else {
|
} else {
|
||||||
ctx->error(ctx, "unknown option: %s", data->option);
|
ctx->error(ctx, "unknown option: %s", data->option);
|
||||||
return;
|
return;
|
||||||
|
16
tmux.c
16
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.34 2007-10-19 21:58:17 nicm Exp $ */
|
/* $Id: tmux.c,v 1.35 2007-10-20 09:57:08 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -168,6 +169,7 @@ main(int argc, char **argv)
|
|||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
struct hdr hdr;
|
struct hdr hdr;
|
||||||
const char *shell;
|
const char *shell;
|
||||||
|
struct passwd *pw;
|
||||||
char *path, *cause, name[MAXNAMELEN];
|
char *path, *cause, name[MAXNAMELEN];
|
||||||
int n, opt;
|
int n, opt;
|
||||||
|
|
||||||
@ -203,9 +205,15 @@ main(int argc, char **argv)
|
|||||||
bell_action = BELL_ANY;
|
bell_action = BELL_ANY;
|
||||||
|
|
||||||
shell = getenv("SHELL");
|
shell = getenv("SHELL");
|
||||||
if (shell == NULL || *shell == '\0')
|
if (shell == NULL || *shell == '\0') {
|
||||||
shell = "/bin/ksh";
|
pw = getpwuid(getuid());
|
||||||
xasprintf(&default_command, "exec %s -l", shell);
|
if (pw != NULL)
|
||||||
|
shell = pw->pw_shell;
|
||||||
|
endpwent();
|
||||||
|
if (shell == NULL || *shell == '\0')
|
||||||
|
shell = _PATH_BSHELL;
|
||||||
|
}
|
||||||
|
xasprintf(&default_command, "exec %s", shell);
|
||||||
|
|
||||||
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL) {
|
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL) {
|
||||||
if (cause == NULL)
|
if (cause == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user