File: main.c

package info (click to toggle)
borgbackup 1.1.9-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,956 kB
  • sloc: ansic: 39,466; python: 21,922; pascal: 2,269; sh: 137; makefile: 128
file content (33 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#define BORG_NO_PYTHON

#include "../../src/borg/_hashindex.c"
#include "../../src/borg/cache_sync/cache_sync.c"

#define BUFSZ 32768

int main() {
    char buf[BUFSZ];
    int len, ret;
    CacheSyncCtx *ctx;
    HashIndex *idx;

    /* capacity, key size, value size */
    idx = hashindex_init(0, 32, 12);
    ctx = cache_sync_init(idx);

    while (1) {
        len = read(0, buf, BUFSZ);
        if (!len) {
            break;
        }
        ret = cache_sync_feed(ctx, buf, len);
        if(!ret && cache_sync_error(ctx)) {
            fprintf(stderr, "error: %s\n", cache_sync_error(ctx));
            return 1;
        }
    }
    hashindex_free(idx);
    cache_sync_free(ctx);
    return 0;
}