--- /dev/null
+#include <stdlib.h>
+#include <stdio.h>
+#include "zpm.h"
+#include "sqlite/sqlite3.h"
+
+int main(int ac, char **av){
+ struct zpm pkg;
+ char hash[65];
+ int i;
+
+ if (ac < 3) {
+ fprintf(stderr, "usage: db path\n");
+ return 1;
+ }
+
+#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[i], 0, hash)) {
+ fprintf(stdout, "%s\n", hash);
+ // zpm_addtopackage(&pkg, hash, 0);
+ //fprintf(stdout, "%s %s\n", hash, av[2]);
+ } else {
+ zpm_rollback(&pkg);
+ zpm_close(&pkg);
+ exit(1);
+ }
+ }
+ } else {
+ fprintf(stderr, "failed to open database %s\n", av[1]);
+ exit(EXIT_FAILURE);
+ }
+
+ zpm_commit(&pkg);
+ zpm_close(&pkg);
+ return 0;
+}