Use or instead of add.
[vcfs.git] / storeput.c
... / ...
CommitLineData
1#include <stdlib.h>
2#include <unistd.h>
3#include <stdio.h>
4#include <string.h>
5
6#include "store.h"
7
8char buf[STORE_MAXBLSZ];
9
10int main(int argc, char **argv)
11{
12 struct store *st;
13 struct addr a;
14 int ret, o;
15
16 if(argc < 3) {
17 fprintf(stderr, "usage: storeget DIR\n");
18 exit(1);
19 }
20 for(o = 0; (ret = read(0, buf + o, STORE_MAXBLSZ - o)) > 0; o += ret);
21 if((st = newfstore(argv[1])) == NULL)
22 exit(1);
23 if((ret = storeput(st, buf, STORE_MAXBLSZ, &a)) < 0) {
24 perror(argv[2]);
25 exit(1);
26 }
27 printf("%s\n", formataddr(&a));
28 return(0);
29}