Err.
Index: extern.h
===================================================================
RCS file: /home/cvs/src/bin/pax/extern.h,v
retrieving revision 1.60
diff -u -p -r1.60 extern.h
--- extern.h 23 Mar 2020 20:04:19 -0000 1.60
+++ extern.h 27 May 2022 00:30:36 -0000
@@ -284,7 +284,7 @@ u_int st_hash(const char *, int, int);
/*
* tar.c
*/
-extern int tar_nodir;
+extern int tar_nodir, write_stdout;
extern char *gnu_name_string, *gnu_link_string;
int tar_endwr(void);
off_t tar_endrd(void);
Index: file_subs.c
===================================================================
RCS file: /home/cvs/src/bin/pax/file_subs.c,v
retrieving revision 1.55
diff -u -p -r1.55 file_subs.c
--- file_subs.c 23 Mar 2020 20:04:19 -0000 1.55
+++ file_subs.c 27 May 2022 00:26:39 -0000
@@ -68,6 +68,9 @@ file_creat(ARCHD *arcn)
mode_t file_mode;
int oerrno;
+ if (write_stdout)
+ return 1;
+
/*
* Assume file doesn't exist, so just try to create it, most times this
* works. We have to take special handling when the file does exist. To
@@ -940,7 +943,7 @@ file_write(int fd, char *str, int cnt, i
wcnt = MINIMUM(cnt, *rem);
cnt -= wcnt;
*rem -= wcnt;
- if (*isempt) {
+ if (*isempt && !write_stdout) {
/*
* have not written to this block yet, so we keep
* looking for zero's
Index: options.c
===================================================================
RCS file: /home/cvs/src/bin/pax/options.c,v
retrieving revision 1.103
diff -u -p -r1.103 options.c
--- options.c 15 Nov 2019 20:34:17 -0000 1.103
+++ options.c 28 May 2022 00:04:39 -0000
@@ -780,6 +780,8 @@ tar_options(int argc, char **argv)
pmtime = 0;
break;
case 'O':
+ /* extract to stdout, or write old style archives */
+ write_stdout = 1;
Oflag = 1;
break;
case 'o':
Index: tar.1
===================================================================
RCS file: /home/cvs/src/bin/pax/tar.1,v
retrieving revision 1.64
diff -u -p -r1.64 tar.1
--- tar.1 31 Mar 2022 17:27:14 -0000 1.64
+++ tar.1 28 May 2022 00:03:16 -0000
@@ -176,7 +176,8 @@ Do not preserve modification time.
Use only the numeric UID and GID values when creating or extracting an
archive.
.It Fl O
-Write old-style (non-POSIX) archives.
+When creating, write old-style (non-POSIX) archives.
+When extracting, write files to stdout.
.It Fl o
Don't write directory information that the older (V7) style
.Nm
Index: tar.c
===================================================================
RCS file: /home/cvs/src/bin/pax/tar.c,v
retrieving revision 1.70
diff -u -p -r1.70 tar.c
--- tar.c 1 Mar 2022 21:19:11 -0000 1.70
+++ tar.c 27 May 2022 00:34:06 -0000
@@ -73,6 +73,7 @@ static gid_t gid_warn;
*/
int tar_nodir; /* do not write dirs under old tar */
+int write_stdout; /* extract files to stdout */
char *gnu_name_string; /* GNU ././@LongLink hackery name */
char *gnu_link_string; /* GNU ././@LongLink hackery link */