commit 3774b03171af1d24d92bd61b2d67a58e74847c5b
parent ad2184d57ae98c48d365081e6326c31a855cf896
Author: Mertoalex Ashley <mertoalex+git@disroot.org>
Date: Sun, 6 Apr 2025 06:37:41 +0300
[st][patches][option] Add patch: patch for running shell with argument.
Diffstat:
4 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/st.suckless.org/patches/option/index.md b/st.suckless.org/patches/option/index.md
@@ -0,0 +1,25 @@
+option
+=========
+
+Description
+-----------
+This patch adds variable called `option` to config.def.h so st can run shell with argument.
+
+
+Example
+-------
+`static char *shell = "/usr/bin/ash";`
+
+`char *option = "-l";`
+
+so now st runs ash with `-l` argument so ash opens as login shell so it sources /etc/profile.d/ files.
+
+[](st-option.png)
+
+Download
+--------
+* [st-option-20250404-98610fc.diff](st-option-20250404-98610fc.diff)
+
+Authors
+-------
+* Mertoalex Ashley - <mertoalex+suckless@disroot.org>
diff --git a/st.suckless.org/patches/option/st-option-20250404-98610fc.diff b/st.suckless.org/patches/option/st-option-20250404-98610fc.diff
@@ -0,0 +1,58 @@
+From de46184d9175c67e3fc45aed997118dad0d6bb3d Mon Sep 17 00:00:00 2001
+From: Mertoalex Ashley <mertoalex+git@disroot.org>
+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
+
diff --git a/st.suckless.org/patches/option/st-option-preview-grayscale.png b/st.suckless.org/patches/option/st-option-preview-grayscale.png
Binary files differ.
diff --git a/st.suckless.org/patches/option/st-option.png b/st.suckless.org/patches/option/st-option.png
Binary files differ.