summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tmux.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-11-24 23:22:51 +0000
committernicm <nicm@openbsd.org>2015-11-24 23:22:51 +0000
commite192934c770b3725aedb72189884aedc323d1eb9 (patch)
tree777ab870d1bde64dffe254ce897b5e69da83839f /usr.bin/tmux/tmux.c
parentDo lock failures slightly better, return a special value so we don't (diff)
downloadwireguard-openbsd-e192934c770b3725aedb72189884aedc323d1eb9.tar.xz
wireguard-openbsd-e192934c770b3725aedb72189884aedc323d1eb9.zip
Shell command from -c doesn't have to be global, pass it as an argument.
Diffstat (limited to 'usr.bin/tmux/tmux.c')
-rw-r--r--usr.bin/tmux/tmux.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 9690f9e86e5..a98ddb88948 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.160 2015/11/24 22:27:22 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.161 2015/11/24 23:22:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -39,7 +39,6 @@ struct options *global_s_options; /* session options */
struct options *global_w_options; /* window options */
struct environ *global_environ;
-char *shell_cmd;
struct timeval start_time;
const char *socket_path;
@@ -184,7 +183,7 @@ find_home(void)
int
main(int argc, char **argv)
{
- char *path, *label, **var, tmp[PATH_MAX];
+ char *path, *label, **var, tmp[PATH_MAX], *shellcmd = NULL;
const char *s;
int opt, flags, keys;
@@ -203,8 +202,8 @@ main(int argc, char **argv)
flags |= CLIENT_256COLOURS;
break;
case 'c':
- free(shell_cmd);
- shell_cmd = xstrdup(optarg);
+ free(shellcmd);
+ shellcmd = xstrdup(optarg);
break;
case 'C':
if (flags & CLIENT_CONTROL)
@@ -241,7 +240,7 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
- if (shell_cmd != NULL && argc != 0)
+ if (shellcmd != NULL && argc != 0)
usage();
if (pledge("stdio rpath wpath cpath flock fattr unix getpw sendfd "
@@ -318,5 +317,5 @@ main(int argc, char **argv)
free(label);
/* Pass control to the client. */
- exit(client_main(event_init(), argc, argv, flags));
+ exit(client_main(event_init(), argc, argv, flags, shellcmd));
}