help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gunzip incompatible


From: Muthiah Annamalai
Subject: Re: gunzip incompatible
Date: Mon, 28 Jan 2008 03:45:51 -0600
User-agent: Thunderbird 2.0.0.6 (X11/20071022)

John W. Eaton wrote:
On 28-Jan-2008, Muthiah Annamalai wrote:

| No I think you could change 'unpack.m' and allow a 4th argument that can | be used
| as a fallback.

It wouldn't really be a fallback method, since it would force a
particular method instead of trying to guess then falling back on some
other method if the guess failed.

Also, looking at unpack, it seems that it is already set up to have
the third argument be the filetype (method to use) but that it is not
being used appropriately.  So I think fixing this just a matter of a
small patch to unpack.

jwe


I think this change makes something like what you say, but it doesnt handle tar.gz, tar.bz, tar.bz2. I am not attaching a changelog, as I expect further improvement.

Index: unpack.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/unpack.m,v
retrieving revision 1.7
diff -c -r1.7 unpack.m
*** unpack.m 12 Oct 2007 21:27:23 -0000 1.7
--- unpack.m 28 Jan 2008 21:42:50 -0000
***************
*** 139,148 ****
@__parse_zip__, false};
endif

! nodotext = ext(! ismember (ext, "."));
!
! origdir = pwd ();

if (isfield (commandlist, nodotext))
[commandv, commandq, parser, move] = deal (commandlist.(nodotext){:});
cstartdir = canonicalize_file_name (origdir);
--- 139,159 ----
@__parse_zip__, false};
endif

! switch ( filetype )
! case "gunzip"
! nodotext = "gz";
! case "bunzip"
! nodotext = "bz";
! case "untar"
! nodotext = "tar";
! case "unzip"
! nodotext = "zip";
! otherwise
! nodotext = ext(! ismember (ext, "."));
! endswitch

+ origdir = pwd ();
+
if (isfield (commandlist, nodotext))
[commandv, commandq, parser, move] = deal (commandlist.(nodotext){:});
cstartdir = canonicalize_file_name (origdir);

Patch is also attached.

Thanks,
Muthu



? Makefile
? PKG_ADD
? unkompress.patch
Index: unpack.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/unpack.m,v
retrieving revision 1.7
diff -c -r1.7 unpack.m
*** unpack.m    12 Oct 2007 21:27:23 -0000      1.7
--- unpack.m    28 Jan 2008 21:42:50 -0000
***************
*** 139,148 ****
                       @__parse_zip__, false};
    endif
  
!   nodotext = ext(! ismember (ext, "."));
!   
!   origdir = pwd ();
  
    if (isfield (commandlist, nodotext))
      [commandv, commandq, parser, move] = deal (commandlist.(nodotext){:});
      cstartdir = canonicalize_file_name (origdir);
--- 139,159 ----
                       @__parse_zip__, false};
    endif
  
!   switch ( filetype )
!     case "gunzip"
!       nodotext = "gz";
!     case "bunzip"
!       nodotext = "bz";
!     case "untar"
!       nodotext = "tar";
!     case "unzip"
!       nodotext = "zip";
!     otherwise
!       nodotext = ext(! ismember (ext, "."));  
!   endswitch 
  
+   origdir = pwd ();
+       
    if (isfield (commandlist, nodotext))
      [commandv, commandq, parser, move] = deal (commandlist.(nodotext){:});
      cstartdir = canonicalize_file_name (origdir);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]