Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Add support for scroll(1)
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
3e48410
..
5f2352a
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-664,7
+664,7
@@
die(const char *errstr, ...)
void
execsh(char *cmd, char **args)
{
void
execsh(char *cmd, char **args)
{
- char *sh, *prog;
+ char *sh, *prog
, *arg
;
const struct passwd *pw;
errno = 0;
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 ((sh = getenv("SHELL")) == NULL)
sh = (pw->pw_shell[0]) ? pw->pw_shell : cmd;
- if (args)
+ if (args)
{
prog = args[0];
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;
prog = sh;
- DEFAULT(args, ((char *[]) {prog, NULL}));
+ arg = NULL;
+ }
+ DEFAULT(args, ((char *[]) {prog, arg, NULL}));
unsetenv("COLUMNS");
unsetenv("LINES");
unsetenv("COLUMNS");
unsetenv("LINES");