summaryrefslogtreecommitdiffstats
path: root/lib/libz
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1998-09-29 04:56:30 +0000
committerjkh <jkh@FreeBSD.org>1998-09-29 04:56:30 +0000
commit22e2b9966d9e3d050a612b18b725f6f1490bfe23 (patch)
tree9144868e45d9177886223dc8fc1c2570c333590c /lib/libz
parent374c9167d6576d2a55274925e5c0be9a856be836 (diff)
downloadFreeBSD-src-22e2b9966d9e3d050a612b18b725f6f1490bfe23.zip
FreeBSD-src-22e2b9966d9e3d050a612b18b725f6f1490bfe23.tar.gz
Allow minigzip to be invoked more like gzip, checking to see
if we're being called as gunzip as well as dealing with the -c flag. Submitted by: jhay
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/minigzip.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/libz/minigzip.c b/lib/libz/minigzip.c
index 7ba1666..487632e 100644
--- a/lib/libz/minigzip.c
+++ b/lib/libz/minigzip.c
@@ -270,15 +270,25 @@ int main(argc, argv)
{
int uncompr = 0;
gzFile file;
- char outmode[20];
+ char *bname, outmode[20];
strcpy(outmode, "wb6 ");
prog = argv[0];
+ bname = strrchr(argv[0], '/');
+ if (bname)
+ bname++;
+ else
+ bname = argv[0];
argc--, argv++;
+ if (!strcmp(bname, "gunzip") || !strcmp(bname, "zcat"))
+ uncompr = 1;
+
while (argc > 0) {
- if (strcmp(*argv, "-d") == 0)
+ if (strcmp(*argv, "-c") == 0)
+ ; /* Just for compatability with gzip */
+ else if (strcmp(*argv, "-d") == 0)
uncompr = 1;
else if (strcmp(*argv, "-f") == 0)
outmode[3] = 'f';
OpenPOWER on IntegriCloud