aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-02-26 17:22:01 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-02-26 17:22:01 +0000
commitaa5056e39a7d44ee3099d17202ad6e6fcc613e34 (patch)
treec2eb43db4ce3247ba5331474a0c99357a324a28b
parentfix indent (diff)
downloadw3m-aa5056e39a7d44ee3099d17202ad6e6fcc613e34.tar.gz
w3m-aa5056e39a7d44ee3099d17202ad6e6fcc613e34.zip
[w3m-dev 03783] pipe to "command1 | command2"
* etc.c (myExtCommand): redirect to subshell * main.c (pipeBuf): conv_to_system(cmd) shell_quote() set buf->filename, buf->buffername
Diffstat (limited to '')
-rw-r--r--ChangeLog10
-rw-r--r--etc.c10
-rw-r--r--main.c17
3 files changed, 27 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index f1b2e5e..7967d1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-27 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03783] pipe to "command1 | command2"
+ * etc.c (myExtCommand): redirect to subshell
+ * main.c (pipeBuf): conv_to_system(cmd)
+ shell_quote()
+ set buf->filename, buf->buffername
+
2003-02-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03782] real linenumber for EDIT and EDIT_SCREEN
@@ -7263,4 +7271,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.766 2003/02/25 16:05:43 ukai Exp $
+$Id: ChangeLog,v 1.767 2003/02/26 17:22:01 ukai Exp $
diff --git a/etc.c b/etc.c
index 6bc2b0e..5cad793 100644
--- a/etc.c
+++ b/etc.c
@@ -1,4 +1,4 @@
-/* $Id: etc.c,v 1.66 2003/02/18 15:44:33 ukai Exp $ */
+/* $Id: etc.c,v 1.67 2003/02/26 17:22:02 ukai Exp $ */
#include "fm.h"
#include <pwd.h>
#include "myctype.h"
@@ -1495,8 +1495,12 @@ myExtCommand(char *cmd, char *arg, int redirect)
Strcat_char(tmp, *p);
}
}
- if (!set_arg)
- tmp = Strnew_m_charp(cmd, (redirect ? " < " : " "), arg, NULL);
+ if (!set_arg) {
+ if (redirect)
+ tmp = Strnew_m_charp("(", cmd, ") < ", arg, NULL);
+ else
+ tmp = Strnew_m_charp(cmd, " ", arg, NULL);
+ }
return tmp;
}
diff --git a/main.c b/main.c
index 9f00e8f..8f00db4 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.214 2003/02/25 16:06:57 ukai Exp $ */
+/* $Id: main.c,v 1.215 2003/02/26 17:22:03 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -1895,10 +1895,12 @@ pipeBuf(void)
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("Pipe buffer to: ", "", IN_COMMAND, ShellHist);
- if (cmd == NULL || *cmd == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ }
+ if (cmd != NULL)
+ cmd = conv_to_system(cmd);
+ if (cmd == NULL || *cmd == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
}
tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
f = fopen(tmpf, "w");
@@ -1908,12 +1910,15 @@ pipeBuf(void)
}
saveBuffer(Currentbuf, f, TRUE);
fclose(f);
- buf = getpipe(myExtCommand(cmd, tmpf, TRUE)->ptr);
+ buf = getpipe(myExtCommand(cmd, shell_quote(tmpf), TRUE)->ptr);
if (buf == NULL) {
disp_message("Execution failed", TRUE);
return;
}
else {
+ buf->filename = cmd;
+ buf->buffername = Sprintf("%s %s", PIPEBUFFERNAME,
+ conv_from_system(cmd))->ptr;
buf->bufferprop |= (BP_INTERNAL | BP_NO_URL);
if (buf->type == NULL)
buf->type = "text/plain";