aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-29 02:43:23 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-29 02:43:23 +0000
commitc450379ff02edbda5fc6225b8c96634c47c35ce0 (patch)
treea471c76d9a1e7fc9297386b807796f9fc0730a4c
parent10f6fb1d4662bc7f460d73a210399d67402ab857 (diff)
downloadbusybox-w32-c450379ff02edbda5fc6225b8c96634c47c35ce0.tar.gz
busybox-w32-c450379ff02edbda5fc6225b8c96634c47c35ce0.tar.bz2
busybox-w32-c450379ff02edbda5fc6225b8c96634c47c35ce0.zip
tar: remove bogus check for "-" (we handle it corrently later)
tar: simplify argv handling function old new delta tar_main 772 722 -50
-rw-r--r--archival/tar.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 0aa216c39..be59f0441 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -802,7 +802,7 @@ static const char tar_longopts[] ALIGN1 =
802#endif 802#endif
803 803
804int tar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 804int tar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
805int tar_main(int argc, char **argv) 805int tar_main(int argc ATTRIBUTE_UNUSED, char **argv)
806{ 806{
807 char (*get_header_ptr)(archive_handle_t *) = get_header_tar; 807 char (*get_header_ptr)(archive_handle_t *) = get_header_tar;
808 archive_handle_t *tar_handle; 808 archive_handle_t *tar_handle;
@@ -852,6 +852,7 @@ int tar_main(int argc, char **argv)
852 , &verboseFlag // combined count for -t and -v 852 , &verboseFlag // combined count for -t and -v
853 , &verboseFlag // combined count for -t and -v 853 , &verboseFlag // combined count for -t and -v
854 ); 854 );
855 argv += optind;
855 856
856 if (verboseFlag) tar_handle->action_header = header_verbose_list; 857 if (verboseFlag) tar_handle->action_header = header_verbose_list;
857 if (verboseFlag == 1) tar_handle->action_header = header_list; 858 if (verboseFlag == 1) tar_handle->action_header = header_list;
@@ -897,21 +898,15 @@ int tar_main(int argc, char **argv)
897 tar_handle->accept = append_file_list_to_list(tar_handle->accept); 898 tar_handle->accept = append_file_list_to_list(tar_handle->accept);
898#endif 899#endif
899 900
900 /* Check if we are reading from stdin */
901 if (argv[optind] && *argv[optind] == '-') {
902 /* Default is to read from stdin, so just skip to next arg */
903 optind++;
904 }
905
906 /* Setup an array of filenames to work with */ 901 /* Setup an array of filenames to work with */
907 /* TODO: This is the same as in ar, separate function ? */ 902 /* TODO: This is the same as in ar, separate function ? */
908 while (optind < argc) { 903 while (*argv) {
909 /* kill trailing '/' unless the string is just "/" */ 904 /* kill trailing '/' unless the string is just "/" */
910 char *cp = last_char_is(argv[optind], '/'); 905 char *cp = last_char_is(*argv, '/');
911 if (cp > argv[optind]) 906 if (cp > *argv)
912 *cp = '\0'; 907 *cp = '\0';
913 llist_add_to_end(&tar_handle->accept, argv[optind]); 908 llist_add_to_end(&tar_handle->accept, *argv);
914 optind++; 909 argv++;
915 } 910 }
916 911
917 if (tar_handle->accept || tar_handle->reject) 912 if (tar_handle->accept || tar_handle->reject)