diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-02-26 17:22:01 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-02-26 17:22:01 +0000 |
commit | aa5056e39a7d44ee3099d17202ad6e6fcc613e34 (patch) | |
tree | c2eb43db4ce3247ba5331474a0c99357a324a28b /main.c | |
parent | fix indent (diff) | |
download | w3m-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 'main.c')
-rw-r--r-- | main.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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"; |