From f431cd1a48a6a5186633bf5f16a2d21cb4399e8c Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 09 Feb 2012 10:56:43 -0500 Subject: Initial commit. TODO: Copyright information. Including source code and a patch to add files generated by GNU Autoconf is not very pretty... Running 'make dist' in the SVN trunk to generate a source archive might be better. --- (limited to 'src/tests/.svn/text-base/opkg_extract_test.c.svn-base') diff --git a/src/tests/.svn/text-base/opkg_extract_test.c.svn-base b/src/tests/.svn/text-base/opkg_extract_test.c.svn-base new file mode 100644 index 0000000..9754691 --- /dev/null +++ b/src/tests/.svn/text-base/opkg_extract_test.c.svn-base @@ -0,0 +1,46 @@ +#include +#include +#include + +/* + * build thus: + + * gcc -o opkg_extract_test opkg_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 []\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; +} -- cgit v0.9.1