filter via shell pipeline
authorGrant Mathews <grant.m.mathews@gmail.com>
Thu, 10 Dec 2015 04:56:07 +0000 (20:56 -0800)
committerMarkus Teich <markus.teich@stusta.mhn.de>
Thu, 24 Dec 2015 00:51:29 +0000 (01:51 +0100)
Instead of requiring an executable, allow building arbitrary shell
pipelines to filter filetypes through.

sent.c

diff --git a/sent.c b/sent.c
index fc5e38903423a1d8caa2d1fd059c5df71dd79460..99361e843cf5ce7ef7240497ebc9a92edfc062f5 100644 (file)
--- a/sent.c
+++ b/sent.c
@@ -152,8 +152,8 @@ filter(int fd, const char *cmd)
                dup2(fds[1], 1);
                close(fds[0]);
                close(fds[1]);
-               execlp(cmd, cmd, (char *)0);
-               eprintf("execlp %s:", cmd);
+               execlp("sh", "sh", "-c", cmd, (char *)0);
+               eprintf("execlp sh -c '%s':", cmd);
        }
        close(fds[1]);
        return fds[0];