summaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--st.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/st.c b/st.c
index 3e48410..5f2352a 100644
--- a/st.c
+++ b/st.c
@@ -664,7 +664,7 @@ die(const char *errstr, ...)
664void 664void
665execsh(char *cmd, char **args) 665execsh(char *cmd, char **args)
666{ 666{
667 char *sh, *prog; 667 char *sh, *prog, *arg;
668 const struct passwd *pw; 668 const struct passwd *pw;
669 669
670 errno = 0; 670 errno = 0;
@@ -678,13 +678,17 @@ execsh(char *cmd, char **args)
678 if ((sh = getenv("SHELL")) == NULL) 678 if ((sh = getenv("SHELL")) == NULL)
679 sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd; 679 sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
680 680
681 if (args) 681 if (args) {
682 prog = args[0]; 682 prog = args[0];
683 else if (utmp) 683 arg = NULL;
684 prog = utmp; 684 } else if (scroll || utmp) {
685 else 685 prog = scroll ? scroll : utmp;
686 arg = scroll ? utmp : NULL;
687 } else {
686 prog = sh; 688 prog = sh;
687 DEFAULT(args, ((char *[]) {prog, NULL})); 689 arg = NULL;
690 }
691 DEFAULT(args, ((char *[]) {prog, arg, NULL}));
688 692
689 unsetenv("COLUMNS"); 693 unsetenv("COLUMNS");
690 unsetenv("LINES"); 694 unsetenv("LINES");