Here's a quick fix to pass the opt_cmd to $SHELL -c, which fixes a
bug where you couldn't call -e with a command with spaces (arguments
to that command).

I earlier tried to pass the command directly to execvp() by using
strsep to set args, but the code turned out to be far too complex
(I think).
diff -r c4ef5533a330 st.c
--- a/st.c      Fri Nov 26 22:12:54 2010 +0100
+++ b/st.c      Fri Nov 26 17:44:30 2010 -0500
@@ -545,9 +545,9 @@
 
 void
 execsh(void) {
-       char *args[] = {getenv("SHELL"), "-i", NULL};
+       char *args[] = {getenv("SHELL"), "-i", NULL, NULL};
        if(opt_cmd)
-               args[0] = opt_cmd, args[1] = NULL;
+               args[1] = "-c", args[2] = opt_cmd, args[3] = NULL;
        else
                DEFAULT(args[0], SHELL);
        putenv("TERM="TNAME);

Reply via email to