slstatus

Fork of suckless' slstatus with my personal patches
git clone https://git.instinctive.eu/slstatus.git
Log | Files | Refs | README | LICENSE

commit ff65c4a413cfc3626280a4ea52be99472fbbe48a
parent 8bfe4b2e280e4d4b9762d3a93c4ec94c2fc9d754
Author: Aaron Marcher <me+github@drkhsh.at>
Date:   Sat, 17 Feb 2018 20:00:04 +0000

Merge pull request #43 from SiIky/unknown_str

Print unknown_str in case of error
Diffstat:
Mslstatus.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/slstatus.c b/slstatus.c @@ -87,8 +87,10 @@ main(int argc, char *argv[]) status[0] = '\0'; for (i = len = 0; i < LEN(args); i++) { + const char * res = args[i].func(args[i].args); + res = (res == NULL) ? unknown_str : res; len += snprintf(status + len, sizeof(status) - len, - args[i].fmt, args[i].func(args[i].args)); + args[i].fmt, res); if (len >= sizeof(status)) { status[sizeof(status) - 1] = '\0';