annotate scripts/miscellaneous/tar.m @ 20164:df437a52bcaf stable

doc: Update more docstrings to have one sentence summary as first line. Reviewed miscellaneous, sparse, strings in scripts directory. * scripts/miscellaneous/bzip2.m, scripts/miscellaneous/citation.m, scripts/miscellaneous/compare_versions.m, scripts/miscellaneous/computer.m, scripts/miscellaneous/debug.m, scripts/miscellaneous/dir.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/error_ids.m, scripts/miscellaneous/fileattrib.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/genvarname.m, scripts/miscellaneous/gzip.m, scripts/miscellaneous/mkoctfile.m, scripts/miscellaneous/news.m, scripts/miscellaneous/open.m, scripts/miscellaneous/parseparams.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/run.m, scripts/miscellaneous/swapbytes.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/what.m, scripts/sparse/bicg.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/colperm.m, scripts/sparse/eigs.m, scripts/sparse/etreeplot.m, scripts/sparse/gmres.m, scripts/sparse/gplot.m, scripts/sparse/ichol.m, scripts/sparse/ilu.m, scripts/sparse/pcg.m, scripts/sparse/pcr.m, scripts/sparse/qmr.m, scripts/sparse/spaugment.m, scripts/sparse/spconvert.m, scripts/sparse/spdiags.m, scripts/sparse/spfun.m, scripts/sparse/spones.m, scripts/sparse/sprandsym.m, scripts/sparse/spstats.m, scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/sparse/treelayout.m, scripts/sparse/treeplot.m, scripts/strings/base2dec.m, scripts/strings/bin2dec.m, scripts/strings/blanks.m, scripts/strings/cstrcat.m, scripts/strings/deblank.m, scripts/strings/dec2base.m, scripts/strings/dec2bin.m, scripts/strings/dec2hex.m, scripts/strings/findstr.m, scripts/strings/hex2dec.m, scripts/strings/index.m, scripts/strings/isletter.m, scripts/strings/isstrprop.m, scripts/strings/mat2str.m, scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m, scripts/strings/rindex.m, scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strchr.m, scripts/strings/strjoin.m, scripts/strings/strjust.m, scripts/strings/strmatch.m, scripts/strings/strsplit.m, scripts/strings/strtok.m, scripts/strings/strtrim.m, scripts/strings/strtrunc.m, scripts/strings/substr.m, scripts/strings/untabify.m, scripts/time/datenum.m: Update more docstrings to have one sentence summary as first line.
author Rik <rik@octave.org>
date Mon, 04 May 2015 14:22:02 -0700
parents 8c20fb6caa16
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19597
diff changeset
1 ## Copyright (C) 2005-2015 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 -*-
19258
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 ##
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19951
diff changeset
25 ## @var{files} is a character array or cell array of strings. Shell wildcards
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19951
diff changeset
26 ## in the filename such as @samp{*} or @samp{?} are accepted and expanded.
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19951
diff changeset
27 ## Directories are recursively traversed and all files are added to the
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19951
diff changeset
28 ## archive.
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
29 ##
19258
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
19258
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
19258
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);
19258
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
19258
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
19258
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);
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19535
diff changeset
57
19951
8c20fb6caa16 Fix XFAIL with tar and unpack tests (bug #44007, bug #43979).
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 19927
diff changeset
58 if (ispc)
8c20fb6caa16 Fix XFAIL with tar and unpack tests (bug #44007, bug #43979).
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 19927
diff changeset
59 ## Change tarfile into a mingw style acceptable for tar
8c20fb6caa16 Fix XFAIL with tar and unpack tests (bug #44007, bug #43979).
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 19927
diff changeset
60 tarfile = __w2mpth__ (tarfile);
8c20fb6caa16 Fix XFAIL with tar and unpack tests (bug #44007, bug #43979).
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 19927
diff changeset
61 endif
8c20fb6caa16 Fix XFAIL with tar and unpack tests (bug #44007, bug #43979).
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 19927
diff changeset
62
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
63 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
64 tarfile, rootdir, sprintf (" %s", files{:}));
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
65
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
66 [status, output] = system (cmd);
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
67
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
68 if (status)
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
69 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
70 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
71
12500
8f2056646dba Improve docstrings for archive functions (gzip, bzip2, etc.)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
72 if (nargout > 0)
19927
0cc365dada52 Allow tar, unpack, and zip to run on Windows with CR/NL EOL.
Rik <rik@octave.org>
parents: 19925
diff changeset
73 filelist = ostrsplit (output, "\r\n", true);
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
74 filelist = filelist';
5808
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
75 endif
a18d85bdff31 [project @ 2006-05-11 03:11:03 by jwe]
jwe
parents: 5807
diff changeset
76
5807
29c4fb42b210 [project @ 2006-05-11 01:48:56 by jwe]
jwe
parents:
diff changeset
77 endfunction
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17243
diff changeset
78
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
79
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
80 %!xtest
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
81 %! ## test tar together with untar
19535
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19258
diff changeset
82 %! orig_dir = pwd ();
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
83 %! unwind_protect
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
84 %! dirname = tarname = outdir = "";
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
85 %! dirname = tempname ();
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
86 %! assert (mkdir (dirname));
19535
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19258
diff changeset
87 %! chdir (dirname);
827cc33ae05c avoid warning message in test for tar function
John W. Eaton <jwe@octave.org>
parents: 19258
diff changeset
88 %! dirname2 = "dir2";
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
89 %! assert (mkdir (dirname2));
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
90 %! fname1 = "file1";
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
91 %! fname2 = fullfile (dirname2, "file2");
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
92 %! fid = fopen (fname1, "wt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
93 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
94 %! fdisp (fid, "Hello World");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19535
diff changeset
95 %! fclose (fid);
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
96 %! fid = fopen (fname2, "wt");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
97 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
98 %! fdisp (fid, "Goodbye World");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19535
diff changeset
99 %! fclose (fid);
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
100 %! tarname = [tempname() ".tar"];
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
101 %! 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
102 %! 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
103 %! 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
104 %! endif
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
105 %! if (! exist (tarname, "file"))
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
106 %! 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
107 %! endif
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
108 %! outdir = tempname;
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
109 %! untar (tarname, outdir);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
110 %! 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
111 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
112 %! str = fgetl (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
113 %! fclose (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
114 %! assert (str, "Hello World");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
115 %! 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
116 %! assert (fid >= 0);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
117 %! str = fgetl (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
118 %! fclose (fid);
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
119 %! assert (str, "Goodbye World");
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
120 %! unwind_protect_cleanup
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
121 %! chdir (orig_dir);
19927
0cc365dada52 Allow tar, unpack, and zip to run on Windows with CR/NL EOL.
Rik <rik@octave.org>
parents: 19925
diff changeset
122 %! unlink (tarname);
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
123 %! confirm_recursive_rmdir (false, "local");
19925
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
124 %! if (exist (dirname))
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
125 %! rmdir (dirname, "s");
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
126 %! endif
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
127 %! if (exist (outdir))
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
128 %! rmdir (outdir, "s");
ee7159d9a330 tar.m: Re-code BIST test restore working directory even when test fails (bug #44007).
Rik <rik@octave.org>
parents: 19697
diff changeset
129 %! endif
19258
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
130 %! end_unwind_protect
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
131
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
132 ## Test input validation
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
133 %!error tar ()
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
134 %!error tar (1)
a4e993343e93 Overhaul the archive family (bzip2, gzip, zip, tar) of m-files.
Rik <rik@octave.org>
parents: 17744
diff changeset
135 %!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
136 %!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
137 %!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
138