mirror of
https://github.com/lloeki/cblocks-clobj.git
synced 2025-12-06 02:34:40 +01:00
output blocks up to double-spaces
This commit is contained in:
parent
e4bef3fbe0
commit
9916ebe0bc
1 changed files with 8 additions and 9 deletions
17
main.c
17
main.c
|
|
@ -80,16 +80,15 @@ void Post_printf(Post *self) {
|
|||
char *nosp = NULL;
|
||||
for (char *buf = self->body; *buf != '\0'; buf++) {
|
||||
if (*buf != ' ') {
|
||||
nosp = nosp == NULL ? buf : nosp;
|
||||
} else {
|
||||
if (nosp != NULL) {
|
||||
fwrite(nosp, sizeof(char), buf - nosp, stdout);
|
||||
nosp = NULL;
|
||||
if (*buf == '\n') {
|
||||
printf("\n");
|
||||
} else {
|
||||
nosp = nosp == NULL ? buf : nosp;
|
||||
}
|
||||
if (*(buf+1) != ' ' &&
|
||||
*(buf+1) != '\0' &&
|
||||
*(buf+1) != '\n') {
|
||||
printf(" ");
|
||||
} else {
|
||||
if (nosp != NULL && *(buf+1) == ' ') {
|
||||
fwrite(nosp, sizeof(char), buf+1 - nosp, stdout);
|
||||
nosp = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue