/[magellan-source]/trunk/mkinitrd-magellan/busybox/archival/libunarchive/filter_accept_list_reassign.c |
Contents of /trunk/mkinitrd-magellan/busybox/archival/libunarchive/filter_accept_list_reassign.c
Parent Directory | Revision Log
Revision 984 -
(show annotations)
(download)
Sun May 30 11:32:42 2010 UTC (14 years, 3 months ago) by niro
File MIME type: text/plain
File size: 1477 byte(s)
Sun May 30 11:32:42 2010 UTC (14 years, 3 months ago) by niro
File MIME type: text/plain
File size: 1477 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 | /* vi: set sw=4 ts=4: */ |
2 | /* |
3 | * Copyright (C) 2002 by Glenn McGrath |
4 | * |
5 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
6 | */ |
7 | |
8 | #include "libbb.h" |
9 | #include "unarchive.h" |
10 | |
11 | /* Built and used only if ENABLE_DPKG || ENABLE_DPKG_DEB */ |
12 | |
13 | /* |
14 | * Reassign the subarchive metadata parser based on the filename extension |
15 | * e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz |
16 | * or if its a .tar.bz2 make archive_handle->sub_archive handle that |
17 | */ |
18 | char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle) |
19 | { |
20 | /* Check the file entry is in the accept list */ |
21 | if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) { |
22 | const char *name_ptr; |
23 | |
24 | /* Find extension */ |
25 | name_ptr = strrchr(archive_handle->file_header->name, '.'); |
26 | if (!name_ptr) |
27 | return EXIT_FAILURE; |
28 | name_ptr++; |
29 | |
30 | /* Modify the subarchive handler based on the extension */ |
31 | if (ENABLE_FEATURE_SEAMLESS_GZ |
32 | && strcmp(name_ptr, "gz") == 0 |
33 | ) { |
34 | archive_handle->dpkg__action_data_subarchive = get_header_tar_gz; |
35 | return EXIT_SUCCESS; |
36 | } |
37 | if (ENABLE_FEATURE_SEAMLESS_BZ2 |
38 | && strcmp(name_ptr, "bz2") == 0 |
39 | ) { |
40 | archive_handle->dpkg__action_data_subarchive = get_header_tar_bz2; |
41 | return EXIT_SUCCESS; |
42 | } |
43 | if (ENABLE_FEATURE_SEAMLESS_LZMA |
44 | && strcmp(name_ptr, "lzma") == 0 |
45 | ) { |
46 | archive_handle->dpkg__action_data_subarchive = get_header_tar_lzma; |
47 | return EXIT_SUCCESS; |
48 | } |
49 | } |
50 | return EXIT_FAILURE; |
51 | } |