Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Do not set SHELL to utmp ever
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
22a1ce6
..
bcf96e9
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-27,6
+27,7
@@
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xft/Xft.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xft/Xft.h>
+#include <X11/XKBlib.h>
#include <fontconfig/fontconfig.h>
#include <wchar.h>
#include <fontconfig/fontconfig.h>
#include <wchar.h>
@@
-1145,7
+1146,7
@@
die(const char *errstr, ...) {
void
execsh(void) {
void
execsh(void) {
- char **args, *sh;
+ char **args, *sh
, *prog
;
const struct passwd *pw;
char buf[sizeof(long) * 8 + 1];
const struct passwd *pw;
char buf[sizeof(long) * 8 + 1];
@@
-1157,13
+1158,15
@@
execsh(void) {
die("who are you?\n");
}
die("who are you?\n");
}
- if (utmp)
- sh = utmp;
- else if (pw->pw_shell[0])
- sh = pw->pw_shell;
+ sh = (pw->pw_shell[0]) ? pw->pw_shell : shell;
+ if(opt_cmd)
+ prog = opt_cmd[0];
+ else if(utmp)
+ prog = utmp;
else
else
- sh = shell;
- args = (opt_cmd) ? opt_cmd : (char *[]){sh, NULL};
+ prog = sh;
+ args = (opt_cmd) ? opt_cmd : (char *[]) {prog, NULL};
+
snprintf(buf, sizeof(buf), "%lu", xw.win);
unsetenv("COLUMNS");
snprintf(buf, sizeof(buf), "%lu", xw.win);
unsetenv("COLUMNS");
@@
-1171,7
+1174,7
@@
execsh(void) {
unsetenv("TERMCAP");
setenv("LOGNAME", pw->pw_name, 1);
setenv("USER", pw->pw_name, 1);
unsetenv("TERMCAP");
setenv("LOGNAME", pw->pw_name, 1);
setenv("USER", pw->pw_name, 1);
- setenv("SHELL",
args[0]
, 1);
+ setenv("SHELL",
sh
, 1);
setenv("HOME", pw->pw_dir, 1);
setenv("TERM", termname, 1);
setenv("WINDOWID", buf, 1);
setenv("HOME", pw->pw_dir, 1);
setenv("TERM", termname, 1);
setenv("WINDOWID", buf, 1);
@@
-1183,7
+1186,7
@@
execsh(void) {
signal(SIGTERM, SIG_DFL);
signal(SIGALRM, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGALRM, SIG_DFL);
- execvp(
args[0]
, args);
+ execvp(
prog
, args);
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
@@
-2423,7
+2426,7
@@
tcontrolcode(uchar ascii) {
if(!(xw.state & WIN_FOCUSED))
xseturgency(1);
if (bellvolume)
if(!(xw.state & WIN_FOCUSED))
xseturgency(1);
if (bellvolume)
- X
Bell(xw.dpy, bellvolume
);
+ X
kbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL
);
}
break;
case '\033': /* ESC */
}
break;
case '\033': /* ESC */