aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/gzip/gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gzip/gzip.c')
-rw-r--r--src/cmd/gzip/gzip.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/gzip/gzip.c b/src/cmd/gzip/gzip.c
index 10954d3a..f37405b9 100644
--- a/src/cmd/gzip/gzip.c
+++ b/src/cmd/gzip/gzip.c
@@ -29,13 +29,29 @@ void
main(int argc, char *argv[])
{
int i, ok, stdout;
+ char **oargv;
+ oargv = argv;
level = 6;
stdout = 0;
ARGBEGIN{
case 'D':
debug++;
break;
+ case 'd':
+ /*
+ * gnu tar expects gzip -d to decompress
+ * humor it. ugh.
+ */
+ /* remove -d from command line - magic! */
+ if(strcmp(argv[0], "-d") == 0){
+ while(*argv++)
+ *(argv-1) = *argv;
+ }else
+ memmove(_args-1, _args, strlen(_args)+1);
+ exec("gunzip", oargv);
+ sysfatal("exec gunzip failed");
+ break;
case 'v':
verbose++;
break;