X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=4499be6618b9c2b3d264858d58065c6fdc62739f;hb=4418939dd9f3a7b3cfd3071234ed18ae86538f2a;hp=23dd7f1fd76d500252a75c33425b24e3d6aaec2e;hpb=008aae541b5cb1e67a025048adef9a06eaa11c2e;p=st.git diff --git a/st.c b/st.c index 23dd7f1..4499be6 100644 --- a/st.c +++ b/st.c @@ -1158,7 +1158,10 @@ execsh(void) { die("who are you?\n"); } - sh = (pw->pw_shell[0]) ? pw->pw_shell : shell; + if (!(sh = getenv("SHELL"))) { + sh = (pw->pw_shell[0]) ? pw->pw_shell : shell; + } + if(opt_cmd) prog = opt_cmd[0]; else if(utmp) @@ -1187,7 +1190,7 @@ execsh(void) { signal(SIGALRM, SIG_DFL); execvp(prog, args); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } void @@ -2576,7 +2579,10 @@ tputc(char *c, int len) { unicodep = ascii = *c; } else { utf8decode(c, &unicodep, UTF_SIZ); - width = wcwidth(unicodep); + if ((width = wcwidth(unicodep)) == -1) { + c = "\357\277\275"; /* UTF_INVALID */ + width = 1; + } control = ISCONTROLC1(unicodep); ascii = unicodep; }