- const int dpkg_deb_contents = 1;
- const int dpkg_deb_control = 2;
-// const int dpkg_deb_info = 4;
- const int dpkg_deb_extract = 8;
- const int dpkg_deb_verbose_extract = 16;
- int opt=0;
- int optflag=0;
- int extract_flag = FALSE;
- int list_flag = FALSE;
- int verbose_flag = FALSE;
- int extract_to_stdout = FALSE;
- char ar_filename[15];
- int srcFd=0;
- int status=0;
- ar_headers_t *ar_headers = NULL;
- char **extract_list=NULL;
- char *target_dir=NULL;
-
- while ((opt = getopt(argc, argv, "cexX")) != -1) {
- switch (opt) {
- case 'c':
- optflag |= dpkg_deb_contents;
- break;
- case 'e':
- optflag |= dpkg_deb_control;
- break;
-/* case 'I':
- optflag |= dpkg_deb_info;
- break;
-*/
- case 'x':
- optflag |= dpkg_deb_extract;
- break;
- case 'X':
- optflag |= dpkg_deb_verbose_extract;
- break;
- default:
- usage(dpkg_deb_usage);
- return EXIT_FAILURE;
- }
- }
+ archive_handle_t *ar_archive;
+ archive_handle_t *tar_archive;
+ llist_t *control_tar_llist = NULL;
+ unsigned opt;
+ char *extract_dir = NULL;
+ short argcount = 1;
+
+ /* Setup the tar archive handle */
+ tar_archive = init_handle();
+
+ /* Setup an ar archive handle that refers to the gzip sub archive */
+ ar_archive = init_handle();
+ ar_archive->sub_archive = tar_archive;
+ ar_archive->filter = filter_accept_list_reassign;
+
+#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+ llist_add_to(&(ar_archive->accept), "data.tar.gz");
+ llist_add_to(&control_tar_llist, "control.tar.gz");
+#endif
+
+#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+ llist_add_to(&(ar_archive->accept), "data.tar.bz2");
+ llist_add_to(&control_tar_llist, "control.tar.bz2");
+#endif
+
+ opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
+ opt = getopt32(argc, argv, "cefXx");