aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/st.c b/st.c
index 3cd7831..f54e4d5 100644
--- a/st.c
+++ b/st.c
@@ -5,6 +5,7 @@
5#include <fcntl.h> 5#include <fcntl.h>
6#include <limits.h> 6#include <limits.h>
7#include <locale.h> 7#include <locale.h>
8#include <pwd.h>
8#include <stdarg.h> 9#include <stdarg.h>
9#include <stdbool.h> 10#include <stdbool.h>
10#include <stdio.h> 11#include <stdio.h>
@@ -881,11 +882,23 @@ void
881execsh(void) { 882execsh(void) {
882 char **args; 883 char **args;
883 char *envshell = getenv("SHELL"); 884 char *envshell = getenv("SHELL");
885 const struct passwd *pass = getpwuid(getuid());
886 char buf[sizeof(long) * 8 + 1];
884 887
885 unsetenv("COLUMNS"); 888 unsetenv("COLUMNS");
886 unsetenv("LINES"); 889 unsetenv("LINES");
887 unsetenv("TERMCAP"); 890 unsetenv("TERMCAP");
888 891
892 if(pass) {
893 setenv("LOGNAME", pass->pw_name, 1);
894 setenv("USER", pass->pw_name, 1);
895 setenv("SHELL", pass->pw_shell, 0);
896 setenv("HOME", pass->pw_dir, 0);
897 }
898
899 snprintf(buf, sizeof(buf), "%lu", xw.win);
900 setenv("WINDOWID", buf, 1);
901
889 signal(SIGCHLD, SIG_DFL); 902 signal(SIGCHLD, SIG_DFL);
890 signal(SIGHUP, SIG_DFL); 903 signal(SIGHUP, SIG_DFL);
891 signal(SIGINT, SIG_DFL); 904 signal(SIGINT, SIG_DFL);
@@ -2795,8 +2808,8 @@ main(int argc, char *argv[]) {
2795run: 2808run:
2796 setlocale(LC_CTYPE, ""); 2809 setlocale(LC_CTYPE, "");
2797 tnew(80, 24); 2810 tnew(80, 24);
2798 ttynew();
2799 xinit(); 2811 xinit();
2812 ttynew();
2800 selinit(); 2813 selinit();
2801 run(); 2814 run();
2802 return 0; 2815 return 0;