aboutsummaryrefslogtreecommitdiff
path: root/archival/dpkg_deb.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-11-05 01:52:23 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-11-05 01:52:23 +0000
commit18bbca18acf229875f2bb60cc37c3e8c22d237bc (patch)
treec5f85351ac0d13675edbd779dc15aef0240e394e /archival/dpkg_deb.c
parent8e940984231a5baf98b6e2a637477dd701d314a9 (diff)
downloadbusybox-w32-18bbca18acf229875f2bb60cc37c3e8c22d237bc.tar.gz
busybox-w32-18bbca18acf229875f2bb60cc37c3e8c22d237bc.tar.bz2
busybox-w32-18bbca18acf229875f2bb60cc37c3e8c22d237bc.zip
enable .tar.bz2 for dpkg-deb
Diffstat (limited to 'archival/dpkg_deb.c')
-rw-r--r--archival/dpkg_deb.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 06a810cc1..c46739553 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -24,10 +24,10 @@
24extern int dpkg_deb_main(int argc, char **argv) 24extern int dpkg_deb_main(int argc, char **argv)
25{ 25{
26 archive_handle_t *ar_archive; 26 archive_handle_t *ar_archive;
27 archive_handle_t *tar_gz_archive; 27 archive_handle_t *tar_archive;
28 int opt = 0; 28 int opt = 0;
29#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY 29#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
30 const llist_t *control_tar_gz_llist = add_to_list(NULL, "control.tar.gz"); 30 const llist_t *control_tar_llist = NULL;
31#endif 31#endif
32#ifndef CONFIG_AR 32#ifndef CONFIG_AR
33 char magic[7]; 33 char magic[7];
@@ -38,14 +38,26 @@ extern int dpkg_deb_main(int argc, char **argv)
38 */ 38 */
39 39
40 /* Setup the tar archive handle */ 40 /* Setup the tar archive handle */
41 tar_gz_archive = init_handle(); 41 tar_archive = init_handle();
42 42
43 /* Setup an ar archive handle that refers to the gzip sub archive */ 43 /* Setup an ar archive handle that refers to the gzip sub archive */
44 ar_archive = init_handle(); 44 ar_archive = init_handle();
45 ar_archive->action_data_subarchive = get_header_tar_gz; 45 ar_archive->sub_archive = tar_archive;
46 ar_archive->sub_archive = tar_gz_archive; 46 ar_archive->filter = filter_accept_list_reassign;
47 ar_archive->filter = filter_accept_list; 47
48#ifdef CONFIG_FEATURE_DEB_TAR_GZ
48 ar_archive->accept = add_to_list(NULL, "data.tar.gz"); 49 ar_archive->accept = add_to_list(NULL, "data.tar.gz");
50# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
51 control_tar_llist = add_to_list(NULL, "control.tar.gz");
52# endif
53#endif
54
55#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
56 ar_archive->accept = add_to_list(ar_archive->accept, "data.tar.bz2");
57# ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
58 control_tar_llist = add_to_list(control_tar_llist, "control.tar.bz2");
59# endif
60#endif
49 61
50#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY 62#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
51 while ((opt = getopt(argc, argv, "cefXx")) != -1) { 63 while ((opt = getopt(argc, argv, "cefXx")) != -1) {
@@ -55,26 +67,26 @@ extern int dpkg_deb_main(int argc, char **argv)
55 switch (opt) { 67 switch (opt) {
56#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY 68#ifndef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
57 case 'c': 69 case 'c':
58 tar_gz_archive->action_header = header_verbose_list; 70 tar_archive->action_header = header_verbose_list;
59 break; 71 break;
60 case 'e': 72 case 'e':
61 ar_archive->accept = control_tar_gz_llist; 73 ar_archive->accept = control_tar_llist;
62 tar_gz_archive->action_data = data_extract_all; 74 tar_archive->action_data = data_extract_all;
63 break; 75 break;
64 case 'f': 76 case 'f':
65 /* Print the entire control file 77 /* Print the entire control file
66 * it should accept a second argument which specifies a 78 * it should accept a second argument which specifies a
67 * specific field to print */ 79 * specific field to print */
68 ar_archive->accept = control_tar_gz_llist; 80 ar_archive->accept = control_tar_llist;
69 tar_gz_archive->accept = add_to_list(NULL, "./control");; 81 tar_archive->accept = add_to_list(NULL, "./control");;
70 tar_gz_archive->filter = filter_accept_list; 82 tar_archive->filter = filter_accept_list;
71 tar_gz_archive->action_data = data_extract_to_stdout; 83 tar_archive->action_data = data_extract_to_stdout;
72 break; 84 break;
73 case 'X': 85 case 'X':
74 tar_gz_archive->action_header = header_list; 86 tar_archive->action_header = header_list;
75#endif 87#endif
76 case 'x': 88 case 'x':
77 tar_gz_archive->action_data = data_extract_all; 89 tar_archive->action_data = data_extract_all;
78 break; 90 break;
79 default: 91 default:
80 show_usage(); 92 show_usage();
@@ -85,7 +97,7 @@ extern int dpkg_deb_main(int argc, char **argv)
85 show_usage(); 97 show_usage();
86 } 98 }
87 99
88 tar_gz_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY); 100 tar_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
89 101
90 /* Workout where to extract the files */ 102 /* Workout where to extract the files */
91 /* 2nd argument is a dir name */ 103 /* 2nd argument is a dir name */