Converted repo to Git.
[vcfs.git] / storeget.c
1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <string.h>
5
6 #include "store.h"
7
8 char buf[STORE_MAXBLSZ];
9
10 int main(int argc, char **argv)
11 {
12     struct store *st;
13     struct addr a;
14     int ret;
15     
16     if(argc < 3) {
17         fprintf(stderr, "usage: storeget DIR HASH\n");
18         exit(1);
19     }
20     if((st = newfstore(argv[1])) == NULL)
21         exit(1);
22     parseaddr(argv[2], &a);
23     if((ret = storeget(st, buf, STORE_MAXBLSZ, &a)) < 0) {
24         perror(argv[2]);
25         exit(1);
26     }
27     write(1, buf, ret);
28     return(0);
29 }