aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_button_exec.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugin_button_exec.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/plugin_button_exec.c b/plugin_button_exec.c
index 2568d54..f56da24 100644
--- a/plugin_button_exec.c
+++ b/plugin_button_exec.c
@@ -58,40 +58,38 @@
static void my_button_exec(RESULT * result, int argc, RESULT * argv[])
{
- int pid;
- int i;
- int errsv;
- char *args[argc+1];
- char *arg;
- char *prog;
- char *env[1];
-
- signal(SIGCHLD, SIG_IGN);
- prog=R2S(argv[0]);
- info(prog);
- for (i=1; i < argc; i++) {
- arg=R2S(argv[i]);
- args[i]=arg;
- info(arg);
- }
- args[i]=(char *) 0;
- env[0]=(char *) 0;
- pid=fork();
- if (pid==0) { // child-process
- // char *args[] = {"-r", "-t", "-l", (char *) 0 };
- info("executing program");
- execve(prog, args, env);
- errsv=errno;
- info("executing program failed");
- info(strerror(errsv));
- exit(0);
- }
- else if (pid==-1) {
- info("weird error has occured. couldn't fork.");
- }
- else {
- SetResult(&result, R_STRING, "0");
- }
+ int pid;
+ int i;
+ int errsv;
+ char *args[argc + 1];
+ char *arg;
+ char *prog;
+ char *env[1];
+
+ signal(SIGCHLD, SIG_IGN);
+ prog = R2S(argv[0]);
+ info(prog);
+ for (i = 1; i < argc; i++) {
+ arg = R2S(argv[i]);
+ args[i] = arg;
+ info(arg);
+ }
+ args[i] = (char *) 0;
+ env[0] = (char *) 0;
+ pid = fork();
+ if (pid == 0) { // child-process
+ // char *args[] = {"-r", "-t", "-l", (char *) 0 };
+ info("executing program");
+ execve(prog, args, env);
+ errsv = errno;
+ info("executing program failed");
+ info(strerror(errsv));
+ exit(0);
+ } else if (pid == -1) {
+ info("weird error has occured. couldn't fork.");
+ } else {
+ SetResult(&result, R_STRING, "0");
+ }
}