-#include <stdio.h>
-#include <stdlib.h>
-#include "strbuf.h"
#include "cache.h"
+#include "strbuf.h"
void strbuf_init(struct strbuf *sb) {
- sb->buf = 0;
+ sb->buf = NULL;
sb->eof = sb->alloc = sb->len = 0;
}
break;
strbuf_add(sb, ch);
}
+ if (ch == EOF && sb->len == 0)
+ sb->eof = 1;
strbuf_end(sb);
}