diff options
-rw-r--r-- | archival/tar.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/archival/tar.c b/archival/tar.c index 4f4a7d8f3..9ed3821d5 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -751,7 +751,7 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
751 | #endif | 751 | #endif |
752 | 752 | ||
753 | //usage:#define tar_trivial_usage | 753 | //usage:#define tar_trivial_usage |
754 | //usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt" | 754 | //usage: IF_FEATURE_TAR_CREATE("c|") "x|t [-" |
755 | //usage: IF_FEATURE_SEAMLESS_Z("Z") | 755 | //usage: IF_FEATURE_SEAMLESS_Z("Z") |
756 | //usage: IF_FEATURE_SEAMLESS_GZ("z") | 756 | //usage: IF_FEATURE_SEAMLESS_GZ("z") |
757 | //usage: IF_FEATURE_SEAMLESS_XZ("J") | 757 | //usage: IF_FEATURE_SEAMLESS_XZ("J") |
@@ -773,34 +773,34 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
773 | //usage: ) | 773 | //usage: ) |
774 | //usage: "\n x Extract" | 774 | //usage: "\n x Extract" |
775 | //usage: "\n t List" | 775 | //usage: "\n t List" |
776 | //usage: "\n f FILE Name of TARFILE ('-' for stdin/out)" | 776 | //usage: "\n -f FILE Name of TARFILE ('-' for stdin/out)" |
777 | //usage: "\n C DIR Change to DIR before operation" | 777 | //usage: "\n -C DIR Change to DIR before operation" |
778 | //usage: "\n v Verbose" | 778 | //usage: "\n -v Verbose" |
779 | //usage: IF_FEATURE_SEAMLESS_Z( | 779 | //usage: IF_FEATURE_SEAMLESS_Z( |
780 | //usage: "\n Z (De)compress using compress" | 780 | //usage: "\n -Z (De)compress using compress" |
781 | //usage: ) | 781 | //usage: ) |
782 | //usage: IF_FEATURE_SEAMLESS_GZ( | 782 | //usage: IF_FEATURE_SEAMLESS_GZ( |
783 | //usage: "\n z (De)compress using gzip" | 783 | //usage: "\n -z (De)compress using gzip" |
784 | //usage: ) | 784 | //usage: ) |
785 | //usage: IF_FEATURE_SEAMLESS_XZ( | 785 | //usage: IF_FEATURE_SEAMLESS_XZ( |
786 | //usage: "\n J (De)compress using xz" | 786 | //usage: "\n -J (De)compress using xz" |
787 | //usage: ) | 787 | //usage: ) |
788 | //usage: IF_FEATURE_SEAMLESS_BZ2( | 788 | //usage: IF_FEATURE_SEAMLESS_BZ2( |
789 | //usage: "\n j (De)compress using bzip2" | 789 | //usage: "\n -j (De)compress using bzip2" |
790 | //usage: ) | 790 | //usage: ) |
791 | //usage: IF_FEATURE_SEAMLESS_LZMA( | 791 | //usage: IF_FEATURE_SEAMLESS_LZMA( |
792 | //usage: "\n a (De)compress using lzma" | 792 | //usage: "\n -a (De)compress using lzma" |
793 | //usage: ) | 793 | //usage: ) |
794 | //usage: "\n O Extract to stdout" | 794 | //usage: "\n -O Extract to stdout" |
795 | //usage: IF_FEATURE_TAR_CREATE( | 795 | //usage: IF_FEATURE_TAR_CREATE( |
796 | //usage: "\n h Follow symlinks" | 796 | //usage: "\n -h Follow symlinks" |
797 | //usage: ) | 797 | //usage: ) |
798 | //usage: IF_FEATURE_TAR_NOPRESERVE_TIME( | 798 | //usage: IF_FEATURE_TAR_NOPRESERVE_TIME( |
799 | //usage: "\n m Don't restore mtime" | 799 | //usage: "\n -m Don't restore mtime" |
800 | //usage: ) | 800 | //usage: ) |
801 | //usage: IF_FEATURE_TAR_FROM( | 801 | //usage: IF_FEATURE_TAR_FROM( |
802 | //usage: "\n T FILE File with names to include" | 802 | //usage: "\n -T FILE File with names to include" |
803 | //usage: "\n X FILE File with glob patterns to exclude" | 803 | //usage: "\n -X FILE File with glob patterns to exclude" |
804 | //usage: IF_FEATURE_TAR_LONG_OPTIONS( | 804 | //usage: IF_FEATURE_TAR_LONG_OPTIONS( |
805 | //usage: "\n --exclude PATTERN Glob pattern to exclude" | 805 | //usage: "\n --exclude PATTERN Glob pattern to exclude" |
806 | //usage: ) | 806 | //usage: ) |
@@ -967,11 +967,12 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
967 | puts("tar (busybox) " BB_VER); | 967 | puts("tar (busybox) " BB_VER); |
968 | return 0; | 968 | return 0; |
969 | } | 969 | } |
970 | if (argv[1] && argv[1][0] != '-') { | 970 | #endif |
971 | if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') { | ||
971 | /* Compat: | 972 | /* Compat: |
972 | * 1st argument without dash handles options with parameters | 973 | * 1st argument without dash handles options with parameters |
973 | * differently from dashed one: it takes *next argv[i]* | 974 | * differently from dashed one: it takes *next argv[i]* |
974 | * as paramenter even if there are more chars in 1st argument: | 975 | * as parameter even if there are more chars in 1st argument: |
975 | * "tar fx TARFILE" - "x" is not taken as f's param | 976 | * "tar fx TARFILE" - "x" is not taken as f's param |
976 | * but is interpreted as -x option | 977 | * but is interpreted as -x option |
977 | * "tar -xf TARFILE" - dashed equivalent of the above | 978 | * "tar -xf TARFILE" - dashed equivalent of the above |
@@ -991,11 +992,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
991 | } | 992 | } |
992 | *f = 'f'; | 993 | *f = 'f'; |
993 | } | 994 | } |
994 | } | 995 | /* Prepend '-' to the first argument */ |
995 | #endif | ||
996 | /* Prepend '-' to the first argument if required */ | ||
997 | if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') | ||
998 | argv[1] = xasprintf("-%s", argv[1]); | 996 | argv[1] = xasprintf("-%s", argv[1]); |
997 | } | ||
999 | opt = GETOPT32(argv, "^" | 998 | opt = GETOPT32(argv, "^" |
1000 | "txC:f:Oopvk" | 999 | "txC:f:Oopvk" |
1001 | IF_FEATURE_TAR_CREATE( "ch" ) | 1000 | IF_FEATURE_TAR_CREATE( "ch" ) |