[dev] [sbase] [PATCH] tar: support -f - as stdin/out

From: Eivind Uggedal <eivind_AT_uggedal.com>
Date: Tue, 12 May 2015 12:22:35 +0000

---
 tar.1 | 4 +++-
 tar.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tar.1 b/tar.1
index 6341e17da4d0..ff6578b56d5c 100644
--- a/tar.1
+++ b/tar.1
_AT_@ -32,7 +32,9 @@ before beginning.
 .It Fl f Ar file
 Set
 .Ar file
-as input | output archive instead of stdin | stdout.
+as input | output archive instead of stdin | stdout. The -
+.Ar file
+is interpreted as stdin | stdout.
 .It Fl m
 Do not preserve modification time.
 .It Fl t
diff --git a/tar.c b/tar.c
index 8dbce22cc501..488beec605d5 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -510,6 +510,8 @@ main(int argc, char *argv[])
 		break;
 	case 'f':
 		file = EARGF(usage());
+		if (file[0] == '-')
+			file = NULL;
 		break;
 	case 'm':
 		mflag = 1;
-- 
2.4.0
Received on Tue May 12 2015 - 14:22:35 CEST

This archive was generated by hypermail 2.3.0 : Tue May 12 2015 - 14:24:08 CEST