X-Git-Url: https://git.xinqibao.xyz/st.git/blobdiff_plain/af75c433e56e74d2ad7a315d504a9303ea532f18..732b9601ed2543b1fa6acbc08ddc05818279265f:/st.c?ds=sidebyside diff --git a/st.c b/st.c index 3829e73..d43c30c 100644 --- a/st.c +++ b/st.c @@ -545,11 +545,15 @@ die(const char *errstr, ...) { void execsh(void) { - char *args[] = {getenv("SHELL"), "-i", NULL}; + char **args; + char *envshell = getenv("SHELL"); + DEFAULT(envshell, "sh"); + if(opt_cmd) - args[0] = opt_cmd, args[1] = NULL; + args = (char*[]){"sh", "-c", opt_cmd, NULL}; else - DEFAULT(args[0], SHELL); + args = (char*[]){envshell, "-i", NULL}; + putenv("TERM="TNAME); execvp(args[0], args); } @@ -630,7 +634,7 @@ ttyread(void) { } /* keep any uncomplete utf8 char for the next call */ - memcpy(buf, ptr, buflen); + memmove(buf, ptr, buflen); } void