summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-05-09 15:47:14 -0400
committerArmaan Bhojwani <me@armaanb.net>2021-05-09 15:47:14 -0400
commitb658d44c5a515751912b7af7cbddabc93592c2b9 (patch)
tree3427c990d6b9eaacec1d14f4c74e0369a95235f6
parentc0cde8f95a87aaa419cffe80cb75e7aa6a2d1501 (diff)
downloadmmenu-b658d44c5a515751912b7af7cbddabc93592c2b9.tar.gz
Check for double spaces in addition to newlines
-rw-r--r--mmenu.c8
1 files changed, 4 insertions, 4 deletions
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;
}