mirror of
https://github.com/lloeki/cblocks-clobj.git
synced 2025-12-06 10:44:40 +01:00
write blocks (words) at once, not chars
This commit is contained in:
parent
8751323eb2
commit
cda16d2a1b
1 changed files with 7 additions and 2 deletions
7
main.c
7
main.c
|
|
@ -75,10 +75,15 @@ void Post_init(Post *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Post_printf(Post *self) {
|
void Post_printf(Post *self) {
|
||||||
|
char *nosp = NULL;
|
||||||
for (char *buf = self->body; *buf != '\0'; buf++) {
|
for (char *buf = self->body; *buf != '\0'; buf++) {
|
||||||
if (*buf != ' ') {
|
if (*buf != ' ') {
|
||||||
printf("%c", *buf);
|
nosp = nosp == NULL ? buf : nosp;
|
||||||
} else {
|
} else {
|
||||||
|
if (nosp != NULL) {
|
||||||
|
fwrite(nosp, sizeof(char), buf - nosp, stdout);
|
||||||
|
nosp = NULL;
|
||||||
|
}
|
||||||
if (*(buf+1) != ' ' &&
|
if (*(buf+1) != ' ' &&
|
||||||
*(buf+1) != '\0' &&
|
*(buf+1) != '\0' &&
|
||||||
*(buf+1) != '\n') {
|
*(buf+1) != '\n') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue