Make shell_command a global like other stuff rather than making it an

exception and using callback argument.
This commit is contained in:
nicm
2017-07-12 09:21:25 +00:00
parent d0d42dc4cb
commit ed3cfaafb2
3 changed files with 16 additions and 17 deletions

12
tmux.c
View File

@ -44,6 +44,7 @@ struct hooks *global_hooks;
struct timeval start_time;
const char *socket_path;
int ptm_fd = -1;
const char *shell_command;
static __dead void usage(void);
static char *make_label(const char *);
@ -190,8 +191,8 @@ find_home(void)
int
main(int argc, char **argv)
{
char *path, *label, tmp[PATH_MAX];
char *shellcmd = NULL, **var;
char *path, *label, **var;
char tmp[PATH_MAX];
const char *s, *shell;
int opt, flags, keys;
const struct options_table_entry *oe;
@ -220,8 +221,7 @@ main(int argc, char **argv)
flags |= CLIENT_256COLOURS;
break;
case 'c':
free(shellcmd);
shellcmd = xstrdup(optarg);
shell_command = optarg;
break;
case 'C':
if (flags & CLIENT_CONTROL)
@ -258,7 +258,7 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
if (shellcmd != NULL && argc != 0)
if (shell_command != NULL && argc != 0)
usage();
if ((ptm_fd = getptmfd()) == -1)
@ -348,5 +348,5 @@ main(int argc, char **argv)
free(label);
/* Pass control to the client. */
exit(client_main(event_init(), argc, argv, flags, shellcmd));
exit(client_main(event_init(), argc, argv, flags));
}