summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h3
-rw-r--r--st.13
-rw-r--r--st.c16
-rw-r--r--st.h1
4 files changed, 15 insertions, 8 deletions
diff --git a/config.def.h b/config.def.h
index 546edda..dfcbda9 100644
--- a/config.def.h
+++ b/config.def.h
@@ -11,13 +11,14 @@ static int borderpx = 2;
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
- * 2: utmp option
+ * 2: scroll and/or utmp
* 3: SHELL environment variable
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
static char *shell = "/bin/sh";
char *utmp = NULL;
+char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */
diff --git a/st.1 b/st.1
index e8d6059..39120b4 100644
--- a/st.1
+++ b/st.1
@@ -170,7 +170,8 @@ See the LICENSE file for the terms of redistribution.
.SH SEE ALSO
.BR tabbed (1),
.BR utmp (1),
-.BR stty (1)
+.BR stty (1),
+.BR scroll (1)
.SH BUGS
See the TODO file in the distribution.
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, ...)
void
execsh(char *cmd, char **args)
{
- char *sh, *prog;
+ char *sh, *prog, *arg;
const struct passwd *pw;
errno = 0;
@@ -678,13 +678,17 @@ execsh(char *cmd, char **args)
if ((sh = getenv("SHELL")) == NULL)
sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
- if (args)
+ if (args) {
prog = args[0];
- else if (utmp)
- prog = utmp;
- else
+ arg = NULL;
+ } else if (scroll || utmp) {
+ prog = scroll ? scroll : utmp;
+ arg = scroll ? utmp : NULL;
+ } else {
prog = sh;
- DEFAULT(args, ((char *[]) {prog, NULL}));
+ arg = NULL;
+ }
+ DEFAULT(args, ((char *[]) {prog, arg, NULL}));
unsetenv("COLUMNS");
unsetenv("LINES");
diff --git a/st.h b/st.h
index a1928ca..d978458 100644
--- a/st.h
+++ b/st.h
@@ -113,6 +113,7 @@ char *xstrdup(char *);
/* config.h globals */
extern char *utmp;
+extern char *scroll;
extern char *stty_args;
extern char *vtiden;
extern wchar_t *worddelimiters;