2 * test-line-buffer.c: code to exercise the svn importer's input helper
11 #include "git-compat-util.h"
12 #include "vcs-svn/line_buffer.h"
14 static uint32_t strtouint32(const char *s
)
17 uintmax_t n
= strtoumax(s
, &end
, 10);
18 if (*s
== '\0' || *end
!= '\0')
19 die("invalid count: %s", s
);
23 int main(int argc
, char *argv
[])
25 struct line_buffer buf
= LINE_BUFFER_INIT
;
29 usage("test-line-buffer < input.txt");
30 if (buffer_init(&buf
, NULL
))
31 die_errno("open error");
32 while ((s
= buffer_read_line(&buf
))) {
33 s
= buffer_read_string(&buf
, strtouint32(s
));
36 buffer_skip_bytes(&buf
, 1);
37 if (!(s
= buffer_read_line(&buf
)))
39 buffer_copy_bytes(&buf
, strtouint32(s
) + 1);
41 if (buffer_deinit(&buf
))