summary |
log |
commit |
diff |
tree
raw |
patch |
inline | side by side (from parent 1:
3542137)
variables. Thanks! xinit() and ttynew() had to be switched in their
call-appearance. Otherwise xw.win is not set.
#include <fcntl.h>
#include <limits.h>
#include <locale.h>
#include <fcntl.h>
#include <limits.h>
#include <locale.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
execsh(void) {
char **args;
char *envshell = getenv("SHELL");
execsh(void) {
char **args;
char *envshell = getenv("SHELL");
+ const struct passwd *pass = getpwuid(getuid());
+ char buf[sizeof(long) * 8 + 1];
unsetenv("COLUMNS");
unsetenv("LINES");
unsetenv("TERMCAP");
unsetenv("COLUMNS");
unsetenv("LINES");
unsetenv("TERMCAP");
+ if(pass) {
+ setenv("LOGNAME", pass->pw_name, 1);
+ setenv("USER", pass->pw_name, 1);
+ setenv("SHELL", pass->pw_shell, 0);
+ setenv("HOME", pass->pw_dir, 0);
+ }
+
+ snprintf(buf, sizeof(buf), "%lu", xw.win);
+ setenv("WINDOWID", buf, 1);
+
signal(SIGCHLD, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
run:
setlocale(LC_CTYPE, "");
tnew(80, 24);
run:
setlocale(LC_CTYPE, "");
tnew(80, 24);
selinit();
run();
return 0;
selinit();
run();
return 0;