38 |
#define AR_OPT_INSERT 0x40 |
#define AR_OPT_INSERT 0x40 |
39 |
|
|
40 |
int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
41 |
int ar_main(int argc, char **argv) |
int ar_main(int argc UNUSED_PARAM, char **argv) |
42 |
{ |
{ |
43 |
static const char msg_unsupported_err[] ALIGN1 = |
static const char msg_unsupported_err[] ALIGN1 = |
44 |
"archive %s is not supported"; |
"archive %s is not supported"; |
51 |
/* Prepend '-' to the first argument if required */ |
/* Prepend '-' to the first argument if required */ |
52 |
opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt"; |
opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt"; |
53 |
opt = getopt32(argv, "ptxovcr"); |
opt = getopt32(argv, "ptxovcr"); |
54 |
|
argv += optind; |
55 |
|
|
56 |
if (opt & AR_CTX_PRINT) { |
if (opt & AR_CTX_PRINT) { |
57 |
archive_handle->action_data = data_extract_to_stdout; |
archive_handle->action_data = data_extract_to_stdout; |
63 |
archive_handle->action_data = data_extract_all; |
archive_handle->action_data = data_extract_all; |
64 |
} |
} |
65 |
if (opt & AR_OPT_PRESERVE_DATE) { |
if (opt & AR_OPT_PRESERVE_DATE) { |
66 |
archive_handle->ah_flags |= ARCHIVE_PRESERVE_DATE; |
archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; |
67 |
} |
} |
68 |
if (opt & AR_OPT_VERBOSE) { |
if (opt & AR_OPT_VERBOSE) { |
69 |
archive_handle->action_header = header_verbose_list_ar; |
archive_handle->action_header = header_verbose_list_ar; |
75 |
bb_error_msg_and_die(msg_unsupported_err, "insertion"); |
bb_error_msg_and_die(msg_unsupported_err, "insertion"); |
76 |
} |
} |
77 |
|
|
78 |
archive_handle->src_fd = xopen(argv[optind++], O_RDONLY); |
archive_handle->src_fd = xopen(*argv++, O_RDONLY); |
79 |
|
|
80 |
while (optind < argc) { |
while (*argv) { |
81 |
archive_handle->filter = filter_accept_list; |
archive_handle->filter = filter_accept_list; |
82 |
llist_add_to(&(archive_handle->accept), argv[optind++]); |
llist_add_to(&archive_handle->accept, *argv++); |
83 |
} |
} |
84 |
|
|
85 |
unpack_ar_archive(archive_handle); |
unpack_ar_archive(archive_handle); |