aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/st.c b/st.c
index dd3301b..ab3fa6e 100644
--- a/st.c
+++ b/st.c
@@ -1153,16 +1153,22 @@ execsh(void) {
else
die("who are you?\n");
}
- unsetenv("COLUMNS");
- unsetenv("LINES");
- unsetenv("TERMCAP");
- sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
+ if (utmp)
+ sh = utmp;
+ else if (pw->pw_shell[0])
+ sh = pw->pw_shell;
+ else
+ sh = shell;
+ args = (opt_cmd) ? opt_cmd : (char *[]){sh, NULL};
snprintf(buf, sizeof(buf), "%lu", xw.win);
+ unsetenv("COLUMNS");
+ unsetenv("LINES");
+ unsetenv("TERMCAP");
setenv("LOGNAME", pw->pw_name, 1);
setenv("USER", pw->pw_name, 1);
- setenv("SHELL", sh, 1);
+ setenv("SHELL", args[0], 1);
setenv("HOME", pw->pw_dir, 1);
setenv("TERM", termname, 1);
setenv("WINDOWID", buf, 1);
@@ -1174,7 +1180,6 @@ execsh(void) {
signal(SIGTERM, SIG_DFL);
signal(SIGALRM, SIG_DFL);
- args = opt_cmd ? opt_cmd : (char *[]){sh, "-i", NULL};
execvp(args[0], args);
exit(EXIT_FAILURE);
}
remember that computers suck.