Mercurial > octave-antonio
annotate scripts/miscellaneous/gzip.m @ 13141:e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
* bicg.m, gmres.m, pkg.m: Untabify and remove trailing whitespace.
* libcruft/Makefile.am, libcruft/blas-xtra/cdotc3.f,
libcruft/blas-xtra/cmatm3.f, libcruft/blas-xtra/ddot3.f,
libcruft/blas-xtra/dmatm3.f, libcruft/blas-xtra/sdot3.f,
libcruft/blas-xtra/smatm3.f, libcruft/blas-xtra/zdotc3.f,
libcruft/blas-xtra/zmatm3.f, libcruft/lapack-xtra/crsf2csf.f,
libcruft/lapack-xtra/zrsf2csf.f, liboctave/Array.cc,
liboctave/DASPK-opts.in, liboctave/DASRT-opts.in,
liboctave/DASSL-opts.in, liboctave/LSODE-opts.in,
liboctave/Makefile.a,mliboctave/Quad-opts.in,
liboctave/Sparse-perm-op-defs.h,
scripts/Makefile.a,mscripts/deprecated/glpkmex.m,
scripts/general/blkdiag.m, scripts/general/interp1.m,
scripts/general/profshow.m, scripts/general/quadl.m,
scripts/general/triplequad.m, scripts/help/__makeinfo__.m,
scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m,
scripts/linear-algebra/rank.m, scripts/miscellaneous/gzip.m,
scripts/miscellaneous/private/__xzip__.m,
scripts/miscellaneous/tempdir.m, scripts/miscellaneous/unpack.m,
scripts/pkg/pkg.m, scripts/plot/allchild.m, scripts/plot/ancestor.m,
scripts/plot/cla.m, scripts/plot/clf.m, scripts/plot/findall.m,
scripts/plot/findobj.m, scripts/plot/gca.m, scripts/plot/gcf.m,
scripts/plot/hggroup.m, scripts/plot/isfigure.m,
scripts/plot/ishghandle.m, scripts/plot/legend.m,
scripts/plot/line.m, scripts/plot/loglog.m, scripts/plot/patch.m,
scripts/plot/print.m, scripts/plot/private/__quiver__.m,
scripts/plot/private/__scatter__.m, scripts/plot/rectangle.m,
scripts/plot/semilogx.m, scripts/plot/semilogy.m,
scripts/plot/surface.m, scripts/plot/text.m, scripts/plot/title.m,
scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/whitebg.m,
scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m,
scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m,
scripts/polynomial/mkpp.m, scripts/polynomial/polygcd.m,
scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m,
scripts/polynomial/ppval.m, scripts/set/setxor.m,
scripts/sparse/bicgstab.m, scripts/sparse/cgs.m,
scripts/sparse/spconvert.m, scripts/specfun/nthroot.m,
scripts/strings/strmatch.m, scripts/strings/untabify.m,
scripts/testfun/demo.m, scripts/testfun/example.m,
src/DLD-FUNCTIONS/filter.cc, src/DLD-FUNCTIONS/mgorth.cc,
src/DLD-FUNCTIONS/quadcc.cc, src/DLD-FUNCTIONS/str2double.cc,
src/Makefile.a,msrc/gl-render.cc, src/gl2ps-renderer.cc,
src/graphics.cc, src/octave-config.cc.in, src/octave-config.in,
src/ov-class.h, src/ov-fcn.h, src/profiler.cc, src/profiler.h,
src/pt-binop.cc, src/pt-unop.cc, src/symtab.cc, src/txt-eng-ft.cc:
Remove trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 15 Sep 2011 12:51:10 -0400 |
parents | 8f2056646dba |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2007-2011 David Bateman |
6869 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6869 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6869 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
20 ## @deftypefn {Function File} {@var{entries} =} gzip (@var{files}) |
6869 | 21 ## @deftypefnx {Function File} {@var{entries} =} gzip (@var{files}, @var{outdir}) |
22 ## Compress the list of files and/or directories specified in @var{files}. | |
23 ## Each file is compressed separately and a new file with a '.gz' extension | |
12500
8f2056646dba
Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents:
12499
diff
changeset
|
24 ## is created. The original files are not modified. Existing compressed |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
25 ## files are silently overwritten. If @var{outdir} is defined the compressed |
12500
8f2056646dba
Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents:
12499
diff
changeset
|
26 ## files are placed in this directory. |
8362
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
27 ## @seealso{gunzip, bzip2, zip, tar} |
6869 | 28 ## @end deftypefn |
29 | |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
30 function entries = gzip (varargin) |
12499
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
31 if (nargin != 1 && nargin != 2) || (nargout > 1) |
6869 | 32 print_usage (); |
33 endif | |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12500
diff
changeset
|
34 |
12499
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
35 if (nargout == 0) |
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
36 __xzip__ ("gzip", "gz", "gzip -r %s", varargin{:}); |
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
37 else |
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
38 entries = __xzip__ ("gzip", "gz", "gzip -r %s", varargin{:}); |
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
39 endif |
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
40 |
6869 | 41 endfunction |
42 | |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
43 %!error <Invalid call to gzip. Correct usage is> gzip("1", "2", "3"); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
44 %!error <Invalid call to gzip. Correct usage is> gzip(); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
45 %!error <output directory does not exist> gzip("1", tmpnam); |
12499
a3019189ac51
Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
46 %!error <FILES must be a character array or cellstr> gzip(1); |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
47 %!xtest |
8362
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
48 %! # test gzip together with gunzip |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
49 %! unwind_protect |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
50 %! filename = tmpnam; |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
51 %! dummy = 1; |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
52 %! save(filename, "dummy"); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
53 %! dirname = tmpnam; |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
54 %! mkdir(dirname); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
55 %! entry = gzip(filename, dirname); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
56 %! [path, basename, extension] = fileparts(filename); |
8640
34b9a5743388
fix gzip test code - use filesep()
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
8362
diff
changeset
|
57 %! if ! strcmp(entry, [dirname, filesep, basename, extension, ".gz"]) |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
58 %! error("gzipped file does not match expected name!"); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
59 %! endif |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
60 %! if ! exist(entry, "file") |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
61 %! error("gzipped file cannot be found!"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
62 %! endif |
8362
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
63 %! gunzip(entry); |
8640
34b9a5743388
fix gzip test code - use filesep()
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
8362
diff
changeset
|
64 %! if (system(sprintf("diff %s %s%c%s%s", filename, dirname, filesep, |
8362
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
65 %! basename, extension))) |
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
66 %! error("unzipped file not equal to original file!"); |
03b414516dd8
clean up bzip2, gzip and __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
8349
diff
changeset
|
67 %! end |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
68 %! unwind_protect_cleanup |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
69 %! delete(filename); |
8640
34b9a5743388
fix gzip test code - use filesep()
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
8362
diff
changeset
|
70 %! delete([dirname, filesep, basename, extension]); |
8349
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
71 %! rmdir(dirname); |
02beb5be5683
add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
72 %! end_unwind_protect |