X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=tests%2Fopkg_extract_test.c;h=ba041a8cb0c29bea665f8676e7f4d726342b74c8;hp=9754691132aa197373840032e546c6a148632726;hb=980cfb2e931935a2bd34addccd073811ad1db8e7;hpb=0a4946b3e913a2affe5fd342aa88e2533d06356e diff --git a/tests/opkg_extract_test.c b/tests/opkg_extract_test.c index 9754691..ba041a8 100644 --- a/tests/opkg_extract_test.c +++ b/tests/opkg_extract_test.c @@ -8,39 +8,42 @@ * 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; +const char *applet_name; -int main(int argc, char * argv[]) +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; + /* + * 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; + int err; + + 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, &err); + + if (returned) + fprintf(stderr, "returned %s\n", returned); + else + fprintf(stderr, "extract returned nuthin'\n"); + + return 0; }