Re: [dev] [st] Use scroll with arguments

From: <tuxway+suckless_AT_posteo.de>
Date: Mon, 06 Jul 2020 20:09:07 +0200

> Let me know if it works.

Hi mat,

thanks for the help. I tried it, but it doesnt't seem to work, ST won't
start.

I guess the problem is related to the assignment of the args array with
the DEFAULT macro.
This might not work within the if statement, thus the args array maybe
has no content.
But I'm not so deep into this topic.

I tried something similar, with a new arg variable for scroll arguments
(see diff on the end).

I don't know whether this issue is a problem for anyone using the scroll
utility.
I currently use ST with the scrollback patch, which you already
mentioned on your first reply.
With the update to 0.8.4 I want to try the new external scroll program,
so I came across this.

Best regards


diff -up a/config.def.h b/config.def.h
--- a/config.def.h 2020-07-06 17:31:18.605782581 +0200
+++ b/config.def.h 2020-07-06 17:32:40.953786220 +0200
_AT_@ -18,8 +18,9 @@ static int borderpx = 2;
   */
  static char *shell = "/bin/sh";
  char *utmp = NULL;
-/* scroll program: to enable use a string like "scroll" */
+/* scroll program: to enable use a string like "scroll" with optional
args */
  char *scroll = NULL;
+char *scroll_args = NULL;
  char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";

  /* identification sequence returned in DA and DECID */
diff -up a/st.c b/st.c
--- a/st.c 2020-07-06 17:31:18.605782581 +0200
+++ b/st.c 2020-07-06 17:53:10.875377310 +0200
_AT_@ -665,7 +665,9 @@ die(const char *errstr, ...)
  void
  execsh(char *cmd, char **args)
  {
- char *sh, *prog, *arg;
+ char *sh, *prog;
+ char *arg = NULL;
+ char *arg2 = NULL;
          const struct passwd *pw;

          errno = 0;
_AT_@ -681,18 +683,16 @@ execsh(char *cmd, char **args)

          if (args) {
                  prog = args[0];
- arg = NULL;
          } else if (scroll) {
                  prog = scroll;
- arg = utmp ? utmp : sh;
+ arg = scroll_args ? scroll_args : utmp ? utmp : sh;
+ arg2 = scroll_args ? utmp ? utmp : sh : NULL;
          } else if (utmp) {
                  prog = utmp;
- arg = NULL;
          } else {
                  prog = sh;
- arg = NULL;
          }
- DEFAULT(args, ((char *[]) {prog, arg, NULL}));
+ DEFAULT(args, ((char *[]) {prog, arg, arg2, NULL}));

          unsetenv("COLUMNS");
          unsetenv("LINES");
diff -up a/st.h b/st.h
--- a/st.h 2020-07-06 17:31:18.605782581 +0200
+++ b/st.h 2020-07-06 17:30:11.594694900 +0200
_AT_@ -114,6 +114,7 @@ char *xstrdup(char *);
  /* config.h globals */
  extern char *utmp;
  extern char *scroll;
+extern char *scroll_args;
  extern char *stty_args;
  extern char *vtiden;
  extern wchar_t *worddelimiters;
Received on Mon Jul 06 2020 - 20:09:07 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 06 2020 - 20:12:09 CEST