diff --git a/dwmblocks.c b/dwmblocks.c index 18f58fb..563a07e 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -51,13 +51,13 @@ void remove_all(char *str, char to_remove) { char *read = str; char *write = str; while (*read) { - if (*read == to_remove) { - read++; + if (*read != to_remove) { *write = *read; + ++write; } - read++; - write++; + ++read; } + *write = '\0'; } //opens process *cmd and stores output in *output