w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 757fabd36afb6ed05b59df3dd3a51c2c165313fc
parent a8e8c03bd802bc5fbad49973184911e9517869e9
Author: ukai <ukai>
Date:   Wed, 26 Feb 2003 17:22:01 +0000

[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:
MChangeLog | 8++++++++
Metc.c | 8++++++--
Mmain.c | 15++++++++++-----
3 files changed, 24 insertions(+), 7 deletions(-)

diff --git 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 diff --git a/etc.c b/etc.c @@ -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 @@ -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";