/[magellan-source]/trunk/mkinitrd-magellan/busybox/archival/libunarchive/filter_accept_list_reassign.c |
Annotation of /trunk/mkinitrd-magellan/busybox/archival/libunarchive/filter_accept_list_reassign.c
Parent Directory | Revision Log
Revision 816 -
(hide annotations)
(download)
Fri Apr 24 18:33:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 1459 byte(s)
Fri Apr 24 18:33:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 1459 byte(s)
-updated to busybox-1.13.4
1 | niro | 532 | /* 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 | niro | 816 | /* Built and used only if ENABLE_DPKG || ENABLE_DPKG_DEB */ |
12 | |||
13 | niro | 532 | /* |
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 | niro | 816 | char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle) |
19 | niro | 532 | { |
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 | niro | 816 | /* Find extension */ |
25 | niro | 532 | name_ptr = strrchr(archive_handle->file_header->name, '.'); |
26 | niro | 816 | if (!name_ptr) |
27 | return EXIT_FAILURE; | ||
28 | name_ptr++; | ||
29 | niro | 532 | |
30 | /* Modify the subarchive handler based on the extension */ | ||
31 | niro | 816 | if (ENABLE_FEATURE_SEAMLESS_GZ |
32 | && strcmp(name_ptr, "gz") == 0 | ||
33 | ) { | ||
34 | niro | 532 | archive_handle->action_data_subarchive = get_header_tar_gz; |
35 | return EXIT_SUCCESS; | ||
36 | } | ||
37 | niro | 816 | if (ENABLE_FEATURE_SEAMLESS_BZ2 |
38 | && strcmp(name_ptr, "bz2") == 0 | ||
39 | ) { | ||
40 | niro | 532 | archive_handle->action_data_subarchive = get_header_tar_bz2; |
41 | return EXIT_SUCCESS; | ||
42 | } | ||
43 | niro | 816 | if (ENABLE_FEATURE_SEAMLESS_LZMA |
44 | && strcmp(name_ptr, "lzma") == 0 | ||
45 | ) { | ||
46 | niro | 532 | archive_handle->action_data_subarchive = get_header_tar_lzma; |
47 | return EXIT_SUCCESS; | ||
48 | } | ||
49 | } | ||
50 | return EXIT_FAILURE; | ||
51 | } |