memset(ds_put_uninit(ds, n), c, n);
}
+void
+ds_put_buffer(struct ds *ds, const char *s, size_t n)
+{
+ memcpy(ds_put_uninit(ds, n), s, n);
+}
+
void
ds_put_cstr(struct ds *ds, const char *s)
{
}
}
+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)
{