st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit bdeb1e7c4c63ad278dd4b2f8fd6fccb7651c3e6f
parent 2eca2629694bd1f4e734d30b9c027c2704e5b056
Author: Bakkeby <bakkeby@gmail.com>
Date:   Thu, 11 Aug 2022 15:04:44 +0200

openurlonclick: using posix_spawnp instead of system ref. comments in #76

Diffstat:
Mpatch/openurlonclick.c | 7++++---
Mpatch/openurlonclick.h | 2++
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/patch/openurlonclick.c b/patch/openurlonclick.c @@ -133,8 +133,9 @@ openUrlOnClick(int col, int row, char* url_opener) { char *url = detecturl(col, row, 1); if (url) { - char command[strlen(url_opener) + strlen(url) + 5]; - sprintf(command, "%s \"%s\"&", url_opener, url); - system(command); + extern char **environ; + pid_t junk; + char *argv[] = { url_opener, url, NULL }; + posix_spawnp(&junk, argv[0], NULL, NULL, argv, environ); } } diff --git a/patch/openurlonclick.h b/patch/openurlonclick.h @@ -1,3 +1,5 @@ +#include <spawn.h> + static inline void restoremousecursor(void) { if (!(win.mode & MODE_MOUSE) && xw.pointerisvisible) XDefineCursor(xw.dpy, xw.win, xw.vpointer);