Browse Source

Add support for scroll(1)

Scroll is a program that stores all the lines of its child and be used in st as
a way of implementing scrollback.

This solution is much better than implementing the scrollback in st itself
because having a different program allows to use it in any other program
without doing modifications to those programs.
master
Roberto E. Vargas Caballero 5 years ago
committed by Hiltjo Posthuma
parent
commit
21e0d6e8b8
4 changed files with 15 additions and 8 deletions
  1. +2
    -1
      config.def.h
  2. +2
    -1
      st.1
  3. +10
    -6
      st.c
  4. +1
    -0
      st.h

+ 2
- 1
config.def.h View File

@ -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 */


+ 2
- 1
st.1 View File

@ -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.

+ 10
- 6
st.c View File

@ -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");


+ 1
- 0
st.h View File

@ -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;


Loading…
Cancel
Save