aboutsummaryrefslogtreecommitdiff
path: root/cmd-pipe-pane.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-06-06 00:28:00 +0000
committerTiago Cunha <tcunha@gmx.com>2010-06-06 00:28:00 +0000
commit3bba40160931bdad2ad8cd5168a42239477cbe99 (patch)
treeb7a4f95ddb063b40604c06d9f1d5d896b3697ae8 /cmd-pipe-pane.c
parent31657820bc7613a933517b7ac97dee7958c979d5 (diff)
downloadrtmux-3bba40160931bdad2ad8cd5168a42239477cbe99.tar.gz
rtmux-3bba40160931bdad2ad8cd5168a42239477cbe99.tar.bz2
rtmux-3bba40160931bdad2ad8cd5168a42239477cbe99.zip
Sync OpenBSD patchset 715:
Support the status_replace # replacement sequences in the pipe-pane command, thanks to Andrea Barisani.
Diffstat (limited to 'cmd-pipe-pane.c')
-rw-r--r--cmd-pipe-pane.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 28c8e637..62d4f4f7 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -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>
@@ -22,6 +22,7 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#include "tmux.h"
@@ -49,9 +50,14 @@ int
cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
+ struct client *c;
struct window_pane *wp;
+ char *command;
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)
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)
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);
default:
/* Parent process. */