summaryrefslogtreecommitdiff
path: root/bin/pax/ar_io.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-10-27 00:29:41 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-10-27 00:29:41 +0000
commit43d84cd39f18592ff97483d238a852c5b6c9634c (patch)
tree8c0ca28a07ca74c7c83a2c6151c3474ec5667cc8 /bin/pax/ar_io.c
parentaf71ca755f8c45d88e7df376bf2fc7fa446ff8ec (diff)
-z can now list/extra compressed files too. Uses new gz_iszipped() function.
Diffstat (limited to 'bin/pax/ar_io.c')
-rw-r--r--bin/pax/ar_io.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 2bc617ab3c7..5dff4b18752 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar_io.c,v 1.5 1996/09/22 20:09:53 tholo Exp $ */
+/* $OpenBSD: ar_io.c,v 1.6 1996/10/27 00:29:40 millert Exp $ */
/* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: ar_io.c,v 1.5 1996/09/22 20:09:53 tholo Exp $";
+static char rcsid[] = "$OpenBSD: ar_io.c,v 1.6 1996/10/27 00:29:40 millert Exp $";
#endif
#endif /* not lint */
@@ -137,9 +137,14 @@ ar_open(name)
arcname = STDN;
} else if ((arfd = open(name, EXT_MODE, DMOD)) < 0)
syswarn(0, errno, "Failed open to read on %s", name);
- if (zflag == GZIP_CMP)
+ if (zflag == GZIP_CMP) {
gzf = gzdopen(arfd, "r");
- else if (zflag == COMPRESS_CMP)
+ if (!gz_iszipped(gzf)) {
+ (void)lseek(arfd, 0, SEEK_SET);
+ zflag = COMPRESS_CMP;
+ }
+ }
+ if (zflag == COMPRESS_CMP)
cfp = zdopen(arfd, "r");
break;
case ARCHIVE: