mirror of
https://github.com/tmux/tmux.git
synced 2024-12-14 02:48:47 +00:00
Accept -l to make it easier for people who use tmux as a login shell to use
$SHELL. Originally from martynas@, tweaked by me.
This commit is contained in:
parent
c5ac2579ba
commit
74c35c513e
@ -68,8 +68,9 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
tim = ctime(&start_time);
|
tim = ctime(&start_time);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
ctx->print(ctx, "pid %ld, started %s", (long) getpid(), tim);
|
ctx->print(ctx, "pid %ld, started %s", (long) getpid(), tim);
|
||||||
ctx->print(ctx, "socket path %s, debug level %d%s",
|
ctx->print(ctx, "socket path %s, debug level %d%s%s",
|
||||||
socket_path, debug_level, be_quiet ? ", quiet" : "");
|
socket_path, debug_level, be_quiet ? ", quiet" : "",
|
||||||
|
login_shell ? ", login shell" : "");
|
||||||
if (uname(&un) == 0) {
|
if (uname(&un) == 0) {
|
||||||
ctx->print(ctx, "system is %s %s %s %s",
|
ctx->print(ctx, "system is %s %s %s %s",
|
||||||
un.sysname, un.release, un.version, un.machine);
|
un.sysname, un.release, un.version, un.machine);
|
||||||
|
6
tmux.1
6
tmux.1
@ -23,7 +23,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm tmux
|
.Nm tmux
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl 28dqUuv
|
.Op Fl 28dlqUuv
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
.Op Fl L Ar socket-name
|
.Op Fl L Ar socket-name
|
||||||
.Op Fl S Ar socket-path
|
.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,
|
If a command in the configuration file fails,
|
||||||
.Nm
|
.Nm
|
||||||
will report an error and exit without executing further commands.
|
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
|
.It Fl L Ar socket-name
|
||||||
.Nm
|
.Nm
|
||||||
stores the server socket in a directory under
|
stores the server socket in a directory under
|
||||||
|
13
tmux.c
13
tmux.c
@ -57,6 +57,7 @@ int debug_level;
|
|||||||
int be_quiet;
|
int be_quiet;
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
char *socket_path;
|
char *socket_path;
|
||||||
|
int login_shell;
|
||||||
|
|
||||||
__dead void usage(void);
|
__dead void usage(void);
|
||||||
char *makesockpath(const char *);
|
char *makesockpath(const char *);
|
||||||
@ -68,8 +69,8 @@ __dead void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s [-28dqUuv] [-f file] [-L socket-name] [-S socket-path]\n"
|
"usage: %s [-28dlqUuv] [-f file] [-L socket-name]\n"
|
||||||
" [command [flags]]\n",
|
" [-S socket-path] [command [flags]]\n",
|
||||||
__progname);
|
__progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -316,8 +317,9 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
unlock = flags = 0;
|
unlock = flags = 0;
|
||||||
label = path = NULL;
|
label = path = NULL;
|
||||||
while ((opt = getopt(argc, argv, "28df:L:qS:uUv")) != -1) {
|
login_shell = (**argv == '-');
|
||||||
switch (opt) {
|
while ((opt = getopt(argc, argv, "28df:lL:qS:uUv")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
case '2':
|
case '2':
|
||||||
flags |= IDENTIFY_256COLOURS;
|
flags |= IDENTIFY_256COLOURS;
|
||||||
flags &= ~IDENTIFY_88COLOURS;
|
flags &= ~IDENTIFY_88COLOURS;
|
||||||
@ -334,6 +336,9 @@ main(int argc, char **argv)
|
|||||||
xfree(cfg_file);
|
xfree(cfg_file);
|
||||||
cfg_file = xstrdup(optarg);
|
cfg_file = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
login_shell = 1;
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
if (label != NULL)
|
if (label != NULL)
|
||||||
xfree(label);
|
xfree(label);
|
||||||
|
1
tmux.h
1
tmux.h
@ -1117,6 +1117,7 @@ extern int debug_level;
|
|||||||
extern int be_quiet;
|
extern int be_quiet;
|
||||||
extern time_t start_time;
|
extern time_t start_time;
|
||||||
extern char *socket_path;
|
extern char *socket_path;
|
||||||
|
extern int login_shell;
|
||||||
void logfile(const char *);
|
void logfile(const char *);
|
||||||
void siginit(void);
|
void siginit(void);
|
||||||
void sigreset(void);
|
void sigreset(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user