]> git.armaanb.net Git - dwmblocks.git/commitdiff
Fixed issue with empty command delimiter
authoraidan <aidan@Edward.localdomain>
Sat, 29 Aug 2020 17:58:28 +0000 (11:58 -0600)
committeraidan <aidan@Edward.localdomain>
Sat, 29 Aug 2020 17:58:28 +0000 (11:58 -0600)
This meant that the delimiters were added when when both the icon and
output where empty.

dwmblocks.c

index e3e34a18878b825764c83ebf107ff53165f01302..c66dbc794b6d61f0054903077dbc63a9751088fa 100644 (file)
@@ -56,6 +56,8 @@ void getcmd(const Block *block, char *output)
        int i = strlen(block->icon);
        fgets(output+i, CMDLENGTH-i-delimLen, cmdf);
        i = strlen(output);
+       if (i == 0)//return if block and command output are both empty
+               return;
        if (delim[0] != '\0') {
                //only chop off newline if one is present at the end
                i = output[i-1] == '\n' ? i-1 : i;