mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										18
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								client.c
									
									
									
									
									
								
							@@ -59,7 +59,8 @@ static struct client_files client_files = RB_INITIALIZER(&client_files);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static __dead void	 client_exec(const char *,const char *);
 | 
					static __dead void	 client_exec(const char *,const char *);
 | 
				
			||||||
static int		 client_get_lock(char *);
 | 
					static int		 client_get_lock(char *);
 | 
				
			||||||
static int		 client_connect(struct event_base *, const char *, int);
 | 
					static int		 client_connect(struct event_base *, const char *,
 | 
				
			||||||
 | 
								     uint64_t);
 | 
				
			||||||
static void		 client_send_identify(const char *, const char *, int);
 | 
					static void		 client_send_identify(const char *, const char *, int);
 | 
				
			||||||
static void		 client_signal(int);
 | 
					static void		 client_signal(int);
 | 
				
			||||||
static void		 client_dispatch(struct imsg *, void *);
 | 
					static void		 client_dispatch(struct imsg *, void *);
 | 
				
			||||||
@@ -100,7 +101,7 @@ client_get_lock(char *lockfile)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Connect client to server. */
 | 
					/* Connect client to server. */
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
client_connect(struct event_base *base, const char *path, int flags)
 | 
					client_connect(struct event_base *base, const char *path, uint64_t flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct sockaddr_un	sa;
 | 
						struct sockaddr_un	sa;
 | 
				
			||||||
	size_t			size;
 | 
						size_t			size;
 | 
				
			||||||
@@ -238,7 +239,8 @@ client_exit(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Client main loop. */
 | 
					/* Client main loop. */
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
client_main(struct event_base *base, int argc, char **argv, int flags, int feat)
 | 
					client_main(struct event_base *base, int argc, char **argv, uint64_t flags,
 | 
				
			||||||
 | 
					    int feat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cmd_parse_result	*pr;
 | 
						struct cmd_parse_result	*pr;
 | 
				
			||||||
	struct msg_command	*data;
 | 
						struct msg_command	*data;
 | 
				
			||||||
@@ -284,7 +286,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* Save the flags. */
 | 
						/* Save the flags. */
 | 
				
			||||||
	client_flags = flags;
 | 
						client_flags = flags;
 | 
				
			||||||
	log_debug("flags are %#llx", client_flags);
 | 
						log_debug("flags are %#llx", (unsigned long long)client_flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Initialize the client socket and start the server. */
 | 
						/* Initialize the client socket and start the server. */
 | 
				
			||||||
	fd = client_connect(base, socket_path, client_flags);
 | 
						fd = client_connect(base, socket_path, client_flags);
 | 
				
			||||||
@@ -442,6 +444,8 @@ client_send_identify(const char *ttynam, const char *cwd, int feat)
 | 
				
			|||||||
	pid_t		  pid;
 | 
						pid_t		  pid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	proc_send(client_peer, MSG_IDENTIFY_FLAGS, -1, &flags, sizeof flags);
 | 
						proc_send(client_peer, MSG_IDENTIFY_FLAGS, -1, &flags, sizeof flags);
 | 
				
			||||||
 | 
						proc_send(client_peer, MSG_IDENTIFY_LONGFLAGS, -1, &client_flags,
 | 
				
			||||||
 | 
						    sizeof client_flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((s = getenv("TERM")) == NULL)
 | 
						if ((s = getenv("TERM")) == NULL)
 | 
				
			||||||
		s = "";
 | 
							s = "";
 | 
				
			||||||
@@ -891,7 +895,8 @@ client_dispatch_wait(struct imsg *imsg)
 | 
				
			|||||||
			fatalx("bad MSG_FLAGS string");
 | 
								fatalx("bad MSG_FLAGS string");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		memcpy(&client_flags, data, sizeof client_flags);
 | 
							memcpy(&client_flags, data, sizeof client_flags);
 | 
				
			||||||
		log_debug("new flags are %#llx", client_flags);
 | 
							log_debug("new flags are %#llx",
 | 
				
			||||||
 | 
							    (unsigned long long)client_flags);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case MSG_SHELL:
 | 
						case MSG_SHELL:
 | 
				
			||||||
		if (datalen == 0 || data[datalen - 1] != '\0')
 | 
							if (datalen == 0 || data[datalen - 1] != '\0')
 | 
				
			||||||
@@ -944,7 +949,8 @@ client_dispatch_attached(struct imsg *imsg)
 | 
				
			|||||||
			fatalx("bad MSG_FLAGS string");
 | 
								fatalx("bad MSG_FLAGS string");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		memcpy(&client_flags, data, sizeof client_flags);
 | 
							memcpy(&client_flags, data, sizeof client_flags);
 | 
				
			||||||
		log_debug("new flags are %#llx", client_flags);
 | 
							log_debug("new flags are %#llx",
 | 
				
			||||||
 | 
							    (unsigned long long)client_flags);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case MSG_DETACH:
 | 
						case MSG_DETACH:
 | 
				
			||||||
	case MSG_DETACHKILL:
 | 
						case MSG_DETACHKILL:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1983,6 +1983,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
 | 
				
			|||||||
	switch (imsg->hdr.type) {
 | 
						switch (imsg->hdr.type) {
 | 
				
			||||||
	case MSG_IDENTIFY_FEATURES:
 | 
						case MSG_IDENTIFY_FEATURES:
 | 
				
			||||||
	case MSG_IDENTIFY_FLAGS:
 | 
						case MSG_IDENTIFY_FLAGS:
 | 
				
			||||||
 | 
						case MSG_IDENTIFY_LONGFLAGS:
 | 
				
			||||||
	case MSG_IDENTIFY_TERM:
 | 
						case MSG_IDENTIFY_TERM:
 | 
				
			||||||
	case MSG_IDENTIFY_TTYNAME:
 | 
						case MSG_IDENTIFY_TTYNAME:
 | 
				
			||||||
	case MSG_IDENTIFY_CWD:
 | 
						case MSG_IDENTIFY_CWD:
 | 
				
			||||||
@@ -2141,6 +2142,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
 | 
				
			|||||||
	const char	*data, *home;
 | 
						const char	*data, *home;
 | 
				
			||||||
	size_t		 datalen;
 | 
						size_t		 datalen;
 | 
				
			||||||
	int		 flags, feat;
 | 
						int		 flags, feat;
 | 
				
			||||||
 | 
						uint64_t	 longflags;
 | 
				
			||||||
	char		*name;
 | 
						char		*name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (c->flags & CLIENT_IDENTIFIED)
 | 
						if (c->flags & CLIENT_IDENTIFIED)
 | 
				
			||||||
@@ -2165,6 +2167,14 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
 | 
				
			|||||||
		c->flags |= flags;
 | 
							c->flags |= flags;
 | 
				
			||||||
		log_debug("client %p IDENTIFY_FLAGS %#x", c, flags);
 | 
							log_debug("client %p IDENTIFY_FLAGS %#x", c, flags);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
						case MSG_IDENTIFY_LONGFLAGS:
 | 
				
			||||||
 | 
							if (datalen != sizeof longflags)
 | 
				
			||||||
 | 
								fatalx("bad MSG_IDENTIFY_LONGFLAGS size");
 | 
				
			||||||
 | 
							memcpy(&longflags, data, sizeof longflags);
 | 
				
			||||||
 | 
							c->flags |= longflags;
 | 
				
			||||||
 | 
							log_debug("client %p IDENTIFY_LONGFLAGS %#llx", c,
 | 
				
			||||||
 | 
							    (unsigned long long)longflags);
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	case MSG_IDENTIFY_TERM:
 | 
						case MSG_IDENTIFY_TERM:
 | 
				
			||||||
		if (datalen == 0 || data[datalen - 1] != '\0')
 | 
							if (datalen == 0 || data[datalen - 1] != '\0')
 | 
				
			||||||
			fatalx("bad MSG_IDENTIFY_TERM string");
 | 
								fatalx("bad MSG_IDENTIFY_TERM string");
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.c
									
									
									
									
									
								
							@@ -322,8 +322,8 @@ main(int argc, char **argv)
 | 
				
			|||||||
	char					*path = NULL, *label = NULL;
 | 
						char					*path = NULL, *label = NULL;
 | 
				
			||||||
	char					*cause, **var;
 | 
						char					*cause, **var;
 | 
				
			||||||
	const char				*s, *shell, *cwd;
 | 
						const char				*s, *shell, *cwd;
 | 
				
			||||||
	int					 opt, flags = 0, keys;
 | 
						int					 opt, keys, feat = 0;
 | 
				
			||||||
	int					 feat = 0;
 | 
						uint64_t				 flags = 0;
 | 
				
			||||||
	const struct options_table_entry	*oe;
 | 
						const struct options_table_entry	*oe;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL &&
 | 
						if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL &&
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -498,6 +498,7 @@ enum msgtype {
 | 
				
			|||||||
	MSG_IDENTIFY_CWD,
 | 
						MSG_IDENTIFY_CWD,
 | 
				
			||||||
	MSG_IDENTIFY_FEATURES,
 | 
						MSG_IDENTIFY_FEATURES,
 | 
				
			||||||
	MSG_IDENTIFY_STDOUT,
 | 
						MSG_IDENTIFY_STDOUT,
 | 
				
			||||||
 | 
						MSG_IDENTIFY_LONGFLAGS,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MSG_COMMAND = 200,
 | 
						MSG_COMMAND = 200,
 | 
				
			||||||
	MSG_DETACH,
 | 
						MSG_DETACH,
 | 
				
			||||||
@@ -2333,7 +2334,7 @@ void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
 | 
				
			|||||||
void	cmd_wait_for_flush(void);
 | 
					void	cmd_wait_for_flush(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* client.c */
 | 
					/* client.c */
 | 
				
			||||||
int	client_main(struct event_base *, int, char **, int, int);
 | 
					int	client_main(struct event_base *, int, char **, uint64_t, int);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* key-bindings.c */
 | 
					/* key-bindings.c */
 | 
				
			||||||
struct key_table *key_bindings_get_table(const char *, int);
 | 
					struct key_table *key_bindings_get_table(const char *, int);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user