diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-07-25 15:43:16 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-07-25 15:43:16 +0800 |
commit | e5cd4631f66e182c67bfb45df3f8a04f08761ce2 (patch) | |
tree | 1ee68a67c6ddc8e8bd7551c4627ca889d1f11fe8 /camel/camel-filter-search.c | |
parent | d60d21300924fad507d812edca3de30074b52e02 (diff) | |
download | gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar.gz gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar.bz2 gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar.lz gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar.xz gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.tar.zst gsoc2013-evolution-e5cd4631f66e182c67bfb45df3f8a04f08761ce2.zip |
Renamed from shell_exec(). Also, we now want to pass argc/argv on to the
2002-07-25 Jeffrey Stedfast <fejj@ximian.com>
* camel-filter-driver.c (do_shell): Renamed from
shell_exec(). Also, we now want to pass argc/argv on to the
CamelFilterDriverShellFunc.
(camel_filter_driver_set_shell_func): Renamed a bit.
* camel-filter-search.c (pipe_message): Renamed from shell_exec().
svn path=/trunk/; revision=17583
Diffstat (limited to 'camel/camel-filter-search.c')
-rw-r--r-- | camel/camel-filter-search.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c index 3bcb582fba..2f2fb52724 100644 --- a/camel/camel-filter-search.c +++ b/camel/camel-filter-search.c @@ -92,7 +92,7 @@ static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExp static ESExpResult *get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); -static ESExpResult *shell_exec (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); +static ESExpResult *pipe_message (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); /* builtin functions */ static struct { @@ -120,7 +120,7 @@ static struct { { "get-current-date", (ESExpFunc *) get_current_date, 0 }, { "get-source", (ESExpFunc *) get_source, 0 }, { "get-size", (ESExpFunc *) get_size, 0 }, - { "shell-exec", (ESExpFunc *) shell_exec, 0 }, + { "pipe-message", (ESExpFunc *) pipe_message, 0 }, }; @@ -515,6 +515,7 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa if (!(pid = fork ())) { /* child process */ + GPtrArray *args; int maxfd, i; if (dup2 (in_fds[0], STDIN_FILENO) < 0) @@ -530,10 +531,16 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa } } - execv ("sh", "-c", argv[0]->value.string); + args = g_ptr_array_new (); + for (i = 0; i < argc; i++) + g_ptr_array_add (args, argv[i]->value.string); + g_ptr_array_add (args, NULL); - fprintf (stderr, "Could not execute %s: %s\n", argv[0]->value.string, - g_strerror (errno)); + execvp (argv[0]->value.string, (char **) args->pdata); + + g_ptr_array_free (args, TRUE); + + d(printf ("Could not execute %s: %s\n", argv[0]->value.string, g_strerror (errno))); _exit (255); } else if (pid < 0) { camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM, @@ -572,11 +579,11 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa if (result != -1 && WIFEXITED (status)) return WEXITSTATUS (status); else - return -1; + return -1; } static ESExpResult * -shell_exec (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) +pipe_message (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) { ESExpResult *r; int retval, i; |