Commit Diff


commit - 0392d165d07143eec29c730364006bc0613e1198
commit + 5afb3862ba368de8888c0c570098baababc7bc19
blob - fe810789e50d948f63949442e674894c901f1229
blob + cc16f97664502e03dce11cc455ae8d9ba647f55d
--- config.def.h
+++ config.def.h
@@ -8,6 +8,7 @@
 static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=false";
 static int borderpx = 2;
 static char shell[] = "/bin/sh";
+static char *utmp = NULL;
 
 /* identification sequence returned in DA and DECID */
 static char vtiden[] = "\033[?6c";
blob - dd3301b121083cfaeea2383d7912e31634f2b860
blob + ab3fa6e6ab2caf1ca8ce264870b5082275c02fcd
--- st.c
+++ st.c
@@ -1153,16 +1153,22 @@ execsh(void) {
 		else
 			die("who are you?\n");
 	}
+
+	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");
-
-	sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
-	snprintf(buf, sizeof(buf), "%lu", xw.win);
-
 	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);
 }