Mercurial > hg > octave-lyh
annotate libinterp/corefcn/dirfns.cc @ 17335:fe6518a1d87c
Move TeX symbol decoding into the lexer (bug #39831).
* libinterp/Makefile.am (BUILT_SOURCES): Add corefcn/oct-tex-symbols.cc.
(BUILT_DISTFILES): Add corefcn/oct-tex-lexer.ll and
corefcn/oct-tex-symbols.cc.
(EXTRA_DIST): Add corefcn/oct-tex-lexer.in.ll and
corefcn/oct-tex-symbols.in.
(ULT_DIST_SRC): Filter out corefcn/oct-tex-lexer.ll from DIST_SRC and
add corefcn/oct-tex-lexer.in.ll instead.
(CLEAN_FILES): Add corefcn/oct-tex-parser.output.
* libinterp/corefcn/modules.mk (corefcn/oct-tex-lexer.ll,
corefcn/oct-tex-symbols.cc): New rules to build the TeX lexer.
(corefcn/txt-eng.cc): Add dependency on corefcn/oct-tex-symbols.cc.
* libinterp/corefcn/oct-tex-lexer.in.ll: Renamed from oct-tex.lexer.ll.
Remove COMMAND state. Remove ID regex. Replace rules for symbols with
tag @SYMBOL_RULES@.
* libinterp/corefcn/oct-tex-parser.yy (ID, CMD, identifier): Remove
tokens.
(SYM, sym): New token and value.
(symbol_element): Build from SYM.
* libinterp/corefcn/oct-tex-symbols.in: New file with supported TeX
symbols and corresponding codes (unicode and MS symbols).
* libinterp/corefcn/txt-eng.h (class text_element_symbol): Make it
inherit from text_element.
(text_element_symbol::code): Removed member.
(text_element_symbol::symbol): New member.
(text_element_symbol::text_element_symbol): Adapt constructor.
(text_element_symbol::get_symbol): New method.
(text_element_symbol::get_symbol_code): Make const.
* libinterp/corefcn/txt-eng.cc (symbol_names, symbol_codes): Remove
static variables, now auto-generated from oct-tex-symbols.in.
(oct-tex-symbols.cc): New include.
(text_element_symbol::get_symbol_code): Change implementation to simply
index into auto-generated symbol_codes array.
* libinterp/corefcn/txt-eng-ft.cc
(ft_render::visit(text_element_symbol)): Don't use
text_element_symbol::string_value(), use
text_element_symbol::get_symbol() instead.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Sat, 24 Aug 2013 14:27:09 -0400 |
parents | bc924baa2c4e |
children | 0bf2fc8562c9 |
rev | line source |
---|---|
523 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14022
diff
changeset
|
3 Copyright (C) 1994-2012 John W. Eaton |
523 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
523 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
523 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
1192 | 24 #include <config.h> |
523 | 25 #endif |
26 | |
1341 | 27 #include <cerrno> |
28 #include <cstdio> | |
29 #include <cstddef> | |
30 #include <cstdlib> | |
31 #include <cstring> | |
32 | |
5765 | 33 #include <sstream> |
1728 | 34 #include <string> |
35 | |
1832 | 36 #include <sys/types.h> |
37 #include <unistd.h> | |
38 | |
2926 | 39 #include "file-ops.h" |
40 #include "file-stat.h" | |
41 #include "glob-match.h" | |
42 #include "oct-env.h" | |
5777 | 43 #include "pathsearch.h" |
1755 | 44 #include "str-vec.h" |
45 | |
5102 | 46 #include "Cell.h" |
1355 | 47 #include "defun.h" |
1781 | 48 #include "dir-ops.h" |
1355 | 49 #include "dirfns.h" |
50 #include "error.h" | |
1402 | 51 #include "gripes.h" |
5640 | 52 #include "input.h" |
5832 | 53 #include "load-path.h" |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
54 #include "octave-link.h" |
1750 | 55 #include "oct-obj.h" |
1355 | 56 #include "pager.h" |
57 #include "procstream.h" | |
58 #include "sysdep.h" | |
1750 | 59 #include "toplev.h" |
1449 | 60 #include "unwind-prot.h" |
523 | 61 #include "utils.h" |
1742 | 62 #include "variables.h" |
523 | 63 |
5640 | 64 // TRUE means we ask for confirmation before recursively removing a |
65 // directory tree. | |
66 static bool Vconfirm_recursive_rmdir = true; | |
67 | |
6323 | 68 // The time we last time we changed directories. |
69 octave_time Vlast_chdir_time = 0.0; | |
70 | |
1328 | 71 static int |
3523 | 72 octave_change_to_directory (const std::string& newdir) |
1328 | 73 { |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
74 std::string xdir = file_ops::tilde_expand (newdir); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
75 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
76 int cd_ok = octave_env::chdir (xdir); |
1328 | 77 |
78 if (cd_ok) | |
5832 | 79 { |
6323 | 80 Vlast_chdir_time.stamp (); |
81 | |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
82 // FIXME -- should these actions be handled as a list of functions |
5832 | 83 // to call so users can add their own chdir handlers? |
84 | |
85 load_path::update (); | |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16094
diff
changeset
|
86 |
16526
01541f7321f7
correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
87 octave_link::change_directory (octave_env::get_current_directory ()); |
5832 | 88 } |
1328 | 89 else |
10411 | 90 error ("%s: %s", newdir.c_str (), gnulib::strerror (errno)); |
1328 | 91 |
92 return cd_ok; | |
93 } | |
94 | |
13912
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
95 DEFUN (cd, args, nargout, |
3301 | 96 "-*- texinfo -*-\n\ |
11572
7d6d8c1e471f
Grammarcheck Texinfo for files in src directory.
Rik <octave@nomad.inbox5.com>
parents:
11547
diff
changeset
|
97 @deftypefn {Command} {} cd dir\n\ |
11547 | 98 @deftypefnx {Command} {} chdir dir\n\ |
3301 | 99 Change the current working directory to @var{dir}. If @var{dir} is\n\ |
7001 | 100 omitted, the current directory is changed to the user's home\n\ |
3301 | 101 directory. For example,\n\ |
523 | 102 \n\ |
3301 | 103 @example\n\ |
104 cd ~/octave\n\ | |
105 @end example\n\ | |
106 \n\ | |
107 @noindent\n\ | |
10840 | 108 changes the current working directory to @file{~/octave}. If the\n\ |
3301 | 109 directory does not exist, an error message is printed and the working\n\ |
110 directory is not changed.\n\ | |
5597 | 111 @seealso{mkdir, rmdir, dir}\n\ |
11547 | 112 @end deftypefn") |
523 | 113 { |
2086 | 114 octave_value_list retval; |
523 | 115 |
1755 | 116 int argc = args.length () + 1; |
117 | |
1965 | 118 string_vector argv = args.make_argv ("cd"); |
1755 | 119 |
120 if (error_state) | |
121 return retval; | |
523 | 122 |
123 if (argc > 1) | |
124 { | |
5872 | 125 std::string dirname = argv[1]; |
523 | 126 |
1750 | 127 if (dirname.length () > 0 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
128 && ! octave_change_to_directory (dirname)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
129 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
130 return retval; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
131 } |
523 | 132 } |
133 else | |
134 { | |
13912
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
135 // Behave like Unixy shells for "cd" by itself, but be Matlab |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
136 // compatible if doing "current_dir = cd". |
2926 | 137 |
13912
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
138 if (nargout == 0) |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
139 { |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
140 std::string home_dir = octave_env::get_home_directory (); |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
141 |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
142 if (home_dir.empty () || ! octave_change_to_directory (home_dir)) |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
143 return retval; |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
144 } |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
145 else |
8d19194c4b1f
cd: behave like unixy shells for "cd" alone, but be Matlab compatible if doing "current_dir = cd"
John W. Eaton <jwe@octave.org>
parents:
12681
diff
changeset
|
146 retval = octave_value (octave_env::get_current_directory ()); |
523 | 147 } |
148 | |
149 return retval; | |
150 } | |
151 | |
611 | 152 DEFALIAS (chdir, cd); |
153 | |
6482 | 154 DEFUN (pwd, , , |
3301 | 155 "-*- texinfo -*-\n\ |
156 @deftypefn {Built-in Function} {} pwd ()\n\ | |
157 Return the current working directory.\n\ | |
5597 | 158 @seealso{dir, ls}\n\ |
3301 | 159 @end deftypefn") |
523 | 160 { |
10250 | 161 return octave_value (octave_env::get_current_directory ()); |
523 | 162 } |
163 | |
1957 | 164 DEFUN (readdir, args, , |
3301 | 165 "-*- texinfo -*-\n\ |
166 @deftypefn {Built-in Function} {[@var{files}, @var{err}, @var{msg}] =} readdir (@var{dir})\n\ | |
4691 | 167 Return names of the files in the directory @var{dir} as a cell array of\n\ |
168 strings. If an error occurs, return an empty cell array in @var{files}.\n\ | |
1389 | 169 \n\ |
3301 | 170 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ |
171 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
172 system-dependent error message.\n\ | |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11572
diff
changeset
|
173 @seealso{ls, dir, glob}\n\ |
3301 | 174 @end deftypefn") |
1389 | 175 { |
2086 | 176 octave_value_list retval; |
1389 | 177 |
3523 | 178 retval(2) = std::string (); |
2669 | 179 retval(1) = -1.0; |
4691 | 180 retval(0) = Cell (); |
2669 | 181 |
1401 | 182 if (args.length () == 1) |
1389 | 183 { |
3523 | 184 std::string dirname = args(0).string_value (); |
1389 | 185 |
1401 | 186 if (error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
187 gripe_wrong_type_arg ("readdir", args(0)); |
1401 | 188 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
189 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
190 dir_entry dir (dirname); |
1389 | 191 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
192 if (dir) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
193 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
194 string_vector dirlist = dir.read (); |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
13951
diff
changeset
|
195 retval(1) = 0.0; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
196 retval(0) = Cell (dirlist.sort ()); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
197 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
198 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
199 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
200 retval(2) = dir.error (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
201 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
202 } |
1389 | 203 } |
204 else | |
5823 | 205 print_usage (); |
1389 | 206 |
1401 | 207 return retval; |
208 } | |
209 | |
5775 | 210 // FIXME -- should maybe also allow second arg to specify |
5476 | 211 // mode? OTOH, that might cause trouble with compatibility later... |
1401 | 212 |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
213 DEFUNX ("mkdir", Fmkdir, args, , |
3301 | 214 "-*- texinfo -*-\n\ |
10840 | 215 @deftypefn {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} mkdir (@var{dir})\n\ |
6192 | 216 @deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} mkdir (@var{parent}, @var{dir})\n\ |
8109 | 217 Create a directory named @var{dir} in the directory @var{parent}.\n\ |
1401 | 218 \n\ |
5476 | 219 If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty\n\ |
220 character strings. Otherwise, @var{status} is 0, @var{msg} contains a\n\ | |
221 system-dependent error message, and @var{msgid} contains a unique\n\ | |
222 message identifier.\n\ | |
5597 | 223 @seealso{rmdir}\n\ |
3301 | 224 @end deftypefn") |
1401 | 225 { |
2086 | 226 octave_value_list retval; |
1401 | 227 |
5476 | 228 retval(2) = std::string (); |
3523 | 229 retval(1) = std::string (); |
5476 | 230 retval(0) = false; |
1401 | 231 |
6187 | 232 int nargin = args.length (); |
233 | |
234 std::string dirname; | |
235 | |
236 if (nargin == 2) | |
1401 | 237 { |
6187 | 238 std::string parent = args(0).string_value (); |
239 std::string dir = args(1).string_value (); | |
1401 | 240 |
241 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
242 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
243 gripe_wrong_type_arg ("mkdir", args(0)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
244 return retval; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
245 } |
6187 | 246 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
247 dirname = file_ops::concat (parent, dir); |
6187 | 248 } |
6200 | 249 else if (nargin == 1) |
6187 | 250 { |
251 dirname = args(0).string_value (); | |
2669 | 252 |
6187 | 253 if (error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
254 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
255 gripe_wrong_type_arg ("mkdir", args(0)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
256 return retval; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
257 } |
6187 | 258 } |
259 | |
260 if (nargin == 1 || nargin == 2) | |
261 { | |
262 std::string msg; | |
263 | |
7970
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
264 dirname = file_ops::tilde_expand (dirname); |
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
265 |
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
266 file_stat fs (dirname); |
1489 | 267 |
7970
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
268 if (fs && fs.is_dir ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
269 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
270 // For compatibility with Matlab, we return true when the |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
271 // directory already exists. |
7970
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
272 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
273 retval(2) = "mkdir"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
274 retval(1) = "directory exists"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
275 retval(0) = true; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
276 } |
6187 | 277 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
278 { |
14741
0ab3dd0fad18
Backout changeset a543ed02e673: mkdir-p
John W. Eaton <jwe@octave.org>
parents:
14679
diff
changeset
|
279 int status = octave_mkdir (dirname, 0777, msg); |
7970
b6d4c644b4b6
Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents:
7272
diff
changeset
|
280 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
281 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
282 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
283 retval(2) = "mkdir"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
284 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
285 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
286 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
287 retval(0) = true; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
288 } |
1401 | 289 } |
290 else | |
5823 | 291 print_usage (); |
1401 | 292 |
293 return retval; | |
294 } | |
295 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
296 DEFUNX ("rmdir", Frmdir, args, , |
3301 | 297 "-*- texinfo -*-\n\ |
10840 | 298 @deftypefn {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@var{dir})\n\ |
12681
c09ed93d1a8b
doc: Don't use @code{} within @deftypefn macro
Rik <octave@nomad.inbox5.com>
parents:
12668
diff
changeset
|
299 @deftypefnx {Built-in Function} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@var{dir}, \"s\")\n\ |
3301 | 300 Remove the directory named @var{dir}.\n\ |
1401 | 301 \n\ |
5476 | 302 If successful, @var{status} is 1, with @var{msg} and @var{msgid} empty\n\ |
303 character strings. Otherwise, @var{status} is 0, @var{msg} contains a\n\ | |
304 system-dependent error message, and @var{msgid} contains a unique\n\ | |
305 message identifier.\n\ | |
306 \n\ | |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
307 If the optional second parameter is supplied with value @qcode{\"s\"},\n\ |
6134 | 308 recursively remove all subdirectories as well.\n\ |
5640 | 309 @seealso{mkdir, confirm_recursive_rmdir}\n\ |
3301 | 310 @end deftypefn") |
1401 | 311 { |
2086 | 312 octave_value_list retval; |
1401 | 313 |
5476 | 314 retval(2) = std::string (); |
3523 | 315 retval(1) = std::string (); |
5476 | 316 retval(0) = false; |
1401 | 317 |
5476 | 318 int nargin = args.length (); |
319 | |
320 if (nargin == 1 || nargin == 2) | |
1401 | 321 { |
3523 | 322 std::string dirname = args(0).string_value (); |
1401 | 323 |
324 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
325 gripe_wrong_type_arg ("rmdir", args(0)); |
1489 | 326 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
327 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
328 std::string fulldir = file_ops::tilde_expand (dirname); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
329 int status = -1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
330 std::string msg; |
2669 | 331 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
332 if (nargin == 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
333 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
334 if (args(1).string_value () == "s") |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
335 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
336 bool doit = true; |
5640 | 337 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
338 if (interactive && Vconfirm_recursive_rmdir) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
339 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
340 std::string prompt |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
341 = "remove entire contents of " + fulldir + "? "; |
5640 | 342 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
343 doit = octave_yes_or_no (prompt); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
344 } |
5640 | 345 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
346 if (doit) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
347 status = octave_recursive_rmdir (fulldir, msg); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
348 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
349 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
350 error ("rmdir: expecting second argument to be \"s\""); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
351 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
352 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
353 status = octave_rmdir (fulldir, msg); |
2669 | 354 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
355 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
356 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
357 retval(2) = "rmdir"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
358 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
359 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
360 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
361 retval(0) = true; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
362 } |
1401 | 363 } |
1389 | 364 else |
5823 | 365 print_usage (); |
1401 | 366 |
367 return retval; | |
368 } | |
369 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
370 DEFUNX ("link", Flink, args, , |
3710 | 371 "-*- texinfo -*-\n\ |
372 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} link (@var{old}, @var{new})\n\ | |
373 Create a new link (also known as a hard link) to an existing file.\n\ | |
374 \n\ | |
375 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ | |
376 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
377 system-dependent error message.\n\ | |
5597 | 378 @seealso{symlink}\n\ |
3710 | 379 @end deftypefn") |
380 { | |
381 octave_value_list retval; | |
382 | |
383 retval(1) = std::string (); | |
384 retval(0) = -1.0; | |
385 | |
386 if (args.length () == 2) | |
387 { | |
388 std::string from = args(0).string_value (); | |
389 | |
390 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
391 gripe_wrong_type_arg ("link", args(0)); |
3710 | 392 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
393 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
394 std::string to = args(1).string_value (); |
3710 | 395 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
396 if (error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
397 gripe_wrong_type_arg ("link", args(1)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
398 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
399 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
400 std::string msg; |
3710 | 401 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
402 int status = octave_link (from, to, msg); |
3710 | 403 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
404 retval(0) = status; |
3710 | 405 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
406 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
407 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
408 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
409 } |
3710 | 410 } |
411 else | |
5823 | 412 print_usage (); |
3710 | 413 |
414 return retval; | |
415 } | |
416 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
417 DEFUNX ("symlink", Fsymlink, args, , |
3710 | 418 "-*- texinfo -*-\n\ |
419 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} symlink (@var{old}, @var{new})\n\ | |
420 Create a symbolic link @var{new} which contains the string @var{old}.\n\ | |
421 \n\ | |
422 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ | |
423 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
424 system-dependent error message.\n\ | |
5597 | 425 @seealso{link, readlink}\n\ |
3710 | 426 @end deftypefn") |
427 { | |
428 octave_value_list retval; | |
429 | |
430 retval(1) = std::string (); | |
431 retval(0) = -1.0; | |
432 | |
433 if (args.length () == 2) | |
434 { | |
435 std::string from = args(0).string_value (); | |
436 | |
437 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
438 gripe_wrong_type_arg ("symlink", args(0)); |
3710 | 439 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
440 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
441 std::string to = args(1).string_value (); |
3710 | 442 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
443 if (error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
444 gripe_wrong_type_arg ("symlink", args(1)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
445 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
446 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
447 std::string msg; |
3710 | 448 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
449 int status = octave_symlink (from, to, msg); |
3710 | 450 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
451 retval(0) = status; |
3710 | 452 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
453 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
454 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
455 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
456 } |
3710 | 457 } |
458 else | |
5823 | 459 print_usage (); |
3710 | 460 |
461 return retval; | |
462 } | |
463 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
464 DEFUNX ("readlink", Freadlink, args, , |
3710 | 465 "-*- texinfo -*-\n\ |
4169 | 466 @deftypefn {Built-in Function} {[@var{result}, @var{err}, @var{msg}] =} readlink (@var{symlink})\n\ |
3710 | 467 Read the value of the symbolic link @var{symlink}.\n\ |
468 \n\ | |
469 If successful, @var{result} contains the contents of the symbolic link\n\ | |
470 @var{symlink}, @var{err} is 0 and @var{msg} is an empty string.\n\ | |
471 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
472 system-dependent error message.\n\ | |
5597 | 473 @seealso{link, symlink}\n\ |
3710 | 474 @end deftypefn") |
475 { | |
476 octave_value_list retval; | |
477 | |
478 retval(2) = std::string (); | |
479 retval(1) = -1.0; | |
480 retval(0) = std::string (); | |
481 | |
482 if (args.length () == 1) | |
483 { | |
484 std::string symlink = args(0).string_value (); | |
485 | |
486 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
487 gripe_wrong_type_arg ("readlink", args(0)); |
3710 | 488 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
489 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
490 std::string result; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
491 std::string msg; |
3710 | 492 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
493 int status = octave_readlink (symlink, result, msg); |
3710 | 494 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
495 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
496 retval(2) = msg; |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
13951
diff
changeset
|
497 retval(1) = status; |
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
13951
diff
changeset
|
498 retval(0) = result; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
499 } |
3710 | 500 } |
501 else | |
5823 | 502 print_usage (); |
3710 | 503 |
504 return retval; | |
505 } | |
506 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
507 DEFUNX ("rename", Frename, args, , |
3301 | 508 "-*- texinfo -*-\n\ |
509 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} rename (@var{old}, @var{new})\n\ | |
510 Change the name of file @var{old} to @var{new}.\n\ | |
1401 | 511 \n\ |
3301 | 512 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ |
513 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
514 system-dependent error message.\n\ | |
5597 | 515 @seealso{ls, dir}\n\ |
3301 | 516 @end deftypefn") |
1401 | 517 { |
2086 | 518 octave_value_list retval; |
1401 | 519 |
3523 | 520 retval(1) = std::string (); |
2669 | 521 retval(0) = -1.0; |
1401 | 522 |
523 if (args.length () == 2) | |
524 { | |
3523 | 525 std::string from = args(0).string_value (); |
1728 | 526 |
1401 | 527 if (error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
528 gripe_wrong_type_arg ("rename", args(0)); |
1402 | 529 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
530 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
531 std::string to = args(1).string_value (); |
1728 | 532 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
533 if (error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
534 gripe_wrong_type_arg ("rename", args(1)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
535 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
536 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
537 std::string msg; |
2669 | 538 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
539 int status = octave_rename (from, to, msg); |
2669 | 540 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
541 retval(0) = status; |
2669 | 542 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
543 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
544 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
545 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
546 } |
1401 | 547 } |
548 else | |
5823 | 549 print_usage (); |
1401 | 550 |
1389 | 551 return retval; |
552 } | |
553 | |
2495 | 554 DEFUN (glob, args, , |
3301 | 555 "-*- texinfo -*-\n\ |
556 @deftypefn {Built-in Function} {} glob (@var{pattern})\n\ | |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
557 Given an array of pattern strings (as a char array or a cell array) in\n\ |
5444 | 558 @var{pattern}, return a cell array of file names that match any of\n\ |
12642
f96b9b9f141b
doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
12211
diff
changeset
|
559 them, or an empty cell array if no patterns match. The pattern strings are\n\ |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10711
diff
changeset
|
560 interpreted as filename globbing patterns (as they are used by Unix shells).\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
561 Within a pattern\n\ |
14366
b76f0740940e
doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents:
14361
diff
changeset
|
562 \n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
563 @table @code\n\ |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
564 @item *\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
565 matches any string, including the null string,\n\ |
16816
12005245b645
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
16526
diff
changeset
|
566 \n\ |
16094
8899c785cc99
doc: Fix warnings associated with Texinfo 5.0 (bug #38392)
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
567 @item ?\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
568 matches any single character, and\n\ |
10840 | 569 \n\ |
10711
fbd7843974fa
Periodic grammar check of documentation files to ensure common format.
Rik <octave@nomad.inbox5.com>
parents:
10411
diff
changeset
|
570 @item [@dots{}]\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
571 matches any of the enclosed characters.\n\ |
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
572 @end table\n\ |
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
573 \n\ |
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
574 Tilde expansion\n\ |
5444 | 575 is performed on each of the patterns before looking for matching file\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
576 names. For example:\n\ |
2495 | 577 \n\ |
3301 | 578 @example\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
579 ls\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
580 @result{}\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
581 file1 file2 file3 myfile1 myfile1b\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
582 glob (\"*file1\")\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
583 @result{}\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
584 @{\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
585 [1,1] = file1\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
586 [2,1] = myfile1\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
587 @}\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
588 glob (\"myfile?\")\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
589 @result{}\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
590 @{\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
591 [1,1] = myfile1\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
592 @}\n\ |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
593 glob (\"file[12]\")\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
594 @result{}\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
595 @{\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
596 [1,1] = file1\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
597 [2,1] = file2\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
598 @}\n\ |
3301 | 599 @end example\n\ |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11572
diff
changeset
|
600 @seealso{ls, dir, readdir}\n\ |
5597 | 601 @end deftypefn") |
2495 | 602 { |
603 octave_value retval; | |
604 | |
605 if (args.length () == 1) | |
606 { | |
607 string_vector pat = args(0).all_strings (); | |
608 | |
609 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
610 gripe_wrong_type_arg ("glob", args(0)); |
2495 | 611 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
612 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
613 glob_match pattern (file_ops::tilde_expand (pat)); |
2495 | 614 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
615 retval = Cell (pattern.glob ()); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
616 } |
2495 | 617 } |
618 else | |
5823 | 619 print_usage (); |
2495 | 620 |
621 return retval; | |
622 } | |
623 | |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
624 /* |
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
625 %!test |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
626 %! tmpdir = tmpnam; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
627 %! filename = {"file1", "file2", "file3", "myfile1", "myfile1b"}; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
628 %! if (mkdir (tmpdir)) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
629 %! cwd = pwd; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
630 %! cd (tmpdir); |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16892
diff
changeset
|
631 %! if (strcmp (canonicalize_file_name (pwd), canonicalize_file_name (tmpdir))) |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
632 %! a = 0; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
633 %! for n = 1:5 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
634 %! save (filename{n}, "a"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
635 %! endfor |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
636 %! else |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
637 %! rmdir (tmpdir); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
638 %! error ("Couldn't change to temporary dir"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
639 %! endif |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
640 %! else |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
641 %! error ("Couldn't create temporary directory"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
642 %! endif |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
643 %! result1 = glob ("*file1"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
644 %! result2 = glob ("myfile?"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
645 %! result3 = glob ("file[12]"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
646 %! for n = 1:5 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
647 %! delete (filename{n}); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
648 %! endfor |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
649 %! cd (cwd); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
650 %! rmdir (tmpdir); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
651 %! assert (result1, {"file1"; "myfile1"}); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
652 %! assert (result2, {"myfile1"}); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14366
diff
changeset
|
653 %! assert (result3, {"file1"; "file2"}); |
10335
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
654 */ |
9dd04a06410e
document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
10315
diff
changeset
|
655 |
11531
f976dd63129c
fnmatch: use DEFUNX until gnulib's fnmatch is C++ friendly
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
656 DEFUNX ("fnmatch", Ffnmatch, args, , |
3301 | 657 "-*- texinfo -*-\n\ |
658 @deftypefn {Built-in Function} {} fnmatch (@var{pattern}, @var{string})\n\ | |
659 Return 1 or zero for each element of @var{string} that matches any of\n\ | |
660 the elements of the string array @var{pattern}, using the rules of\n\ | |
10840 | 661 filename pattern matching. For example:\n\ |
2496 | 662 \n\ |
3301 | 663 @example\n\ |
664 @group\n\ | |
6233 | 665 fnmatch (\"a*b\", @{\"ab\"; \"axyzb\"; \"xyzab\"@})\n\ |
3301 | 666 @result{} [ 1; 1; 0 ]\n\ |
667 @end group\n\ | |
668 @end example\n\ | |
669 @end deftypefn") | |
2496 | 670 { |
671 octave_value retval; | |
672 | |
673 if (args.length () == 2) | |
674 { | |
675 string_vector pat = args(0).all_strings (); | |
676 string_vector str = args(1).all_strings (); | |
677 | |
678 if (error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
679 gripe_wrong_type_arg ("fnmatch", args(0)); |
2496 | 680 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
681 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
682 glob_match pattern (file_ops::tilde_expand (pat)); |
2496 | 683 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
684 retval = pattern.match (str); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
685 } |
2496 | 686 } |
687 else | |
5823 | 688 print_usage (); |
2496 | 689 |
690 return retval; | |
691 } | |
692 | |
5777 | 693 DEFUN (filesep, args, , |
5832 | 694 "-*- texinfo -*-\n\ |
10840 | 695 @deftypefn {Built-in Function} {} filesep ()\n\ |
14361
8de863b7126b
doc: Use Octave preference for double quote in docstrings in all .cc files
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
696 @deftypefnx {Built-in Function} {} filesep (\"all\")\n\ |
5777 | 697 Return the system-dependent character used to separate directory names.\n\ |
8317
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
698 \n\ |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
699 If @qcode{\"all\"} is given, the function returns all valid file separators\n\ |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
700 in the form of a string. The list of file separators is system-dependent.\n\ |
12668
e3dc23f7dd54
doc: Improve a few docstrings related to test functions and directories.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
701 It is @samp{/} (forward slash) under UNIX or @w{Mac OS X}, @samp{/} and\n\ |
e3dc23f7dd54
doc: Improve a few docstrings related to test functions and directories.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
702 @samp{\\} (forward and backward slashes) under Windows.\n\ |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11572
diff
changeset
|
703 @seealso{pathsep}\n\ |
5777 | 704 @end deftypefn") |
705 { | |
706 octave_value retval; | |
707 | |
708 if (args.length () == 0) | |
8007
a2ab20ba78f7
make file_ops a proper singleton class
John W. Eaton <jwe@octave.org>
parents:
7970
diff
changeset
|
709 retval = file_ops::dir_sep_str (); |
8317
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
710 else if (args.length () == 1) |
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
711 { |
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
712 std::string s = args(0).string_value (); |
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
713 |
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
714 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
715 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
716 if (s == "all") |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
717 retval = file_ops::dir_sep_chars (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
718 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
719 gripe_wrong_type_arg ("filesep", args(0)); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
720 } |
8317
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
721 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
722 gripe_wrong_type_arg ("filesep", args(0)); |
8317
135c0e7d7802
Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8109
diff
changeset
|
723 } |
5777 | 724 else |
5823 | 725 print_usage (); |
5777 | 726 |
727 return retval; | |
728 } | |
729 | |
9266 | 730 DEFUN (pathsep, args, nargout, |
5777 | 731 "-*- texinfo -*-\n\ |
10840 | 732 @deftypefn {Built-in Function} {@var{val} =} pathsep ()\n\ |
9270
f9ac007bb926
fix typo in 9266:1d3b91166b9c
Jaroslav Hajek <highegg@gmail.com>
parents:
9266
diff
changeset
|
733 @deftypefnx {Built-in Function} {@var{old_val} =} pathsep (@var{new_val})\n\ |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11572
diff
changeset
|
734 Query or set the character used to separate directories in a path.\n\ |
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11572
diff
changeset
|
735 @seealso{filesep}\n\ |
5777 | 736 @end deftypefn") |
737 { | |
738 octave_value retval; | |
739 | |
9266 | 740 int nargin = args.length (); |
741 | |
742 if (nargout > 0 || nargin == 0) | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
8007
diff
changeset
|
743 retval = dir_path::path_sep_str (); |
9266 | 744 |
745 if (nargin == 1) | |
746 { | |
747 std::string sval = args(0).string_value (); | |
748 | |
749 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
750 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
751 switch (sval.length ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
752 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
753 case 1: |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
754 dir_path::path_sep_char (sval[0]); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
755 break; |
9266 | 756 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
757 case 0: |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
758 dir_path::path_sep_char ('\0'); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
759 break; |
9266 | 760 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
761 default: |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
762 error ("pathsep: argument must be a single character"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
763 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
764 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
765 } |
9266 | 766 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
767 error ("pathsep: argument must be a single character"); |
9266 | 768 } |
769 else if (nargin > 1) | |
5823 | 770 print_usage (); |
5777 | 771 |
772 return retval; | |
773 } | |
774 | |
5794 | 775 DEFUN (confirm_recursive_rmdir, args, nargout, |
776 "-*- texinfo -*-\n\ | |
10840 | 777 @deftypefn {Built-in Function} {@var{val} =} confirm_recursive_rmdir ()\n\ |
5794 | 778 @deftypefnx {Built-in Function} {@var{old_val} =} confirm_recursive_rmdir (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
13912
diff
changeset
|
779 @deftypefnx {Built-in Function} {} confirm_recursive_rmdir (@var{new_val}, \"local\")\n\ |
5794 | 780 Query or set the internal variable that controls whether Octave\n\ |
781 will ask for confirmation before recursively removing a directory tree.\n\ | |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
13912
diff
changeset
|
782 \n\ |
17289
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
783 When called from inside a function with the @qcode{\"local\"} option, the\n\ |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
784 variable is changed locally for the function and any subroutines it calls. \n\ |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
785 The original variable value is restored when exiting the function.\n\ |
5794 | 786 @end deftypefn") |
5640 | 787 { |
5794 | 788 return SET_INTERNAL_VARIABLE (confirm_recursive_rmdir); |
4264 | 789 } |