mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		| @@ -59,6 +59,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
| 	struct args			*args = self->args; | 	struct args			*args = self->args; | ||||||
| 	struct cmd_if_shell_data	*cdata; | 	struct cmd_if_shell_data	*cdata; | ||||||
| 	char				*shellcmd; | 	char				*shellcmd; | ||||||
|  | 	struct client			*c; | ||||||
| 	struct session			*s = NULL; | 	struct session			*s = NULL; | ||||||
| 	struct winlink			*wl = NULL; | 	struct winlink			*wl = NULL; | ||||||
| 	struct window_pane		*wp = NULL; | 	struct window_pane		*wp = NULL; | ||||||
| @@ -66,6 +67,14 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
|  |  | ||||||
| 	if (args_has(args, 't')) | 	if (args_has(args, 't')) | ||||||
| 		wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); | 		wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); | ||||||
|  | 	else { | ||||||
|  | 		c = cmd_find_client(cmdq, NULL, 1); | ||||||
|  | 		if (c != NULL && c->session != NULL) { | ||||||
|  | 			s = c->session; | ||||||
|  | 			wl = s->curw; | ||||||
|  | 			wp = wl->window->active; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	ft = format_create(); | 	ft = format_create(); | ||||||
| 	if (s != NULL) | 	if (s != NULL) | ||||||
|   | |||||||
| @@ -77,6 +77,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
| 	struct args			*args = self->args; | 	struct args			*args = self->args; | ||||||
| 	struct cmd_run_shell_data	*cdata; | 	struct cmd_run_shell_data	*cdata; | ||||||
| 	char				*shellcmd; | 	char				*shellcmd; | ||||||
|  | 	struct client			*c; | ||||||
| 	struct session			*s = NULL; | 	struct session			*s = NULL; | ||||||
| 	struct winlink			*wl = NULL; | 	struct winlink			*wl = NULL; | ||||||
| 	struct window_pane		*wp = NULL; | 	struct window_pane		*wp = NULL; | ||||||
| @@ -84,6 +85,14 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
|  |  | ||||||
| 	if (args_has(args, 't')) | 	if (args_has(args, 't')) | ||||||
| 		wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); | 		wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); | ||||||
|  | 	else { | ||||||
|  | 		c = cmd_find_client(cmdq, NULL, 1); | ||||||
|  | 		if (c != NULL && c->session != NULL) { | ||||||
|  | 			s = c->session; | ||||||
|  | 			wl = s->curw; | ||||||
|  | 			wp = wl->window->active; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	ft = format_create(); | 	ft = format_create(); | ||||||
| 	if (s != NULL) | 	if (s != NULL) | ||||||
|   | |||||||
| @@ -58,8 +58,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
| 	struct window		*w; | 	struct window		*w; | ||||||
| 	struct window_pane	*wp, *new_wp = NULL; | 	struct window_pane	*wp, *new_wp = NULL; | ||||||
| 	struct environ		 env; | 	struct environ		 env; | ||||||
| 	const char		*cmd, *cwd, *shell, *prefix; | 	const char		*cmd, *cwd, *shell; | ||||||
| 	char			*cause, *new_cause, *cmd1; | 	char			*cause, *new_cause; | ||||||
| 	u_int			 hlimit; | 	u_int			 hlimit; | ||||||
| 	int			 size, percentage; | 	int			 size, percentage; | ||||||
| 	enum layout_type	 type; | 	enum layout_type	 type; | ||||||
| @@ -122,18 +122,9 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) | |||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
| 	new_wp = window_add_pane(w, hlimit); | 	new_wp = window_add_pane(w, hlimit); | ||||||
|  | 	if (window_pane_spawn( | ||||||
| 	if (*cmd != '\0') { | 	    new_wp, cmd, shell, cwd, &env, s->tio, &cause) != 0) | ||||||
| 		prefix = options_get_string(&w->options, "command-prefix"); |  | ||||||
| 		xasprintf(&cmd1, "%s%s", prefix, cmd); |  | ||||||
| 	} else |  | ||||||
| 		cmd1 = xstrdup(""); |  | ||||||
| 	if (window_pane_spawn(new_wp, cmd1, shell, cwd, &env, s->tio, |  | ||||||
| 	    &cause) != 0) { |  | ||||||
| 		free(cmd1); |  | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} |  | ||||||
| 	free(cmd1); |  | ||||||
| 	layout_assign_pane(lc, new_wp); | 	layout_assign_pane(lc, new_wp); | ||||||
|  |  | ||||||
| 	server_redraw_window(w); | 	server_redraw_window(w); | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								names.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								names.c
									
									
									
									
									
								
							| @@ -26,8 +26,8 @@ | |||||||
|  |  | ||||||
| #include "tmux.h" | #include "tmux.h" | ||||||
|  |  | ||||||
| void	 window_name_callback(int, short, void *); | void	 window_name_callback(unused int, unused short, void *); | ||||||
| char	*parse_window_name(struct window *, const char *); | char	*parse_window_name(const char *); | ||||||
|  |  | ||||||
| void | void | ||||||
| queue_window_name(struct window *w) | queue_window_name(struct window *w) | ||||||
| @@ -73,9 +73,9 @@ window_name_callback(unused int fd, unused short events, void *data) | |||||||
| 		 */ | 		 */ | ||||||
| 		if (w->active->cmd != NULL && *w->active->cmd == '\0' && | 		if (w->active->cmd != NULL && *w->active->cmd == '\0' && | ||||||
| 		    name != NULL && name[0] == '-' && name[1] != '\0') | 		    name != NULL && name[0] == '-' && name[1] != '\0') | ||||||
| 			wname = parse_window_name(w, name + 1); | 			wname = parse_window_name(name + 1); | ||||||
| 		else | 		else | ||||||
| 			wname = parse_window_name(w, name); | 			wname = parse_window_name(name); | ||||||
| 		free(name); | 		free(name); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -98,22 +98,18 @@ default_window_name(struct window *w) | |||||||
| 	if (w->active->screen != &w->active->base) | 	if (w->active->screen != &w->active->base) | ||||||
| 		return (xstrdup("[tmux]")); | 		return (xstrdup("[tmux]")); | ||||||
| 	if (w->active->cmd != NULL && *w->active->cmd != '\0') | 	if (w->active->cmd != NULL && *w->active->cmd != '\0') | ||||||
| 		return (parse_window_name(w, w->active->cmd)); | 		return (parse_window_name(w->active->cmd)); | ||||||
| 	return (parse_window_name(w, w->active->shell)); | 	return (parse_window_name(w->active->shell)); | ||||||
| } | } | ||||||
|  |  | ||||||
| char * | char * | ||||||
| parse_window_name(struct window *w, const char *in) | parse_window_name(const char *in) | ||||||
| { | { | ||||||
| 	char	*copy, *name, *ptr, *prefix; | 	char	*copy, *name, *ptr; | ||||||
| 	size_t	 prefixlen; |  | ||||||
|  |  | ||||||
| 	prefix = options_get_string(&w->options, "command-prefix"); |  | ||||||
| 	prefixlen = strlen(prefix); |  | ||||||
|  |  | ||||||
| 	name = copy = xstrdup(in); | 	name = copy = xstrdup(in); | ||||||
| 	if (strncmp(name, prefix, prefixlen) == 0) | 	if (strncmp(name, "exec ", (sizeof "exec ") - 1) == 0) | ||||||
| 		name = name + prefixlen; | 		name = name + (sizeof "exec ") - 1; | ||||||
|  |  | ||||||
| 	while (*name == ' ') | 	while (*name == ' ') | ||||||
| 		name++; | 		name++; | ||||||
|   | |||||||
| @@ -501,11 +501,6 @@ const struct options_table_entry window_options_table[] = { | |||||||
| 	  .default_num = 1 | 	  .default_num = 1 | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	{ .name = "command-prefix", |  | ||||||
| 	  .type = OPTIONS_TABLE_STRING, |  | ||||||
| 	  .default_str = "exec " |  | ||||||
| 	}, |  | ||||||
|  |  | ||||||
| 	{ .name = "force-height", | 	{ .name = "force-height", | ||||||
| 	  .type = OPTIONS_TABLE_NUMBER, | 	  .type = OPTIONS_TABLE_NUMBER, | ||||||
| 	  .minimum = 0, | 	  .minimum = 0, | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							| @@ -2754,13 +2754,6 @@ Set clock colour. | |||||||
| .Xc | .Xc | ||||||
| Set clock hour format. | Set clock hour format. | ||||||
| .Pp | .Pp | ||||||
| .It Ic command-prefix Ar string |  | ||||||
| String prefixed to commands (apart from a plain shell as set by the |  | ||||||
| .Ic default-shell |  | ||||||
| option). |  | ||||||
| The default is |  | ||||||
| .Ql "exec\ " . |  | ||||||
| .Pp |  | ||||||
| .It Ic force-height Ar height | .It Ic force-height Ar height | ||||||
| .It Ic force-width Ar width | .It Ic force-width Ar width | ||||||
| Prevent | Prevent | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								window.c
									
									
									
									
									
								
							| @@ -311,24 +311,15 @@ window_create(const char *name, const char *cmd, const char *shell, | |||||||
| { | { | ||||||
| 	struct window		*w; | 	struct window		*w; | ||||||
| 	struct window_pane	*wp; | 	struct window_pane	*wp; | ||||||
| 	const char		*prefix; |  | ||||||
| 	char			*cmd1; |  | ||||||
|  |  | ||||||
| 	w = window_create1(sx, sy); | 	w = window_create1(sx, sy); | ||||||
| 	wp = window_add_pane(w, hlimit); | 	wp = window_add_pane(w, hlimit); | ||||||
| 	layout_init(w, wp); | 	layout_init(w, wp); | ||||||
|  |  | ||||||
| 	if (*cmd != '\0') { | 	if (window_pane_spawn(wp, cmd, shell, cwd, env, tio, cause) != 0) { | ||||||
| 		prefix = options_get_string(&w->options, "command-prefix"); |  | ||||||
| 		xasprintf(&cmd1, "%s%s", prefix, cmd); |  | ||||||
| 	} else |  | ||||||
| 		cmd1 = xstrdup(""); |  | ||||||
| 	if (window_pane_spawn(wp, cmd1, shell, cwd, env, tio, cause) != 0) { |  | ||||||
| 		window_destroy(w); | 		window_destroy(w); | ||||||
| 		free(cmd1); |  | ||||||
| 		return (NULL); | 		return (NULL); | ||||||
| 	} | 	} | ||||||
| 	free(cmd1); |  | ||||||
|  |  | ||||||
| 	w->active = TAILQ_FIRST(&w->panes); | 	w->active = TAILQ_FIRST(&w->panes); | ||||||
| 	if (name != NULL) { | 	if (name != NULL) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Thomas
					Thomas