From 7ce6c7936556ae451e5ba9651d4ac255611dc53c Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 31 Jan 2010 21:56:52 -0500 Subject: [PATCH] Support "-" (stdio) for the TAPE environment variable. On MacOS, set "-" as the default device, since there is no tape support. SVN-Revision: 1848 --- tar/bsdtar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); -- 2.47.3