output blocks up to double-spaces

This commit is contained in:
Loic Nageleisen 2013-02-01 21:39:38 +01:00
parent e4bef3fbe0
commit 9916ebe0bc

17
main.c
View file

@ -80,16 +80,15 @@ void Post_printf(Post *self) {
char *nosp = NULL; char *nosp = NULL;
for (char *buf = self->body; *buf != '\0'; buf++) { for (char *buf = self->body; *buf != '\0'; buf++) {
if (*buf != ' ') { if (*buf != ' ') {
nosp = nosp == NULL ? buf : nosp; if (*buf == '\n') {
} else { printf("\n");
if (nosp != NULL) { } else {
fwrite(nosp, sizeof(char), buf - nosp, stdout); nosp = nosp == NULL ? buf : nosp;
nosp = NULL;
} }
if (*(buf+1) != ' ' && } else {
*(buf+1) != '\0' && if (nosp != NULL && *(buf+1) == ' ') {
*(buf+1) != '\n') { fwrite(nosp, sizeof(char), buf+1 - nosp, stdout);
printf(" "); nosp = NULL;
} }
} }
} }