]> pd.if.org Git - zpackage/blob - zpm-addfile.c
let addfile take multiple files
[zpackage] / zpm-addfile.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include "zpm.h"
4
5 int main(int ac, char **av){
6         struct zpm pkg;
7         char hash[65];
8         int i;
9
10         if (ac < 3) {
11                 fprintf(stderr, "usage: db path\n");
12                 return 1;
13         }
14
15         /* this is really just read env */
16         zpm_readopts(&pkg, ac, av);
17
18         if (zpm_open(&pkg, av[1])) {
19                 zpm_begin(&pkg);
20                 for (i=2; i<ac; i++) {
21                         if (zpm_import(&pkg, av[2], 0, hash)) {
22                                 fprintf(stdout, "%s\n", hash);
23         //                      zpm_addtopackage(&pkg, hash, 0);
24                                 //fprintf(stdout, "%s %s\n", hash, av[2]);
25                         } else {
26                                 zpm_rollback(&pkg);
27                                 zpm_close(&pkg);
28                                 exit(1);
29                         }
30                 }
31         }
32         zpm_commit(&pkg);
33         zpm_close(&pkg);
34         return 0;
35 }