From: Tim Kientzle Date: Mon, 1 Feb 2010 02:56:52 +0000 (-0500) Subject: Support "-" (stdio) for the TAPE environment variable. X-Git-Tag: v3.0.0a~1300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ce6c7936556ae451e5ba9651d4ac255611dc53c;p=thirdparty%2Flibarchive.git Support "-" (stdio) for the TAPE environment variable. On MacOS, set "-" as the default device, since there is no tape support. SVN-Revision: 1848 --- diff --git a/tar/bsdtar.c b/tar/bsdtar.c index d8f828684..39ff453be 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -80,6 +80,9 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.93 2008/11/08 04:43:24 kientzle #if defined(_WIN32) && !defined(__CYGWIN__) #define _PATH_DEFTAPE "\\\\.\\tape0" #endif +#if defined(__APPLE__) +#define _PATH_DEFTAPE "-" /* Mac OS has no tape support, default to stdio. */ +#endif #ifndef _PATH_DEFTAPE #define _PATH_DEFTAPE "/dev/tape" @@ -268,8 +271,6 @@ main(int argc, char **argv) break; case 'f': /* SUSv2 */ bsdtar->filename = bsdtar->optarg; - if (strcmp(bsdtar->filename, "-") == 0) - bsdtar->filename = NULL; break; case 'H': /* BSD convention */ bsdtar->symlink_mode = 'H'; @@ -597,6 +598,10 @@ main(int argc, char **argv) if (bsdtar->strip_components != 0) only_mode(bsdtar, "--strip-components", "xt"); + /* Filename "-" implies stdio. */ + if (strcmp(bsdtar->filename, "-") == 0) + bsdtar->filename = NULL; + switch(bsdtar->mode) { case 'c': tar_mode_c(bsdtar);