diff options
-rw-r--r-- | archival/config.in | 7 | ||||
-rw-r--r-- | archival/dpkg_deb.c | 44 | ||||
-rw-r--r-- | archival/libunarchive/Makefile.in | 1 | ||||
-rw-r--r-- | archival/libunarchive/filter_accept_all.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/filter_accept_list.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/filter_accept_reject_list.c | 2 | ||||
-rw-r--r-- | include/unarchive.h | 11 |
7 files changed, 45 insertions, 24 deletions
diff --git a/archival/config.in b/archival/config.in index 3ec03fd8c..05e6dcae4 100644 --- a/archival/config.in +++ b/archival/config.in | |||
@@ -15,7 +15,12 @@ bool 'cpio' CONFIG_CPIO | |||
15 | bool 'dpkg' CONFIG_DPKG | 15 | bool 'dpkg' CONFIG_DPKG |
16 | bool 'dpkg_deb' CONFIG_DPKG_DEB | 16 | bool 'dpkg_deb' CONFIG_DPKG_DEB |
17 | if [ "$CONFIG_DPKG_DEB" = "y" ] ; then | 17 | if [ "$CONFIG_DPKG_DEB" = "y" ] ; then |
18 | bool ' -x support only' CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY | 18 | bool ' extract only (-x)' CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY |
19 | fi | ||
20 | if [ "$CONFIG_DPKG" = "y" ] || [ "$CONFIG_DPKG_DEB" = "y" ] ; then | ||
21 | comment 'Common dpkg/dpkg-deb options' | ||
22 | bool ' gzip debian packages (normal)' CONFIG_FEATURE_DEB_TAR_GZ | ||
23 | bool ' bzip2 debian packages' CONFIG_FEATURE_DEB_TAR_BZ2 | ||
19 | fi | 24 | fi |
20 | bool 'gunzip' CONFIG_GUNZIP | 25 | bool 'gunzip' CONFIG_GUNZIP |
21 | if [ "$CONFIG_GUNZIP" = "y" ]; then | 26 | if [ "$CONFIG_GUNZIP" = "y" ]; then |
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 @@ | |||
24 | extern int dpkg_deb_main(int argc, char **argv) | 24 | extern 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 */ |
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in index e406f750e..469004d5f 100644 --- a/archival/libunarchive/Makefile.in +++ b/archival/libunarchive/Makefile.in | |||
@@ -31,6 +31,7 @@ LIBUNARCHIVE-y:= \ | |||
31 | \ | 31 | \ |
32 | filter_accept_all.o \ | 32 | filter_accept_all.o \ |
33 | filter_accept_list.o \ | 33 | filter_accept_list.o \ |
34 | filter_accept_list_reassign.o \ | ||
34 | filter_accept_reject_list.o \ | 35 | filter_accept_reject_list.o \ |
35 | \ | 36 | \ |
36 | get_header_ar.o \ | 37 | get_header_ar.o \ |
diff --git a/archival/libunarchive/filter_accept_all.c b/archival/libunarchive/filter_accept_all.c index d7bccb5cd..baf9e4b71 100644 --- a/archival/libunarchive/filter_accept_all.c +++ b/archival/libunarchive/filter_accept_all.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "unarchive.h" | 22 | #include "unarchive.h" |
23 | 23 | ||
24 | /* Accept any non-null name, its not really a filter at all */ | 24 | /* Accept any non-null name, its not really a filter at all */ |
25 | extern char filter_accept_all(const archive_handle_t *archive_handle) | 25 | extern char filter_accept_all(archive_handle_t *archive_handle) |
26 | { | 26 | { |
27 | if (archive_handle->file_header->name) { | 27 | if (archive_handle->file_header->name) { |
28 | return(EXIT_SUCCESS); | 28 | return(EXIT_SUCCESS); |
diff --git a/archival/libunarchive/filter_accept_list.c b/archival/libunarchive/filter_accept_list.c index 5ff3ad2dd..e1c4827bf 100644 --- a/archival/libunarchive/filter_accept_list.c +++ b/archival/libunarchive/filter_accept_list.c | |||
@@ -24,7 +24,7 @@ | |||
24 | /* | 24 | /* |
25 | * Accept names that are in the accept list, ignoring reject list. | 25 | * Accept names that are in the accept list, ignoring reject list. |
26 | */ | 26 | */ |
27 | extern char filter_accept_list(const archive_handle_t *archive_handle) | 27 | extern char filter_accept_list(archive_handle_t *archive_handle) |
28 | { | 28 | { |
29 | if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) { | 29 | if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) { |
30 | return(EXIT_SUCCESS); | 30 | return(EXIT_SUCCESS); |
diff --git a/archival/libunarchive/filter_accept_reject_list.c b/archival/libunarchive/filter_accept_reject_list.c index 48e9ed8ea..657f7a0bd 100644 --- a/archival/libunarchive/filter_accept_reject_list.c +++ b/archival/libunarchive/filter_accept_reject_list.c | |||
@@ -24,7 +24,7 @@ | |||
24 | /* | 24 | /* |
25 | * Accept names that are in the accept list and not in the reject list | 25 | * Accept names that are in the accept list and not in the reject list |
26 | */ | 26 | */ |
27 | extern char filter_accept_reject_list(const archive_handle_t *archive_handle) | 27 | extern char filter_accept_reject_list(archive_handle_t *archive_handle) |
28 | { | 28 | { |
29 | const char *key = archive_handle->file_header->name; | 29 | const char *key = archive_handle->file_header->name; |
30 | const llist_t *accept_entry = find_list_entry(archive_handle->accept, key); | 30 | const llist_t *accept_entry = find_list_entry(archive_handle->accept, key); |
diff --git a/include/unarchive.h b/include/unarchive.h index a1010aae8..18bf089fb 100644 --- a/include/unarchive.h +++ b/include/unarchive.h | |||
@@ -28,7 +28,7 @@ typedef struct llist_s { | |||
28 | 28 | ||
29 | typedef struct archive_handle_s { | 29 | typedef struct archive_handle_s { |
30 | /* define if the header and data compenent should processed */ | 30 | /* define if the header and data compenent should processed */ |
31 | char (*filter)(const struct archive_handle_s *); | 31 | char (*filter)(struct archive_handle_s *); |
32 | const llist_t *accept; | 32 | const llist_t *accept; |
33 | const llist_t *reject; | 33 | const llist_t *reject; |
34 | const llist_t *passed; /* List of files that have successfully been worked on */ | 34 | const llist_t *passed; /* List of files that have successfully been worked on */ |
@@ -41,6 +41,8 @@ typedef struct archive_handle_s { | |||
41 | 41 | ||
42 | /* process the data componenet, e.g. extract to filesystem */ | 42 | /* process the data componenet, e.g. extract to filesystem */ |
43 | void (*action_data)(struct archive_handle_s *); | 43 | void (*action_data)(struct archive_handle_s *); |
44 | |||
45 | /* How to process any sub archive, e.g. get_header_tar_gz */ | ||
44 | char (*action_data_subarchive)(struct archive_handle_s *); | 46 | char (*action_data_subarchive)(struct archive_handle_s *); |
45 | 47 | ||
46 | /* Contains the handle to a sub archive */ | 48 | /* Contains the handle to a sub archive */ |
@@ -68,9 +70,10 @@ typedef struct archive_handle_s { | |||
68 | 70 | ||
69 | extern archive_handle_t *init_handle(void); | 71 | extern archive_handle_t *init_handle(void); |
70 | 72 | ||
71 | extern char filter_accept_all(const archive_handle_t *archive_handle); | 73 | extern char filter_accept_all(archive_handle_t *archive_handle); |
72 | extern char filter_accept_list(const archive_handle_t *archive_handle); | 74 | extern char filter_accept_list(archive_handle_t *archive_handle); |
73 | extern char filter_accept_reject_list(const archive_handle_t *archive_handle); | 75 | extern char filter_accept_list_reassign(archive_handle_t *archive_handle); |
76 | extern char filter_accept_reject_list(archive_handle_t *archive_handle); | ||
74 | 77 | ||
75 | extern void unpack_ar_archive(archive_handle_t *ar_archive); | 78 | extern void unpack_ar_archive(archive_handle_t *ar_archive); |
76 | 79 | ||