# HG changeset patch
# User Philip Nienhuis <prnienhuis@users.sf.net>
# Date 1435868721 -7200
#      Thu Jul 02 22:25:21 2015 +0200
# Branch stable
# Node ID 1e6607bce2aee64e9a8c23eaa279da2155302cfd
# Parent  2fc43288a6c48b8c02fa1ddcaf1d82249408dc7c
Reorganize code in unarchive functions (bug #45331)
* bunzip2.m, gunzip.m: remove if block, move code to unpack.m,
                       remove default [] for 2nd argument

diff -r 2fc43288a6c4 -r 1e6607bce2ae scripts/miscellaneous/bunzip2.m
--- a/scripts/miscellaneous/bunzip2.m	Wed Jul 01 14:14:49 2015 -0700
+++ b/scripts/miscellaneous/bunzip2.m	Thu Jul 02 22:25:21 2015 +0200
@@ -30,16 +30,12 @@
 
 ## Author: Bill Denney <denney@seas.upenn.edu>
 
-function filelist = bunzip2 (bzfile, dir = [])
+function filelist = bunzip2 (bzfile, dir)
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
   endif
 
-  if (isempty (dir))
-    dir = fileparts (bzfile);
-  endif
-
   if (nargout > 0)
     filelist = unpack (bzfile, dir, "bunzip2");
   else
diff -r 2fc43288a6c4 -r 1e6607bce2ae scripts/miscellaneous/gunzip.m
--- a/scripts/miscellaneous/gunzip.m	Wed Jul 01 14:14:49 2015 -0700
+++ b/scripts/miscellaneous/gunzip.m	Thu Jul 02 22:25:21 2015 +0200
@@ -33,16 +33,12 @@
 
 ## Author: Bill Denney <denney@seas.upenn.edu>
 
-function filelist = gunzip (gzfile, dir = [])
+function filelist = gunzip (gzfile, dir)
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
   endif
 
-  if (isempty (dir))
-    dir = fileparts (gzfile);
-  endif
-
   if (nargout > 0)
     filelist = unpack (gzfile, dir, "gunzip");
   else
diff -r 2fc43288a6c4 -r 1e6607bce2ae scripts/miscellaneous/unpack.m
--- a/scripts/miscellaneous/unpack.m	Wed Jul 01 14:14:49 2015 -0700
+++ b/scripts/miscellaneous/unpack.m	Thu Jul 02 22:25:21 2015 +0200
@@ -147,7 +147,7 @@
   file = make_absolute_filename (file);
 
   if (isempty (dir))
-    dir = ".";
+    dir = fileparts (file);
   else
     dir = tilde_expand (dir);
   endif
