tar: support -f - for stdin/out
This commit is contained in:
parent
b107489bf2
commit
e13f571d11
3
tar.1
3
tar.1
@ -32,7 +32,8 @@ before beginning.
|
|||||||
.It Fl f Ar file
|
.It Fl f Ar file
|
||||||
Set
|
Set
|
||||||
.Ar file
|
.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
|
.It Fl m
|
||||||
Do not preserve modification time.
|
Do not preserve modification time.
|
||||||
.It Fl t
|
.It Fl t
|
||||||
|
4
tar.c
4
tar.c
@ -550,7 +550,7 @@ main(int argc, char *argv[])
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'c':
|
case 'c':
|
||||||
tarfd = 1;
|
tarfd = 1;
|
||||||
if (file) {
|
if (file && *file != '-') {
|
||||||
tarfd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
tarfd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||||
if (tarfd < 0)
|
if (tarfd < 0)
|
||||||
eprintf("open %s:", file);
|
eprintf("open %s:", file);
|
||||||
@ -571,7 +571,7 @@ main(int argc, char *argv[])
|
|||||||
case 't':
|
case 't':
|
||||||
case 'x':
|
case 'x':
|
||||||
tarfd = 0;
|
tarfd = 0;
|
||||||
if (file) {
|
if (file && *file != '-') {
|
||||||
tarfd = open(file, O_RDONLY);
|
tarfd = open(file, O_RDONLY);
|
||||||
if (tarfd < 0)
|
if (tarfd < 0)
|
||||||
eprintf("open %s:", file);
|
eprintf("open %s:", file);
|
||||||
|
Loading…
Reference in New Issue
Block a user