From d072368de029458b9410591bdd257471389a26f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 18 Apr 2022 09:38:07 -0500 Subject: [PATCH] allow user to set path of the fifo --- someblocks.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/someblocks.c b/someblocks.c index 3530de6..8103164 100644 --- a/someblocks.c +++ b/someblocks.c @@ -193,9 +193,15 @@ int main(int argc, char** argv) strncpy(delim, argv[++i], delimLen); else if (!strcmp("-p",argv[i])) writestatus = pstdout; + else if (!strcmp("-s",argv[i])) + strcpy(somebarPath, argv[++i]); } - strcpy(somebarPath, getenv("XDG_RUNTIME_DIR")); - strcat(somebarPath, "/somebar-0"); + + if (!strlen(somebarPath)) { + strcpy(somebarPath, getenv("XDG_RUNTIME_DIR")); + strcat(somebarPath, "/somebar-0"); + } + delimLen = MIN(delimLen, strlen(delim)); delim[delimLen++] = '\0'; signal(SIGTERM, termhandler);