}
}
+int
+ds_get_line(struct ds *ds, FILE *file)
+{
+ ds_clear(ds);
+ for (;;) {
+ int c = getc(file);
+ if (c == EOF) {
+ return ds->length ? 0 : EOF;
+ } else if (c == '\n') {
+ return 0;
+ } else {
+ ds_put_char(ds, c);
+ }
+ }
+}
+
char *
ds_cstr(struct ds *ds)
{
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdio.h>
#include "compiler.h"
struct tm;
STRFTIME_FORMAT(2);
void ds_put_hex_dump(struct ds *ds, const void *buf_, size_t size,
uintptr_t ofs, bool ascii);
+int ds_get_line(struct ds *, FILE *);
+
char *ds_cstr(struct ds *);
void ds_destroy(struct ds *);