diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-02 17:34:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-02 17:34:58 +0000 |
commit | 64dce1b62dbae5d0b90eb2fd54e23a0eeacbdf4d (patch) | |
tree | 6aa6822adcf38d0ac61e2fc0fed6eb6b515ce583 | |
parent | 2306892e8c735d33a8ee0268bfc4acd1ab4a3e46 (diff) |
Accept -l to make it easier for people who use tmux as a login shell to use
$SHELL. Originally from martynas@, tweaked by me.
-rw-r--r-- | usr.bin/tmux/cmd-server-info.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 15 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
4 files changed, 22 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-server-info.c b/usr.bin/tmux/cmd-server-info.c index da3b9ad516f..7f4c147c3ec 100644 --- a/usr.bin/tmux/cmd-server-info.c +++ b/usr.bin/tmux/cmd-server-info.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-server-info.c,v 1.8 2009/08/18 14:48:42 nicm Exp $ */ +/* $OpenBSD: cmd-server-info.c,v 1.9 2009/09/02 17:34:57 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -68,8 +68,9 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx) tim = ctime(&start_time); *strchr(tim, '\n') = '\0'; ctx->print(ctx, "pid %ld, started %s", (long) getpid(), tim); - ctx->print(ctx, "socket path %s, debug level %d%s", - socket_path, debug_level, be_quiet ? ", quiet" : ""); + ctx->print(ctx, "socket path %s, debug level %d%s%s", + socket_path, debug_level, be_quiet ? ", quiet" : "", + login_shell ? ", login shell" : ""); if (uname(&un) == 0) { ctx->print(ctx, "system is %s %s %s %s", un.sysname, un.release, un.version, un.machine); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index d384059361e..f6e91c60bf0 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.81 2009/09/02 16:38:35 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.82 2009/09/02 17:34:57 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -23,7 +23,7 @@ .Sh SYNOPSIS .Nm tmux .Bk -words -.Op Fl 28dqUuv +.Op Fl 28dlqUuv .Op Fl f Ar file .Op Fl L Ar socket-name .Op Fl S Ar socket-path @@ -120,6 +120,10 @@ commands which are executed in sequence when the server is first started. If a command in the configuration file fails, .Nm will report an error and exit without executing further commands. +.It Fl l +Behave as a login shell. +This flag currently has no effect and is for compatibility with other shells +when using tmux as a login shell. .It Fl L Ar socket-name .Nm stores the server socket in a directory under diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index c186452d393..a61d397e30c 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.40 2009/09/02 16:38:35 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.41 2009/09/02 17:34:57 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -57,6 +57,7 @@ int debug_level; int be_quiet; time_t start_time; char *socket_path; +int login_shell; __dead void usage(void); char *makesockpath(const char *); @@ -68,8 +69,8 @@ __dead void usage(void) { fprintf(stderr, - "usage: %s [-28dqUuv] [-f file] [-L socket-name] [-S socket-path]\n" - " [command [flags]]\n", + "usage: %s [-28dlqUuv] [-f file] [-L socket-name]\n" + " [-S socket-path] [command [flags]]\n", __progname); exit(1); } @@ -316,8 +317,9 @@ main(int argc, char **argv) unlock = flags = 0; label = path = NULL; - while ((opt = getopt(argc, argv, "28df:L:qS:uUv")) != -1) { - switch (opt) { + login_shell = (**argv == '-'); + while ((opt = getopt(argc, argv, "28df:lL:qS:uUv")) != -1) { + switch (opt) { case '2': flags |= IDENTIFY_256COLOURS; flags &= ~IDENTIFY_88COLOURS; @@ -334,6 +336,9 @@ main(int argc, char **argv) xfree(cfg_file); cfg_file = xstrdup(optarg); break; + case 'l': + login_shell = 1; + break; case 'L': if (label != NULL) xfree(label); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 84b13da760b..9299ca67776 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.95 2009/09/02 16:38:35 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.96 2009/09/02 17:34:57 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1117,6 +1117,7 @@ extern int debug_level; extern int be_quiet; extern time_t start_time; extern char *socket_path; +extern int login_shell; void logfile(const char *); void siginit(void); void sigreset(void); |