aewl
diff util.c @ 189:523df4a3c1c4
using execl now, argv changed, using cmd and const char defs directly in the KEYS struct
author | arg@10ksloc.org |
---|---|
date | Fri, 04 Aug 2006 12:00:55 +0200 |
parents | 41f8ee33771e |
children | 7b63c375d28c |
line diff
1.1 --- a/util.c Fri Aug 04 10:36:22 2006 +0200 1.2 +++ b/util.c Fri Aug 04 12:00:55 2006 +0200 1.3 @@ -43,17 +43,20 @@ 1.4 void 1.5 spawn(Arg *arg) 1.6 { 1.7 - char **argv = (char **)arg->argv; 1.8 + static char *shell = NULL; 1.9 1.10 - if(!argv || !argv[0]) 1.11 + if(!shell && !(shell = getenv("SHELL"))) 1.12 + shell = "/bin/sh"; 1.13 + 1.14 + if(!arg->cmd) 1.15 return; 1.16 if(fork() == 0) { 1.17 if(fork() == 0) { 1.18 if(dpy) 1.19 close(ConnectionNumber(dpy)); 1.20 setsid(); 1.21 - execvp(argv[0], argv); 1.22 - fprintf(stderr, "dwm: execvp %s", argv[0]); 1.23 + execl(shell, shell, "-c", arg->cmd, NULL); 1.24 + fprintf(stderr, "dwm: execl '%s'", arg->cmd); 1.25 perror(" failed"); 1.26 } 1.27 exit(0);