aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h1
-rw-r--r--st.c17
2 files changed, 12 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h
index fe81078..cc16f97 100644
--- a/config.def.h
+++ b/config.def.h
@@ -8,6 +8,7 @@
8static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false"; 8static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false";
9static int borderpx = 2; 9static int borderpx = 2;
10static char shell[] = "/bin/sh"; 10static char shell[] = "/bin/sh";
11static char *utmp = NULL;
11 12
12/* identification sequence returned in DA and DECID */ 13/* identification sequence returned in DA and DECID */
13static char vtiden[] = "\033[?6c"; 14static char vtiden[] = "\033[?6c";
diff --git a/st.c b/st.c
index dd3301b..ab3fa6e 100644
--- a/st.c
+++ b/st.c
@@ -1153,16 +1153,22 @@ execsh(void) {
1153 else 1153 else
1154 die("who are you?\n"); 1154 die("who are you?\n");
1155 } 1155 }
1156 unsetenv("COLUMNS");
1157 unsetenv("LINES");
1158 unsetenv("TERMCAP");
1159 1156
1160 sh = (pw->pw_shell[0]) ? pw->pw_shell : shell; 1157 if (utmp)
1158 sh = utmp;
1159 else if (pw->pw_shell[0])
1160 sh = pw->pw_shell;
1161 else
1162 sh = shell;
1163 args = (opt_cmd) ? opt_cmd : (char *[]){sh, NULL};
1161 snprintf(buf, sizeof(buf), "%lu", xw.win); 1164 snprintf(buf, sizeof(buf), "%lu", xw.win);
1162 1165
1166 unsetenv("COLUMNS");
1167 unsetenv("LINES");
1168 unsetenv("TERMCAP");
1163 setenv("LOGNAME", pw->pw_name, 1); 1169 setenv("LOGNAME", pw->pw_name, 1);
1164 setenv("USER", pw->pw_name, 1); 1170 setenv("USER", pw->pw_name, 1);
1165 setenv("SHELL", sh, 1); 1171 setenv("SHELL", args[0], 1);
1166 setenv("HOME", pw->pw_dir, 1); 1172 setenv("HOME", pw->pw_dir, 1);
1167 setenv("TERM", termname, 1); 1173 setenv("TERM", termname, 1);
1168 setenv("WINDOWID", buf, 1); 1174 setenv("WINDOWID", buf, 1);
@@ -1174,7 +1180,6 @@ execsh(void) {
1174 signal(SIGTERM, SIG_DFL); 1180 signal(SIGTERM, SIG_DFL);
1175 signal(SIGALRM, SIG_DFL); 1181 signal(SIGALRM, SIG_DFL);
1176 1182
1177 args = opt_cmd ? opt_cmd : (char *[]){sh, "-i", NULL};
1178 execvp(args[0], args); 1183 execvp(args[0], args);
1179 exit(EXIT_FAILURE); 1184 exit(EXIT_FAILURE);
1180} 1185}