From de46184d9175c67e3fc45aed997118dad0d6bb3d Mon Sep 17 00:00:00 2001 From: Mertoalex Ashley Date: Fri, 4 Apr 2025 21:27:03 +0300 Subject: [PATCH] adding variable `option` to config.def.h so you can call shell with argument. --- config.def.h | 6 ++++++ st.c | 3 +++ st.h | 1 + 3 files changed, 10 insertions(+) diff --git a/config.def.h b/config.def.h index 2cd740a..c314e98 100644 --- a/config.def.h +++ b/config.def.h @@ -17,6 +17,12 @@ static int borderpx = 2; * 5: value of shell in config.h */ static char *shell = "/bin/sh"; +/* + * argument that should be used to call shell with, + * like "-l" to make st open shell as login shell. + * (needed on shells like busybox-ash.) + */ +char *option = NULL; char *utmp = NULL; /* scroll program: to enable use a string like "scroll" */ char *scroll = NULL; diff --git a/st.c b/st.c index 03b9bc8..03d3100 100644 --- a/st.c +++ b/st.c @@ -677,6 +677,9 @@ execsh(char *cmd, char **args) if (args) { prog = args[0]; arg = NULL; + } else if (option) { + prog = sh; + arg = option; } else if (scroll) { prog = scroll; arg = utmp ? utmp : sh; diff --git a/st.h b/st.h index fd3b0d8..b7a0237 100644 --- a/st.h +++ b/st.h @@ -112,6 +112,7 @@ void *xrealloc(void *, size_t); char *xstrdup(const char *); /* config.h globals */ +extern char *option; extern char *utmp; extern char *scroll; extern char *stty_args; -- 2.48.1