diff options
Diffstat (limited to 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/archival/tar.c b/archival/tar.c index d5fa954d2..a4b13b5de 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -615,14 +615,23 @@ static char get_header_tar_Z(archive_handle_t *archive_handle) | |||
615 | # define TAR_OPT_AFTER_BZIP2 TAR_OPT_AFTER_CREATE | 615 | # define TAR_OPT_AFTER_BZIP2 TAR_OPT_AFTER_CREATE |
616 | #endif | 616 | #endif |
617 | 617 | ||
618 | #define TAR_OPT_INCLUDE_FROM (1 << (TAR_OPT_AFTER_BZIP2)) | 618 | #define TAR_OPT_LZMA (1 << (TAR_OPT_AFTER_BZIP2)) |
619 | #define TAR_OPT_EXCLUDE_FROM (1 << (TAR_OPT_AFTER_BZIP2 + 1)) | 619 | #ifdef CONFIG_FEATURE_TAR_LZMA |
620 | # define TAR_OPT_STR_LZMA "a" | ||
621 | # define TAR_OPT_AFTER_LZMA TAR_OPT_AFTER_BZIP2 + 1 | ||
622 | #else | ||
623 | # define TAR_OPT_STR_LZMA "" | ||
624 | # define TAR_OPT_AFTER_LZMA TAR_OPT_AFTER_BZIP2 | ||
625 | #endif | ||
626 | |||
627 | #define TAR_OPT_INCLUDE_FROM (1 << (TAR_OPT_AFTER_LZMA)) | ||
628 | #define TAR_OPT_EXCLUDE_FROM (1 << (TAR_OPT_AFTER_LZMA + 1)) | ||
620 | #ifdef CONFIG_FEATURE_TAR_FROM | 629 | #ifdef CONFIG_FEATURE_TAR_FROM |
621 | # define TAR_OPT_STR_FROM "T:X:" | 630 | # define TAR_OPT_STR_FROM "T:X:" |
622 | # define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_BZIP2 + 2 | 631 | # define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_LZMA + 2 |
623 | #else | 632 | #else |
624 | # define TAR_OPT_STR_FROM "" | 633 | # define TAR_OPT_STR_FROM "" |
625 | # define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_BZIP2 | 634 | # define TAR_OPT_AFTER_FROM TAR_OPT_AFTER_LZMA |
626 | #endif | 635 | #endif |
627 | 636 | ||
628 | #define TAR_OPT_GZIP (1 << (TAR_OPT_AFTER_FROM)) | 637 | #define TAR_OPT_GZIP (1 << (TAR_OPT_AFTER_FROM)) |
@@ -651,6 +660,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle) | |||
651 | static const char tar_options[]="txC:f:Opvk" \ | 660 | static const char tar_options[]="txC:f:Opvk" \ |
652 | TAR_OPT_STR_CREATE \ | 661 | TAR_OPT_STR_CREATE \ |
653 | TAR_OPT_STR_BZIP2 \ | 662 | TAR_OPT_STR_BZIP2 \ |
663 | TAR_OPT_STR_LZMA \ | ||
654 | TAR_OPT_STR_FROM \ | 664 | TAR_OPT_STR_FROM \ |
655 | TAR_OPT_STR_GZIP \ | 665 | TAR_OPT_STR_GZIP \ |
656 | TAR_OPT_STR_COMPRESS \ | 666 | TAR_OPT_STR_COMPRESS \ |
@@ -675,6 +685,9 @@ static const struct option tar_long_options[] = { | |||
675 | # ifdef CONFIG_FEATURE_TAR_BZIP2 | 685 | # ifdef CONFIG_FEATURE_TAR_BZIP2 |
676 | { "bzip2", 0, NULL, 'j' }, | 686 | { "bzip2", 0, NULL, 'j' }, |
677 | # endif | 687 | # endif |
688 | # ifdef CONFIG_FEATURE_TAR_LZMA | ||
689 | { "lzma", 0, NULL, 'a' }, | ||
690 | # endif | ||
678 | # ifdef CONFIG_FEATURE_TAR_FROM | 691 | # ifdef CONFIG_FEATURE_TAR_FROM |
679 | { "files-from", 1, NULL, 'T' }, | 692 | { "files-from", 1, NULL, 'T' }, |
680 | { "exclude-from", 1, NULL, 'X' }, | 693 | { "exclude-from", 1, NULL, 'X' }, |
@@ -757,6 +770,9 @@ int tar_main(int argc, char **argv) | |||
757 | if (ENABLE_FEATURE_TAR_BZIP2 && (opt & TAR_OPT_BZIP2)) | 770 | if (ENABLE_FEATURE_TAR_BZIP2 && (opt & TAR_OPT_BZIP2)) |
758 | get_header_ptr = get_header_tar_bz2; | 771 | get_header_ptr = get_header_tar_bz2; |
759 | 772 | ||
773 | if (ENABLE_FEATURE_TAR_LZMA && (opt & TAR_OPT_LZMA)) | ||
774 | get_header_ptr = get_header_tar_lzma; | ||
775 | |||
760 | if (ENABLE_FEATURE_TAR_COMPRESS && (opt & TAR_OPT_UNCOMPRESS)) | 776 | if (ENABLE_FEATURE_TAR_COMPRESS && (opt & TAR_OPT_UNCOMPRESS)) |
761 | get_header_ptr = get_header_tar_Z; | 777 | get_header_ptr = get_header_tar_Z; |
762 | 778 | ||