summaryrefslogtreecommitdiffstats
path: root/ipkg_extract_test.c
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-14 23:10:56 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-14 23:10:56 (EST)
commit8bf49d16a637cca0cd116450dfcabc4c941baf6c (patch)
treebea96583e7a63f1b87ad4ef07b191f121348fe78 /ipkg_extract_test.c
parent4074befd4db12e78af74f7e1438459125b0b3016 (diff)
* Add ipkg for future development
git-svn-id: http://opkg.googlecode.com/svn/trunk@3 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'ipkg_extract_test.c')
-rw-r--r--ipkg_extract_test.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/ipkg_extract_test.c b/ipkg_extract_test.c
new file mode 100644
index 0000000..06b8c7d
--- /dev/null
+++ b/ipkg_extract_test.c
@@ -0,0 +1,46 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "libbb/libbb.h"
+
+/*
+ * build thus:
+
+ * gcc -o ipkg_extract_test ipkg_extract_test.c -I./busybox-0.60.2/libbb -L./busybox-0.60.2 -lbb
+ *
+ */
+const char * applet_name;
+
+int main(int argc, char * argv[])
+{
+ /*
+ * see libbb.h and let your imagination run wild
+ * or, set the last item below to extract_one_to_buffer, and you get the control file in
+ * "returned"
+ * or, set the last one to extract_all_to_fs, and, well, guess what happens
+ */
+
+ /* enum extract_functions_e dowhat = extract_control_tar_gz | extract_unconditional | extract_one_to_buffer; */
+ enum extract_functions_e dowhat = extract_control_tar_gz | extract_all_to_fs | extract_preserve_date;
+ char * returned;
+ char * filename;
+
+ if(argc < 2){
+ fprintf(stderr, "syntax: %s <ipkg file> [<file_to_extract>]\n", argv[0]);
+ exit(0);
+ }
+
+ if (argc < 3){
+ filename=NULL;
+ } else {
+ filename = argv[2];
+ }
+
+ returned = deb_extract(argv[1], stdout, dowhat, NULL, filename);
+
+ if(returned)
+ fprintf(stderr, "returned %s\n", returned);
+ else
+ fprintf(stderr, "extract returned nuthin'\n");
+
+ return 0;
+}