]> pd.if.org Git - zpackage/blobdiff - zpm-addfile.c
large commit of C work
[zpackage] / zpm-addfile.c
diff --git a/zpm-addfile.c b/zpm-addfile.c
new file mode 100644 (file)
index 0000000..961b6b8
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include "zpm.h"
+
+int main(int ac, char **av){
+       struct zpm pkg;
+       char hash[65];
+
+       if (ac < 3) {
+               fprintf(stderr, "usage: db path\n");
+               return 1;
+       }
+       zpm_open(&pkg, av[1]);
+       zpm_begin(&pkg);
+       zpm_import(&pkg, av[2], 0, hash);
+       zpm_commit(&pkg);
+       zpm_close(&pkg);
+       //fprintf(stdout, "%s %s\n", hash, av[2]);
+       fprintf(stdout, "%s\n", hash);
+       return 0;
+}