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:
		
							
								
								
									
										27
									
								
								hooks.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								hooks.c
									
									
									
									
									
								
							@@ -139,33 +139,6 @@ hooks_find(struct hooks *hooks, const char *name)
 | 
				
			|||||||
	return (hook);
 | 
						return (hook);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
hooks_run(struct hooks *hooks, struct client *c, struct cmd_find_state *fs,
 | 
					 | 
				
			||||||
    const char *fmt, ...)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	struct hook		*hook;
 | 
					 | 
				
			||||||
	va_list			 ap;
 | 
					 | 
				
			||||||
	char			*name;
 | 
					 | 
				
			||||||
	struct cmdq_item	*new_item;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	va_start(ap, fmt);
 | 
					 | 
				
			||||||
	xvasprintf(&name, fmt, ap);
 | 
					 | 
				
			||||||
	va_end(ap);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	hook = hooks_find(hooks, name);
 | 
					 | 
				
			||||||
	if (hook == NULL) {
 | 
					 | 
				
			||||||
		free(name);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	log_debug("running hook %s", name);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	new_item = cmdq_get_command(hook->cmdlist, fs, NULL, CMDQ_NOHOOKS);
 | 
					 | 
				
			||||||
	cmdq_format(new_item, "hook", "%s", name);
 | 
					 | 
				
			||||||
	cmdq_append(c, new_item);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	free(name);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
hooks_insert(struct hooks *hooks, struct cmdq_item *item,
 | 
					hooks_insert(struct hooks *hooks, struct cmdq_item *item,
 | 
				
			||||||
    struct cmd_find_state *fs, const char *fmt, ...)
 | 
					    struct cmd_find_state *fs, const char *fmt, ...)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1585,8 +1585,6 @@ void		 hooks_add(struct hooks *, const char *, struct cmd_list *);
 | 
				
			|||||||
void		 hooks_copy(struct hooks *, struct hooks *);
 | 
					void		 hooks_copy(struct hooks *, struct hooks *);
 | 
				
			||||||
void		 hooks_remove(struct hooks *, const char *);
 | 
					void		 hooks_remove(struct hooks *, const char *);
 | 
				
			||||||
struct hook	*hooks_find(struct hooks *, const char *);
 | 
					struct hook	*hooks_find(struct hooks *, const char *);
 | 
				
			||||||
void printflike(4, 5) hooks_run(struct hooks *, struct client *,
 | 
					 | 
				
			||||||
		    struct cmd_find_state *, const char *, ...);
 | 
					 | 
				
			||||||
void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *,
 | 
					void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *,
 | 
				
			||||||
		    struct cmd_find_state *, const char *, ...);
 | 
							    struct cmd_find_state *, const char *, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user