summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authornicm <nicm>2015-11-24 23:22:51 +0000
committernicm <nicm>2015-11-24 23:22:51 +0000
commit3ff46b2e43d48376f74c0fd74b5616925d4063f0 (patch)
tree04da858b1a77331248788209f8aa02d36a85d413 /tmux.c
parentdca93c56e05ce631dd2f80da759f40c4d4b20ab5 (diff)
Shell command from -c doesn't have to be global, pass it as an argument.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tmux.c b/tmux.c
index f2143755..7d49dd30 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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));
}