From: Armaan Bhojwani Date: Sun, 9 May 2021 19:47:14 +0000 (-0400) Subject: Check for double spaces in addition to newlines X-Git-Url: https://git.armaanb.net/?p=mmenu.git;a=commitdiff_plain;h=b658d44c5a515751912b7af7cbddabc93592c2b9 Check for double spaces in addition to newlines --- diff --git a/mmenu.c b/mmenu.c index fafc3fd..08f3d06 100644 --- a/mmenu.c +++ b/mmenu.c @@ -108,16 +108,16 @@ getmenu(char *date) j = 1; for (int i = 0; outp[i]; i++) { j++; - if (outp[i] == '\n' && outp[i+1] == '\n') { - i++; - } else { + if (!((outp[i] == '\n' && outp[i+1] == '\n') || + (outp[i] == ' ' && outp[i+1] == ' '))) { nl = (char *) realloc(nl, j); if (!nl) memfail(); - next[0] = outp[i]; + next[0] = outp[i+1]; strncat(nl, next, 2); } } free(outp); + return nl; }