annotate scripts/miscellaneous/tar.m @ 19631:db92e7e28e1f

strip trailing whitespace from most source files * NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi, doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps, doc/interpreter/plot.txi, doc/interpreter/stmt.txi, examples/data/Makefile.am, libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc, libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc, libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-classdef.h, libinterp/octave.cc, libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc, liboctave/system/oct-env.cc, m4/acinclude.m4, scripts/deprecated/finite.m, scripts/deprecated/fmod.m, scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m, scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m, scripts/deprecated/usage.m, scripts/general/inputParser.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/isequal.m, scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m, scripts/image/image.m, scripts/image/imshow.m, scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m, scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m, scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m, scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m, scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m, scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m, scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m, scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m, scripts/optimization/fminbnd.m, scripts/optimization/sqp.m, scripts/path/private/getsavepath.m, scripts/path/savepath.m, scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m, scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m, scripts/set/union.m, scripts/signal/periodogram.m, scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/specfun/beta.m, scripts/specfun/ellipke.m, scripts/specfun/isprime.m, scripts/statistics/base/lscov.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m: Strip trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:29:54 -0500
parents 827cc33ae05c
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17338
diff changeset
1 ## Copyright (C) 2005-2013 Søren Hauberg
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2 ##
6049
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
3 ## This file is part of Octave.
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
4 ##
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6049
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6049
diff changeset
8 ## your option) any later version.
6049
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
9 ##
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
13 ## General Public License for more details.
04c2ad6d1679 [project @ 2006-10-13 14:32:15 by jwe]
jwe
parents: 5808
diff changeset
14 ##
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6049
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6049
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
18
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
20 ## @deftypefn {Function File} {@var{filelist} =} tar (@var{tarfile}, @var{files})
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
21 ## @deftypefnx {Function File} {@var{filelist} =} tar (@var{tarfile}, @var{files}, @var{rootdir})
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
22 ## Pack the list of files and directories specified in @var{files} into the
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
23 ## TAR archive @var{tarfile}.
5808
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
24 ##
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
25 ## @var{files} is a character array or cell array of strings. Shell
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
26 ## wildcards in the filename such as @samp{*} or @samp{?} are accepted and
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
27 ## expanded. Directories are recursively traversed and all files are added to
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
28 ## the archive.
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
29 ##
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
30 ## If @var{rootdir} is defined then any files without absolute pathnames are
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
31 ## located relative to @var{rootdir} rather than the current directory.
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
32 ##
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
33 ## The optional output @var{filelist} is a list of the files that were included
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
34 ## in the archive.
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
35 ## @seealso{untar, unpack, bzip2, gzip, zip}
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
36 ## @end deftypefn
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
37
17243
f4c8c66faf34 maint: Update source file encodings to UTF-8 and fix character errors
Mike Miller <mtmiller@ieee.org>
parents: 16724
diff changeset
38 ## Author: Søren Hauberg <hauberg@gmail.com>
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
39
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
40 function filelist = tar (tarfile, files, rootdir = ".")
5808
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
41
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
42 if (nargin < 2 || nargin > 3)
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
43 print_usage ();
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
44 endif
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
45
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
46 if (! ischar (tarfile))
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
47 error ("tar: TARFILE must be a string");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
48 elseif (ischar (files))
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
49 files = cellstr (files);
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
50 elseif (! iscellstr (files))
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
51 error ("tar: FILES must be a character array or cellstr");
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
52 endif
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
53
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
54 rootdir = tilde_expand (rootdir);
5808
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
55
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
56 tarfile = make_absolute_filename (tarfile);
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19569
diff changeset
57
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
58 cmd = sprintf ("tar cvf %s -C %s %s",
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
59 tarfile, rootdir, sprintf (" %s", files{:}));
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
60
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
61 [status, output] = system (cmd);
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
62
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
63 if (status)
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
64 error ("tar: tar exited with status = %d", status);
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
65 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
66
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
67 if (nargout > 0)
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
68 if (output(end) == "\n")
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
69 output(end) = [];
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
70 endif
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
71 filelist = ostrsplit (output, "\n");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
72 filelist = filelist';
5808
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
73 endif
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
74
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
75 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17243
diff changeset
76
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
77
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
78 %!xtest
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
79 %! ## test gzip together with gunzip
19569
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19292
diff changeset
80 %! orig_dir = pwd ();
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
81 %! unwind_protect
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
82 %! dirname = tempname;
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
83 %! assert (mkdir (dirname));
19569
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19292
diff changeset
84 %! chdir (dirname);
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19292
diff changeset
85 %! dirname2 = "dir2";
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
86 %! assert (mkdir (dirname2));
19569
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19292
diff changeset
87 %! fname1 = "f1";
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
88 %! fname2 = fullfile (dirname2, "f2");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
89 %! fid = fopen (fname1, "wt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
90 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
91 %! fdisp (fid, "Hello World");
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19569
diff changeset
92 %! fclose (fid);
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
93 %! fid = fopen (fname2, "wt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
94 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
95 %! fdisp (fid, "Goodbye World");
19631
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19569
diff changeset
96 %! fclose (fid);
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
97 %! tarname = [tempname ".tar"];
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
98 %! filelist = tar (tarname, {dirname2, fname1});
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
99 %! if (! strcmp (filelist{3}, fname1))
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
100 %! error ("tar file contents does not match expected file");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
101 %! endif
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
102 %! if (! exist (tarname, "file"))
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
103 %! error ("tar archive file cannot be found!");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
104 %! endif
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
105 %! outdir = tempname;
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
106 %! untar (tarname, outdir);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
107 %! fid = fopen (fullfile (outdir, fname1), "rt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
108 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
109 %! str = fgetl (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
110 %! fclose (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
111 %! assert (str, "Hello World");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
112 %! fid = fopen (fullfile (outdir, fname2), "rt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
113 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
114 %! str = fgetl (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
115 %! fclose (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
116 %! assert (str, "Goodbye World");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
117 %! unwind_protect_cleanup
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
118 %! delete (tarname);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
119 %! confirm_recursive_rmdir (false, "local");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
120 %! rmdir (dirname, "s");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
121 %! rmdir (outdir, "s");
19569
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19292
diff changeset
122 %! chdir (orig_dir);
19292
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
123 %! end_unwind_protect
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
124
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
125 ## Test input validation
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
126 %!error tar ()
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
127 %!error tar (1)
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
128 %!error tar (1,2,3,4)
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
129 %!error <TARFILE must be a string> tar (1, "foobar")
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
130 %!error <FILES must be a character array or cellstr> tar ("foobar", 1)
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
131