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 | |
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
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | etc.c | 10 | ||||
-rw-r--r-- | main.c | 17 |
3 files changed, 27 insertions, 10 deletions
@@ -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 $ @@ -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; } @@ -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"; |