aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-11-28 13:17:20 +0100
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-11-28 13:17:20 +0100
commit732b9601ed2543b1fa6acbc08ddc05818279265f (patch)
tree26efc54b9d73954244e2e2fc06890b3beb13af12
parent54bc450dbf057e66bed5f10d13d90a469e5ca8ae (diff)
-e flag handles arguments.
-rw-r--r--st.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/st.c b/st.c
index 4d04416..d43c30c 100644
--- a/st.c
+++ b/st.c
@@ -545,11 +545,15 @@ die(const char *errstr, ...) {
void
execsh(void) {
- char *args[] = {getenv("SHELL"), "-i", NULL};
+ char **args;
+ char *envshell = getenv("SHELL");
+ DEFAULT(envshell, "sh");
+
if(opt_cmd)
- args[0] = opt_cmd, args[1] = NULL;
+ args = (char*[]){"sh", "-c", opt_cmd, NULL};
else
- DEFAULT(args[0], SHELL);
+ args = (char*[]){envshell, "-i", NULL};
+
putenv("TERM="TNAME);
execvp(args[0], args);
}