diff options
author | Matt Kraai | 2000-09-15 22:47:34 +0000 |
---|---|---|
committer | Matt Kraai | 2000-09-15 22:47:34 +0000 |
commit | b2f36af1573f6599f1cd35edfd44c1c2d6048faf (patch) | |
tree | 4d3ef37ee5927dde91485605a568faeb58b681df /tar.c | |
parent | 6fc2a7d04da066f40ad91e3a11b6418e76181f86 (diff) | |
download | busybox-b2f36af1573f6599f1cd35edfd44c1c2d6048faf.zip busybox-b2f36af1573f6599f1cd35edfd44c1c2d6048faf.tar.gz |
Updated stdin/stdout treatment to match that of gnu tar.
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -133,8 +133,8 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, #ifdef BB_FEATURE_TAR_CREATE /* Local procedures to save files into a tar file. */ -static int writeTarFile(const char* tarName, int tostdoutFlag, - int verboseFlag, int argc, char **argv, char** excludeList); +static int writeTarFile(const char* tarName, int verboseFlag, int argc, + char **argv, char** excludeList); #endif static struct option longopts[] = @@ -185,14 +185,11 @@ extern int tar_main(int argc, char **argv) break; case 'O': tostdoutFlag = TRUE; - tarName = "-"; break; case 'f': if (*tarName != '-') fatalError( "Only one 'f' option allowed\n"); tarName = optarg; - if (!strcmp(tarName, "-") && createFlag == TRUE) - tostdoutFlag = TRUE; break; #if defined BB_FEATURE_TAR_EXCLUDE case 'e': @@ -218,7 +215,7 @@ extern int tar_main(int argc, char **argv) #ifndef BB_FEATURE_TAR_CREATE fatalError( "This version of tar was not compiled with tar creation support.\n"); #else - exit(writeTarFile(tarName, tostdoutFlag, verboseFlag, argc-optind, &argv[optind], excludeList)); + exit(writeTarFile(tarName, verboseFlag, argc-optind, &argv[optind], excludeList)); #endif } if (listFlag == TRUE || extractFlag == TRUE) { @@ -922,8 +919,8 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* return( TRUE); } -static int writeTarFile(const char* tarName, int tostdoutFlag, - int verboseFlag, int argc, char **argv, char** excludeList) +static int writeTarFile(const char* tarName, int verboseFlag, int argc, + char **argv, char** excludeList) { int tarFd=-1; int errorFlag=FALSE; @@ -936,7 +933,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, fatalError("Cowardly refusing to create an empty archive\n"); /* Open the tar file for writing. */ - if (tostdoutFlag == TRUE) + if (strcmp(tarName, "-") == 0) tbInfo.tarFd = fileno(stdout); else tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |