sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit e13f571d119cdd6fedef3f748a264bb143cecc70
parent b107489bf2cda579ca53551206270b9eee80c059
Author: Eivind Uggedal <eivind@uggedal.com>
Date:   Mon Feb 15 09:48:32 +0000

tar: support -f - for stdin/out

Diffstat:
tar.1 | 3++-
tar.c | 4++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tar.1 b/tar.1 @@ -32,7 +32,8 @@ 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. If '-', +stdin | stdout is used. .It Fl m Do not preserve modification time. .It Fl t diff --git a/tar.c b/tar.c @@ -550,7 +550,7 @@ main(int argc, char *argv[]) switch (mode) { case 'c': tarfd = 1; - if (file) { + if (file && *file != '-') { tarfd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0644); if (tarfd < 0) eprintf("open %s:", file); @@ -571,7 +571,7 @@ main(int argc, char *argv[]) case 't': case 'x': tarfd = 0; - if (file) { + if (file && *file != '-') { tarfd = open(file, O_RDONLY); if (tarfd < 0) eprintf("open %s:", file);