vcs-svn: Limit bytes read and written strictly
[git/barrbrain.git] / contrib / svn-fe / svn-da.c
blob3b83f00980d402f60a7efe628a4945aabe225b9e
1 /*
2 * This file is in the public domain.
3 * You may freely use, modify, distribute, and relicense it.
4 */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <inttypes.h>
9 #include "svndiff.h"
11 int main(int argc, char **argv)
13 size_t out = SIZE_MAX;
14 size_t in = SIZE_MAX;
15 size_t len = SIZE_MAX;
16 if (argc < 2 || argc > 5) {
17 fprintf(stderr, "usage: svn-da delta "
18 "[[[postimage_length] preimage_length] delta_length] "
19 "<preimage >postimage");
20 return 1;
22 if (argc >= 3)
23 out = strtoull(argv[2], NULL, 10);
24 if (argc >= 4)
25 in = strtoull(argv[3], NULL, 10);
26 if (argc >= 5)
27 len = strtoull(argv[4], NULL, 10);
28 if (svndiff0_apply(argv[1], len, out, in, stdin, stdout))
29 return 1;
30 return 0;