aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-10-25 02:13:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-25 02:13:32 +0200
commit30f3c1d5fdf8999491a01cb3fe8be8a40da52a75 (patch)
tree0b618243b796f4b5548c68b774e17fa71e0a208e
parentf645037ffb156dbca22296c1453f0b45383ff8ce (diff)
downloadbusybox-w32-30f3c1d5fdf8999491a01cb3fe8be8a40da52a75.tar.gz
busybox-w32-30f3c1d5fdf8999491a01cb3fe8be8a40da52a75.tar.bz2
busybox-w32-30f3c1d5fdf8999491a01cb3fe8be8a40da52a75.zip
tar: add support for -o as synonym to --no-same-owner. +5 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/tar.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 3c0ceb70d..450402d3c 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -727,7 +727,7 @@ static void handle_SIGCHLD(int status)
727#endif 727#endif
728 728
729enum { 729enum {
730 OPTBIT_KEEP_OLD = 7, 730 OPTBIT_KEEP_OLD = 8,
731 IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,) 731 IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,)
732 IF_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,) 732 IF_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,)
733 IF_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,) 733 IF_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,)
@@ -735,7 +735,7 @@ enum {
735 IF_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,) 735 IF_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
736 IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,) 736 IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
737 IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,) 737 IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
738 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) /* 15th bit */ 738 IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) // 16th bit
739 OPTBIT_NUMERIC_OWNER, 739 OPTBIT_NUMERIC_OWNER,
740 OPTBIT_NOPRESERVE_OWNER, 740 OPTBIT_NOPRESERVE_OWNER,
741 OPTBIT_NOPRESERVE_PERM, 741 OPTBIT_NOPRESERVE_PERM,
@@ -744,9 +744,10 @@ enum {
744 OPT_BASEDIR = 1 << 2, // C 744 OPT_BASEDIR = 1 << 2, // C
745 OPT_TARNAME = 1 << 3, // f 745 OPT_TARNAME = 1 << 3, // f
746 OPT_2STDOUT = 1 << 4, // O 746 OPT_2STDOUT = 1 << 4, // O
747 OPT_P = 1 << 5, // p 747 OPT_NOPRESERVE_OWNER = 1 << 5, // no-same-owner
748 OPT_VERBOSE = 1 << 6, // v 748 OPT_P = 1 << 6, // p
749 OPT_KEEP_OLD = 1 << 7, // k 749 OPT_VERBOSE = 1 << 7, // v
750 OPT_KEEP_OLD = 1 << 8, // k
750 OPT_CREATE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c 751 OPT_CREATE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c
751 OPT_DEREFERENCE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h 752 OPT_DEREFERENCE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h
752 OPT_BZIP2 = IF_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j 753 OPT_BZIP2 = IF_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j
@@ -756,7 +757,6 @@ enum {
756 OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z 757 OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
757 OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z 758 OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
758 OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER, 759 OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER,
759 OPT_NOPRESERVE_OWNER = 1 << OPTBIT_NOPRESERVE_OWNER , // no-same-owner
760 OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions 760 OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
761}; 761};
762#if ENABLE_FEATURE_TAR_LONG_OPTIONS 762#if ENABLE_FEATURE_TAR_LONG_OPTIONS
@@ -766,6 +766,10 @@ static const char tar_longopts[] ALIGN1 =
766 "directory\0" Required_argument "C" 766 "directory\0" Required_argument "C"
767 "file\0" Required_argument "f" 767 "file\0" Required_argument "f"
768 "to-stdout\0" No_argument "O" 768 "to-stdout\0" No_argument "O"
769 /* do not restore owner */
770 /* Note: GNU tar handles 'o' as no-same-owner only on extract,
771 * on create, 'o' is --old-archive. We do not support --old-archive. */
772 "no-same-owner\0" No_argument "o"
769 "same-permissions\0" No_argument "p" 773 "same-permissions\0" No_argument "p"
770 "verbose\0" No_argument "v" 774 "verbose\0" No_argument "v"
771 "keep-old\0" No_argument "k" 775 "keep-old\0" No_argument "k"
@@ -790,9 +794,7 @@ static const char tar_longopts[] ALIGN1 =
790 "compress\0" No_argument "Z" 794 "compress\0" No_argument "Z"
791# endif 795# endif
792 /* use numeric uid/gid from tar header, not textual */ 796 /* use numeric uid/gid from tar header, not textual */
793 "numeric-owner\0" No_argument "\xfc" 797 "numeric-owner\0" No_argument "\xfd"
794 /* do not restore owner */
795 "no-same-owner\0" No_argument "\xfd"
796 /* do not restore mode */ 798 /* do not restore mode */
797 "no-same-permissions\0" No_argument "\xfe" 799 "no-same-permissions\0" No_argument "\xfe"
798 /* --exclude takes next bit position in option mask, */ 800 /* --exclude takes next bit position in option mask, */
@@ -869,7 +871,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
869 } 871 }
870#endif 872#endif
871 opt = getopt32(argv, 873 opt = getopt32(argv,
872 "txC:f:Opvk" 874 "txC:f:Oopvk"
873 IF_FEATURE_TAR_CREATE( "ch" ) 875 IF_FEATURE_TAR_CREATE( "ch" )
874 IF_FEATURE_SEAMLESS_BZ2( "j" ) 876 IF_FEATURE_SEAMLESS_BZ2( "j" )
875 IF_FEATURE_SEAMLESS_LZMA("a" ) 877 IF_FEATURE_SEAMLESS_LZMA("a" )