]> pd.if.org Git - zpackage/blobdiff - zpm-addfile.c
fix compile process for elf programs
[zpackage] / zpm-addfile.c
index 160d84f7e115009b062f154e69edc2a13efb43a3..f96d00279592690a682f4ccb12d2fef3626fda37 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "zpm.h"
+#include "sqlite/sqlite3.h"
 
 int main(int ac, char **av){
        struct zpm pkg;
@@ -12,13 +13,16 @@ int main(int ac, char **av){
                return 1;
        }
 
-       /* this is really just read env */
-       zpm_readopts(&pkg, ac, av);
-
+#if 0
+       i = sqlite3_config(SQLITE_CONFIG_MMAP_SIZE,98222080);
+       if (i != SQLITE_OK) {
+               exit(3);
+       }
+#endif
        if (zpm_open(&pkg, av[1])) {
                zpm_begin(&pkg);
                for (i=2; i<ac; i++) {
-                       if (zpm_import(&pkg, av[2], 0, hash)) {
+                       if (zpm_import(&pkg, av[i], 0, hash)) {
                                fprintf(stdout, "%s\n", hash);
        //                      zpm_addtopackage(&pkg, hash, 0);
                                //fprintf(stdout, "%s %s\n", hash, av[2]);
@@ -28,7 +32,11 @@ int main(int ac, char **av){
                                exit(1);
                        }
                }
+       } else {
+               fprintf(stderr, "failed to open database %s\n", av[1]);
+               exit(EXIT_FAILURE);
        }
+
        zpm_commit(&pkg);
        zpm_close(&pkg);
        return 0;