mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 715:
Support the status_replace # replacement sequences in the pipe-pane command, thanks to Andrea Barisani.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-pipe-pane.c,v 1.11 2010-05-14 14:30:01 tcunha Exp $ */
 | 
					/* $Id: cmd-pipe-pane.c,v 1.12 2010-06-06 00:28:00 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -22,6 +22,7 @@
 | 
				
			|||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
#include <fcntl.h>
 | 
					#include <fcntl.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
@@ -49,9 +50,14 @@ int
 | 
				
			|||||||
cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
					cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cmd_target_data	*data = self->data;
 | 
						struct cmd_target_data	*data = self->data;
 | 
				
			||||||
 | 
						struct client		*c;
 | 
				
			||||||
	struct window_pane	*wp;
 | 
						struct window_pane	*wp;
 | 
				
			||||||
 | 
						char			*command;
 | 
				
			||||||
	int			 old_fd, pipe_fd[2], null_fd, mode;
 | 
						int			 old_fd, pipe_fd[2], null_fd, mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((c = cmd_find_client(ctx, data->target)) == NULL)
 | 
				
			||||||
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
 | 
						if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -105,7 +111,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
				
			|||||||
		if (null_fd != STDOUT_FILENO && null_fd != STDERR_FILENO)
 | 
							if (null_fd != STDOUT_FILENO && null_fd != STDERR_FILENO)
 | 
				
			||||||
			close(null_fd);
 | 
								close(null_fd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		execl(_PATH_BSHELL, "sh", "-c", data->arg, (char *) NULL);
 | 
							command = status_replace(c, NULL, data->arg, time(NULL), 0);
 | 
				
			||||||
 | 
							execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL);
 | 
				
			||||||
		_exit(1);
 | 
							_exit(1);
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		/* Parent process. */
 | 
							/* Parent process. */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
.\" $Id: tmux.1,v 1.255 2010-06-06 00:23:44 tcunha Exp $
 | 
					.\" $Id: tmux.1,v 1.256 2010-06-06 00:28:00 tcunha Exp $
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
@@ -14,7 +14,7 @@
 | 
				
			|||||||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
					.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
				
			||||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
					.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.Dd $Mdocdate: May 31 2010 $
 | 
					.Dd $Mdocdate: June 5 2010 $
 | 
				
			||||||
.Dt TMUX 1
 | 
					.Dt TMUX 1
 | 
				
			||||||
.Os
 | 
					.Os
 | 
				
			||||||
.Sh NAME
 | 
					.Sh NAME
 | 
				
			||||||
@@ -1124,6 +1124,11 @@ A pane may only be piped to one command at a time, any existing pipe is
 | 
				
			|||||||
closed before
 | 
					closed before
 | 
				
			||||||
.Ar shell-command
 | 
					.Ar shell-command
 | 
				
			||||||
is executed.
 | 
					is executed.
 | 
				
			||||||
 | 
					The
 | 
				
			||||||
 | 
					.Ar shell-command
 | 
				
			||||||
 | 
					string may contain the special character sequences supported by the
 | 
				
			||||||
 | 
					.Ic status-left
 | 
				
			||||||
 | 
					command.
 | 
				
			||||||
If no
 | 
					If no
 | 
				
			||||||
.Ar shell-command
 | 
					.Ar shell-command
 | 
				
			||||||
is given, the current pipe (if any) is closed.
 | 
					is given, the current pipe (if any) is closed.
 | 
				
			||||||
@@ -1133,7 +1138,7 @@ The
 | 
				
			|||||||
option only opens a new pipe if no previous pipe exists, allowing a pipe to
 | 
					option only opens a new pipe if no previous pipe exists, allowing a pipe to
 | 
				
			||||||
be toggled with a single key, for example:
 | 
					be toggled with a single key, for example:
 | 
				
			||||||
.Bd -literal -offset indent
 | 
					.Bd -literal -offset indent
 | 
				
			||||||
bind-key C-p pipe-pane -o 'cat >>~/output'
 | 
					bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
 | 
				
			||||||
.Ed
 | 
					.Ed
 | 
				
			||||||
.It Xo Ic previous-window
 | 
					.It Xo Ic previous-window
 | 
				
			||||||
.Op Fl a
 | 
					.Op Fl a
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user