aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/bzip2
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-04-19 05:54:21 +0000
committerrsc <devnull@localhost>2004-04-19 05:54:21 +0000
commit892de7987409ccd209dd4f43fb7717408d4a04bd (patch)
tree9304c5df084b72d43fdbd284cf490630c6c406b0 /src/cmd/bzip2
parent6b53e2a4d0d41305efa4b8b0800d119a13478ded (diff)
downloadplan9port-892de7987409ccd209dd4f43fb7717408d4a04bd.tar.gz
plan9port-892de7987409ccd209dd4f43fb7717408d4a04bd.tar.bz2
plan9port-892de7987409ccd209dd4f43fb7717408d4a04bd.zip
various little bug fixes
Diffstat (limited to 'src/cmd/bzip2')
-rw-r--r--src/cmd/bzip2/bzip2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/bzip2/bzip2.c b/src/cmd/bzip2/bzip2.c
index 17c2d06d..e7ac9953 100644
--- a/src/cmd/bzip2/bzip2.c
+++ b/src/cmd/bzip2/bzip2.c
@@ -23,7 +23,9 @@ void
main(int argc, char **argv)
{
int i, ok, stdout;
+ char **oargv;
+ oargv = argv;
level = 6;
stdout = 0;
ARGBEGIN{
@@ -36,6 +38,20 @@ main(int argc, char **argv)
case 'c':
stdout++;
break;
+ case 'd':
+ /*
+ * gnu tar expects bzip2 -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("bunzip2", oargv);
+ sysfatal("exec bunzip2 failed");
+ break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
level = ARGC() - '0';