annotate libinterp/corefcn/dirfns.cc @ 27395:4164895adf79

move octave_change_to_directory to octave namespace and make extern * dirfns.cc (octave_change_to_directory): Define in octave namespace as change_to_directory. * dirfns.h, (change_to_directory): Provide extern declaration.
author John W. Eaton <jwe@octave.org>
date Wed, 11 Sep 2019 18:31:33 -0400
parents a2b1ba6c92d5
children 9b19eec60931
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
1 /*
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25742
diff changeset
3 Copyright (C) 1994-2019 John W. Eaton
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
4
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24082
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24082
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
16
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
17 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: 7007
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24082
diff changeset
19 <https://www.gnu.org/licenses/>.
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
20
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
21 */
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21696
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
24 # include "config.h"
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
25 #endif
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
26
1341
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
27 #include <cerrno>
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
28 #include <cstdio>
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
29 #include <cstddef>
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
30 #include <cstdlib>
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
31 #include <cstring>
e4e4131b1648 [project @ 1995-09-04 00:13:33 by jwe]
jwe
parents: 1328
diff changeset
32
5765
7ba9ad1fec11 [project @ 2006-04-17 05:05:15 by jwe]
jwe
parents: 5640
diff changeset
33 #include <sstream>
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1690
diff changeset
34 #include <string>
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1690
diff changeset
35
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
36 #include "file-ops.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
37 #include "file-stat.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
38 #include "glob-match.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
39 #include "oct-env.h"
22155
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
40 #include "oct-glob.h"
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
41 #include "pathsearch.h"
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1750
diff changeset
42 #include "str-vec.h"
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1750
diff changeset
43
5102
b04b30d30c66 [project @ 2004-12-28 01:59:05 by jwe]
jwe
parents: 4928
diff changeset
44 #include "Cell.h"
1355
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
45 #include "defun.h"
1781
e090f89bf2f5 [project @ 1996-01-24 08:04:14 by jwe]
jwe
parents: 1773
diff changeset
46 #include "dir-ops.h"
1355
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
47 #include "dirfns.h"
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
48 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21078
diff changeset
49 #include "errwarn.h"
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
50 #include "event-manager.h"
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
51 #include "input.h"
5832
5e41e06f6a78 [project @ 2006-05-26 21:41:32 by jwe]
jwe
parents: 5823
diff changeset
52 #include "load-path.h"
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
53 #include "octave.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20918
diff changeset
54 #include "ovl.h"
1355
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
55 #include "pager.h"
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
56 #include "procstream.h"
94697d007075 [project @ 1995-09-05 20:04:15 by jwe]
jwe
parents: 1341
diff changeset
57 #include "sysdep.h"
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
58 #include "interpreter-private.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents: 22089
diff changeset
59 #include "interpreter.h"
1449
df589c97e140 [project @ 1995-09-20 03:49:51 by jwe]
jwe
parents: 1402
diff changeset
60 #include "unwind-prot.h"
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
61 #include "utils.h"
1742
a02f140ed897 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents: 1728
diff changeset
62 #include "variables.h"
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
63
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
64 // TRUE means we ask for confirmation before recursively removing a
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
65 // directory tree.
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
66 static bool Vconfirm_recursive_rmdir = true;
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
67
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
68 namespace octave
1328
ec2ab864e8eb [project @ 1995-08-22 22:32:34 by jwe]
jwe
parents: 1315
diff changeset
69 {
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
70 // The time we last time we changed directories.
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
71 sys::time Vlast_chdir_time = 0.0;
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16094
diff changeset
72
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
73 int change_to_directory (const std::string& newdir)
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
74 {
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
75 std::string xdir = octave::sys::file_ops::tilde_expand (newdir);
1328
ec2ab864e8eb [project @ 1995-08-22 22:32:34 by jwe]
jwe
parents: 1315
diff changeset
76
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
77 int cd_ok = octave::sys::env::chdir (xdir);
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6233
diff changeset
78
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
79 if (! cd_ok)
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
80 error ("%s: %s", newdir.c_str (), std::strerror (errno));
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
81
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
82 Vlast_chdir_time.stamp ();
5832
5e41e06f6a78 [project @ 2006-05-26 21:41:32 by jwe]
jwe
parents: 5823
diff changeset
83
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
84 // FIXME: should these actions be handled as a list of functions
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
85 // to call so users can add their own chdir handlers?
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16094
diff changeset
86
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
87 octave::interpreter& interp
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
88 = octave::__get_interpreter__ ("octave_change_to_directory");
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
89
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
90 octave::load_path& lp = interp.get_load_path ();
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
91
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
92 lp.update ();
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20940
diff changeset
93
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
94 octave::event_manager& evmgr = interp.get_event_manager ();
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
95
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
96 evmgr.change_directory (octave::sys::env::get_current_directory ());
1328
ec2ab864e8eb [project @ 1995-08-22 22:32:34 by jwe]
jwe
parents: 1315
diff changeset
97
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
98 return cd_ok;
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
99 }
1328
ec2ab864e8eb [project @ 1995-08-22 22:32:34 by jwe]
jwe
parents: 1315
diff changeset
100 }
ec2ab864e8eb [project @ 1995-08-22 22:32:34 by jwe]
jwe
parents: 1315
diff changeset
101
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
102 DEFUN (cd, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
103 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
104 @deftypefn {} {} cd @var{dir}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
105 @deftypefnx {} {} cd
27190
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
106 @deftypefnx {} {@var{old_dir} =} cd
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
107 @deftypefnx {} {@var{old_dir} =} cd (@var{dir})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
108 @deftypefnx {} {} chdir @dots{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
109 Change the current working directory to @var{dir}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
110
27190
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
111 If called with no input or output arguments, the current directory is
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
112 changed to the user's home directory (@qcode{"~"}).
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
113
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
114 For example,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
115
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
116 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
117 cd ~/octave
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
118 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
119
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
120 @noindent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
121 changes the current working directory to @file{~/octave}. If the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
122 directory does not exist, an error message is printed and the working
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
123 directory is not changed.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
124
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
125 @code{chdir} is an alias for @code{cd} and can be used in all of the same
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
126 calling formats.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
127
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
128 Compatibility Note: When called with no arguments, @sc{matlab} prints the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
129 present working directory rather than changing to the user's home directory.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
130 @seealso{pwd, mkdir, rmdir, dir, ls}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
131 @end deftypefn */)
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
132 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
133 int nargin = args.length ();
20884
f1b2a2dbc0e1 2015 Code Sprint: use ovl () in C++ files.
José Luis García Pallero <jgpallero@gmail.com>
parents: 20853
diff changeset
134
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
135 if (nargin > 1)
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
136 print_usage ();
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
137
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
138 octave_value_list retval;
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1750
diff changeset
139
17397
0bf2fc8562c9 doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents: 17281
diff changeset
140 if (nargout > 0)
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
141 retval = octave_value (octave::sys::env::get_current_directory ());
17397
0bf2fc8562c9 doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents: 17281
diff changeset
142
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
143 if (nargin == 1)
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
144 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
145 std::string dirname = args(0).xstring_value ("cd: DIR must be a string");
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
146
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20804
diff changeset
147 if (! dirname.empty ())
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
148 octave::change_to_directory (dirname);
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
149 }
27190
8ebe70b98e97 cd: only change to home directory if nargin and nargout are zero (bug #41275)
Michael C. Grant <mcg@cvxr.com>
parents: 26376
diff changeset
150 else if (nargout == 0)
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
151 {
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
152 std::string home_dir = octave::sys::env::get_home_directory ();
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
153
17397
0bf2fc8562c9 doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents: 17281
diff changeset
154 if (! home_dir.empty ())
27395
4164895adf79 move octave_change_to_directory to octave namespace and make extern
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
155 octave::change_to_directory (home_dir);
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
156 }
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
157
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
158 return retval;
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
159 }
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
160
611
60f885cd0d87 [project @ 1994-08-14 20:53:44 by jwe]
jwe
parents: 549
diff changeset
161 DEFALIAS (chdir, cd);
60f885cd0d87 [project @ 1994-08-14 20:53:44 by jwe]
jwe
parents: 549
diff changeset
162
6482
7e958a1532c6 [project @ 2007-04-04 02:37:07 by jwe]
jwe
parents: 6323
diff changeset
163 DEFUN (pwd, , ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
164 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
165 @deftypefn {} {} pwd ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
166 @deftypefnx {} {@var{dir} =} pwd ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
167 Return the current working directory.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
168 @seealso{cd, dir, ls, mkdir, rmdir}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
169 @end deftypefn */)
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
170 {
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
171 return ovl (octave::sys::env::get_current_directory ());
523
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
172 }
4a07f0083ab0 [project @ 1994-07-20 18:33:47 by jwe]
jwe
parents:
diff changeset
173
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
174 DEFUN (readdir, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
175 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
176 @deftypefn {} {@var{files} =} readdir (@var{dir})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
177 @deftypefnx {} {[@var{files}, @var{err}, @var{msg}] =} readdir (@var{dir})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
178 Return the names of files in the directory @var{dir} as a cell array of
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
179 strings.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
180
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
181 If an error occurs, return an empty cell array in @var{files}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
182 If successful, @var{err} is 0 and @var{msg} is an empty string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
183 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
184 error message.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
185 @seealso{ls, dir, glob, what}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
186 @end deftypefn */)
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
187 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
188 if (args.length () != 1)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
189 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
190
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
191 std::string dirname = args(0).xstring_value ("readdir: DIR must be a string");
2669
c821858188b6 [project @ 1997-02-13 18:25:39 by jwe]
jwe
parents: 2512
diff changeset
192
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
193 octave_value_list retval = ovl (Cell (), -1.0, "");
20581
fd0efcdb3718 use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents: 20558
diff changeset
194
21897
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
195 dirname = octave::sys::file_ops::tilde_expand (dirname);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
196
25516
8945a6a6c0eb Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25407
diff changeset
197 string_vector dirlist;
8945a6a6c0eb Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25407
diff changeset
198 std::string msg;
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
199
25516
8945a6a6c0eb Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25407
diff changeset
200 if (octave::sys::get_dirlist (dirname, dirlist, msg))
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
201 {
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
202 retval(0) = Cell (dirlist.sort ());
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
203 retval(1) = 0.0;
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
204 }
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
205 else
25516
8945a6a6c0eb Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25407
diff changeset
206 retval(2) = msg;
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
207
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
208 return retval;
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
209 }
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
210
17397
0bf2fc8562c9 doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents: 17281
diff changeset
211 // FIXME: should maybe also allow second arg to specify mode?
0bf2fc8562c9 doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents: 17281
diff changeset
212 // OTOH, that might cause trouble with compatibility later...
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
213
21696
b8c05cc524ef mkdir.m: new script to implement recursive mkdir (bug #30650).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21301
diff changeset
214 DEFUN (__mkdir__, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
215 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
216 @deftypefn {} {} __mkdir__ (@var{parent}, @var{dir})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
217 Internal function called by mkdir.m.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
218 @seealso{mkdir, rmdir, pwd, cd, umask}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
219 @end deftypefn */)
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
220 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
221 int nargin = args.length ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
222
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
223 if (nargin < 1 || nargin > 2)
21696
b8c05cc524ef mkdir.m: new script to implement recursive mkdir (bug #30650).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21301
diff changeset
224 print_usage ("mkdir");
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
225
6187
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
226 std::string dirname;
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
227
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
228 if (nargin == 2)
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
229 {
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20667
diff changeset
230 std::string parent = args(0).xstring_value ("mkdir: PARENT must be a string");
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20667
diff changeset
231 std::string dir = args(1).xstring_value ("mkdir: DIR must be a string");
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
232
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
233 dirname = octave::sys::file_ops::concat (parent, dir);
6187
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
234 }
6200
1ec9de3cd12c [project @ 2006-12-05 18:05:11 by jwe]
jwe
parents: 6192
diff changeset
235 else if (nargin == 1)
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20667
diff changeset
236 dirname = args(0).xstring_value ("mkdir: DIR must be a string");
6187
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
237
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
238 dirname = octave::sys::file_ops::tilde_expand (dirname);
6187
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
239
21736
0504351a45e6 use namespace for file_stat classes
John W. Eaton <jwe@octave.org>
parents: 21735
diff changeset
240 octave::sys::file_stat fs (dirname);
7970
b6d4c644b4b6 Fmkdir: improve compatibility
John W. Eaton <jwe@octave.org>
parents: 7272
diff changeset
241
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
242 if (fs && fs.is_dir ())
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
243 {
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
244 // For Matlab compatibility, return true when directory already exists.
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
245 return ovl (true, "directory exists", "mkdir");
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
246 }
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
247 else
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
248 {
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
249 std::string msg;
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
250
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
251 int status = octave::sys::mkdir (dirname, 0777, msg);
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
252
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
253 if (status < 0)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
254 return ovl (false, msg, "mkdir");
6187
2a8922007c12 [project @ 2006-11-29 01:59:59 by jwe]
jwe
parents: 6134
diff changeset
255 else
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
256 return ovl (true, "", "");
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
257 }
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
258 }
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
259
25407
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
260 DEFMETHODX ("rmdir", Frmdir, interp, args, ,
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
261 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
262 @deftypefn {} {} rmdir @var{dir}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
263 @deftypefnx {} {} rmdir (@var{dir}, "s")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
264 @deftypefnx {} {[@var{status}, @var{msg}, @var{msgid}] =} rmdir (@dots{})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
265 Remove the directory named @var{dir}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
266
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
267 If the optional second parameter is supplied with value @qcode{"s"},
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
268 recursively remove all subdirectories as well.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
269
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
270 If successful, @var{status} is 1, and @var{msg}, @var{msgid} are empty
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
271 character strings (""). Otherwise, @var{status} is 0, @var{msg} contains a
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
272 system-dependent error message, and @var{msgid} contains a unique message
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
273 identifier.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
274
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
275 @seealso{mkdir, confirm_recursive_rmdir, pwd}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
276 @end deftypefn */)
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
277 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
278 int nargin = args.length ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
279
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
280 if (nargin < 1 || nargin > 2)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
281 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
282
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
283 std::string dirname = args(0).xstring_value ("rmdir: DIR must be a string");
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5444
diff changeset
284
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
285 std::string fulldir = octave::sys::file_ops::tilde_expand (dirname);
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
286 int status = -1;
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
287 std::string msg;
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
288
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
289 octave::event_manager& evmgr = interp.get_event_manager ();
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
290
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
291 if (nargin == 2)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
292 {
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
293 if (args(1).string_value () != "s")
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23743
diff changeset
294 error (R"(rmdir: second argument must be "s" for recursive removal)");
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
295
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
296 bool doit = true;
20581
fd0efcdb3718 use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents: 20558
diff changeset
297
27301
a2b1ba6c92d5 eliminate unnecessary application::interative function
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
298 if (interp.interactive ()
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
299 && ! octave::application::forced_interactive ()
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
300 && Vconfirm_recursive_rmdir)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
301 {
25407
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
302 octave::input_system& input_sys = interp.get_input_system ();
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
303
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
304 std::string prompt = "remove entire contents of " + fulldir + "? ";
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
305
25407
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
306 doit = input_sys.yes_or_no (prompt);
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
307 }
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
308
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
309 if (doit)
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
310 {
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
311 evmgr.file_remove (fulldir, "");
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
312 status = octave::sys::recursive_rmdir (fulldir, msg);
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
313 }
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
314 }
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
315 else
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
316 {
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
317 evmgr.file_remove (fulldir, "");
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
318 status = octave::sys::rmdir (fulldir, msg);
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
319 }
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
320
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
321 evmgr.file_renamed (status >= 0);
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
322
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
323 if (status < 0)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
324 return ovl (false, msg, "rmdir");
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
325 else
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
326 return ovl (true, "", "");
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
327 }
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
328
10197
4d433bd2d4dc attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
329 DEFUNX ("link", Flink, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
330 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
331 @deftypefn {} {} link @var{old} @var{new}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
332 @deftypefnx {} {[@var{err}, @var{msg}] =} link (@var{old}, @var{new})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
333 Create a new link (also known as a hard link) to an existing file.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
334
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
335 If successful, @var{err} is 0 and @var{msg} is an empty string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
336 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
337 error message.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
338 @seealso{symlink, unlink, readlink, lstat}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
339 @end deftypefn */)
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
340 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
341 if (args.length () != 2)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
342 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
343
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
344 std::string from = args(0).xstring_value ("link: OLD must be a string");
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
345 std::string to = args(1).xstring_value ("link: NEW must be a string");
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
346
21897
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
347 from = octave::sys::file_ops::tilde_expand (from);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
348 to = octave::sys::file_ops::tilde_expand (to);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
349
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
350 std::string msg;
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
351
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
352 int status = octave::sys::link (from, to, msg);
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
353
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
354 if (status < 0)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
355 return ovl (-1.0, msg);
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
356 else
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
357 return ovl (status, "");
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
358 }
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
359
10197
4d433bd2d4dc attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
360 DEFUNX ("symlink", Fsymlink, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
361 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
362 @deftypefn {} {} symlink @var{old} @var{new}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
363 @deftypefnx {} {[@var{err}, @var{msg}] =} symlink (@var{old}, @var{new})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
364 Create a symbolic link @var{new} which contains the string @var{old}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
365
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
366 If successful, @var{err} is 0 and @var{msg} is an empty string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
367 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
368 error message.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
369 @seealso{link, unlink, readlink, lstat}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
370 @end deftypefn */)
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
371 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
372 if (args.length () != 2)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
373 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
374
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
375 std::string from = args(0).xstring_value ("symlink: OLD must be a string");
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
376 std::string to = args(1).xstring_value ("symlink: NEW must be a string");
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
377
21897
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
378 from = octave::sys::file_ops::tilde_expand (from);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
379 to = octave::sys::file_ops::tilde_expand (to);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
380
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
381 std::string msg;
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
382
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
383 int status = octave::sys::symlink (from, to, msg);
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
384
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
385 if (status < 0)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
386 return ovl (-1.0, msg);
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
387 else
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
388 return ovl (status, "");
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
389 }
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
390
10197
4d433bd2d4dc attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
391 DEFUNX ("readlink", Freadlink, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
392 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
393 @deftypefn {} {} readlink @var{symlink}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
394 @deftypefnx {} {[@var{result}, @var{err}, @var{msg}] =} readlink (@var{symlink})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
395 Read the value of the symbolic link @var{symlink}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
396
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
397 If successful, @var{result} contains the contents of the symbolic link
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
398 @var{symlink}, @var{err} is 0, and @var{msg} is an empty string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
399 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
400 error message.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
401 @seealso{lstat, symlink, link, unlink, delete}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
402 @end deftypefn */)
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
403 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
404 if (args.length () != 1)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
405 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
406
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
407 std::string symlink = args(0).xstring_value ("readlink: SYMLINK must be a string");
20581
fd0efcdb3718 use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents: 20558
diff changeset
408
21897
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
409 symlink = octave::sys::file_ops::tilde_expand (symlink);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
410
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
411 std::string result, msg;
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
412
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
413 int status = octave::sys::readlink (symlink, result, msg);
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
414
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
415 if (status < 0)
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
416 return ovl ("", -1.0, msg);
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
417 else
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
418 return ovl (result, status, "");
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
419 }
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3690
diff changeset
420
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
421 DEFMETHODX ("rename", Frename, interp, args, ,
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
422 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
423 @deftypefn {} {} rename @var{old} @var{new}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
424 @deftypefnx {} {[@var{err}, @var{msg}] =} rename (@var{old}, @var{new})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
425 Change the name of file @var{old} to @var{new}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
426
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
427 If successful, @var{err} is 0 and @var{msg} is an empty string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
428 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
429 error message.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
430 @seealso{movefile, copyfile, ls, dir}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
431 @end deftypefn */)
1401
633199854158 [project @ 1995-09-15 04:15:27 by jwe]
jwe
parents: 1389
diff changeset
432 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
433 if (args.length () != 2)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
434 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
435
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
436 std::string from = args(0).xstring_value ("rename: OLD must be a string");
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
437 std::string to = args(1).xstring_value ("rename: NEW must be a string");
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1690
diff changeset
438
21897
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
439 from = octave::sys::file_ops::tilde_expand (from);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
440 to = octave::sys::file_ops::tilde_expand (to);
39afd54c2981 perform tilde expansion for more file and directory functions
John W. Eaton <jwe@octave.org>
parents: 21852
diff changeset
441
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
442 std::string msg;
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1690
diff changeset
443
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
444 octave::event_manager& evmgr = interp.get_event_manager ();
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27190
diff changeset
445
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
446 evmgr.file_remove (from, to);
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
447
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
448 int status = octave::sys::rename (from, to, msg);
2669
c821858188b6 [project @ 1997-02-13 18:25:39 by jwe]
jwe
parents: 2512
diff changeset
449
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
450 if (status < 0)
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
451 {
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
452 evmgr.file_renamed (false);
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
453 return ovl (-1.0, msg);
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
454 }
20898
8da80da1ac37 maint: Use ovl() more places in the code.
Rik <rik@octave.org>
parents: 20884
diff changeset
455 else
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
456 {
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
457 evmgr.file_renamed (true);
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
458 return ovl (status, "");
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25516
diff changeset
459 }
1389
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
460 }
affbd42dd0c1 [project @ 1995-09-14 07:41:09 by jwe]
jwe
parents: 1380
diff changeset
461
2495
29cd3862a9dc [project @ 1996-11-11 02:39:49 by jwe]
jwe
parents: 2442
diff changeset
462 DEFUN (glob, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
463 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
464 @deftypefn {} {} glob (@var{pattern})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
465 Given an array of pattern strings (as a char array or a cell array) in
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
466 @var{pattern}, return a cell array of filenames that match any of
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
467 them, or an empty cell array if no patterns match.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
468
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
469 The pattern strings are interpreted as filename globbing patterns (as they
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
470 are used by Unix shells).
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
471
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
472 Within a pattern
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
473
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
474 @table @code
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
475 @item *
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
476 matches any string, including the null string,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
477
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
478 @item ?
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
479 matches any single character, and
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
480
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
481 @item [@dots{}]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
482 matches any of the enclosed characters.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
483 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
484
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
485 Tilde expansion is performed on each of the patterns before looking for
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
486 matching filenames. For example:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
487
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
488 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
489 ls
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
490 @result{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
491 file1 file2 file3 myfile1 myfile1b
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
492 glob ("*file1")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
493 @result{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
494 @{
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
495 [1,1] = file1
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
496 [2,1] = myfile1
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
497 @}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
498 glob ("myfile?")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
499 @result{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
500 @{
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
501 [1,1] = myfile1
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
502 @}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
503 glob ("file[12]")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
504 @result{}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
505 @{
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
506 [1,1] = file1
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
507 [2,1] = file2
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
508 @}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
509 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
510 @seealso{ls, dir, readdir, what}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
511 @end deftypefn */)
2495
29cd3862a9dc [project @ 1996-11-11 02:39:49 by jwe]
jwe
parents: 2442
diff changeset
512 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
513 if (args.length () != 1)
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5794
diff changeset
514 print_usage ();
2495
29cd3862a9dc [project @ 1996-11-11 02:39:49 by jwe]
jwe
parents: 2442
diff changeset
515
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20962
diff changeset
516 string_vector pat = args(0).xstring_vector_value ("glob: PATTERN must be a string");
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
517
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
518 glob_match pattern (octave::sys::file_ops::tilde_expand (pat));
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
519
21127
df7891224709 maint: Use "return ovl (...)" in DEFUN macros.
Rik <rik@octave.org>
parents: 21100
diff changeset
520 return ovl (Cell (pattern.glob ()));
2495
29cd3862a9dc [project @ 1996-11-11 02:39:49 by jwe]
jwe
parents: 2442
diff changeset
521 }
29cd3862a9dc [project @ 1996-11-11 02:39:49 by jwe]
jwe
parents: 2442
diff changeset
522
22155
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
523
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
524 DEFUN (__wglob__, args, ,
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
525 doc: /* -*- texinfo -*-
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
526 @deftypefn {} {} __wglob__ (@var{pattern})
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
527 Windows-like glob for dir.
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
528
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
529 Given an array of pattern strings (as a char array or a cell array) in
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
530 @var{pattern}, return a cell array of filenames that match any of
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
531 them, or an empty cell array if no patterns match.
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
532
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
533 The pattern strings are interpreted as filename globbing patterns
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
534 (roughly as they are used by Windows dir).
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
535
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
536 Within a pattern
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
537
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
538 @table @code
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
539 @item *
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
540 matches any string, including the null string,
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
541
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
542 @item ?
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
543 matches any single character, and
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
544
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
545 @item *.*
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
546 matches any string, even if no . is present.
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
547 @end table
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
548
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
549 Tilde expansion is performed on each of the patterns before looking for
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
550 matching filenames. For example:
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
551
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
552 @example
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
553 ls
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
554 @result{}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
555 file1 file2 file3 myfile1 myfile1b
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
556 glob ("*file1")
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
557 @result{}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
558 @{
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
559 [1,1] = file1
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
560 [2,1] = myfile1
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
561 @}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
562 glob ("myfile?")
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
563 @result{}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
564 @{
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
565 [1,1] = myfile1
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
566 @}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
567 glob ("*.*")
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
568 @result{}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
569 @{
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
570 [1,1] = file1
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
571 [2,1] = file2
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
572 [3,1] = file3
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
573 [4,1] = myfile1
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
574 [5,1] = myfile1b
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
575 @}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
576 @end example
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
577 @seealso{glob, dir}
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
578 @end deftypefn */)
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
579 {
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
580 if (args.length () == 0)
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
581 return ovl ();
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
582
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
583 string_vector pat = args(0).string_vector_value ();
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
584
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
585 string_vector pattern (octave::sys::file_ops::tilde_expand (pat));
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
586
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
587 return ovl (Cell (octave::sys::windows_glob (pattern)));
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
588 }
289409b2992d Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22094
diff changeset
589
10335
9dd04a06410e document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 10315
diff changeset
590 /*
9dd04a06410e document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 10315
diff changeset
591 %!test
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19119
diff changeset
592 %! tmpdir = tempname;
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
593 %! 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
594 %! if (mkdir (tmpdir))
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
595 %! cwd = pwd;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
596 %! cd (tmpdir);
16933
e39f00a32dc7 maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents: 16892
diff changeset
597 %! 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
598 %! a = 0;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
599 %! for n = 1:5
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
600 %! save (filename{n}, "a");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
601 %! endfor
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
602 %! else
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
603 %! rmdir (tmpdir);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
604 %! 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
605 %! endif
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
606 %! else
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
607 %! 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
608 %! endif
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
609 %! result1 = glob ("*file1");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
610 %! result2 = glob ("myfile?");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
611 %! result3 = glob ("file[12]");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
612 %! for n = 1:5
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
613 %! delete (filename{n});
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
614 %! endfor
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
615 %! cd (cwd);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
616 %! rmdir (tmpdir);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
617 %! assert (result1, {"file1"; "myfile1"});
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
618 %! assert (result2, {"myfile1"});
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14366
diff changeset
619 %! assert (result3, {"file1"; "file2"});
10335
9dd04a06410e document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 10315
diff changeset
620 */
9dd04a06410e document glob patterns
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 10315
diff changeset
621
19119
f506de9089e8 Deprecate fnmatch function.
Rik <rik@octave.org>
parents: 17787
diff changeset
622 DEFUN (__fnmatch__, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
623 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
624 @deftypefn {} {} fnmatch (@var{pattern}, @var{string})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
625 Return true or false for each element of @var{string} that matches any of
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
626 the elements of the string array @var{pattern}, using the rules of
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
627 filename pattern matching.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
628
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
629 For example:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
630
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
631 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
632 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
633 fnmatch ("a*b", @{"ab"; "axyzb"; "xyzab"@})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
634 @result{} [ 1; 1; 0 ]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
635 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
636 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
637 @seealso{glob, regexp}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
638 @end deftypefn */)
2496
9823f8bfd1a5 [project @ 1996-11-11 03:17:10 by jwe]
jwe
parents: 2495
diff changeset
639 {
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
640 if (args.length () != 2)
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5794
diff changeset
641 print_usage ();
2496
9823f8bfd1a5 [project @ 1996-11-11 03:17:10 by jwe]
jwe
parents: 2495
diff changeset
642
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20962
diff changeset
643 string_vector pat = args(0).string_vector_value ();
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20962
diff changeset
644 string_vector str = args(1).string_vector_value ();
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
645
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
646 glob_match pattern (octave::sys::file_ops::tilde_expand (pat));
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
647
21078
49852ff04747 maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents: 20990
diff changeset
648 return ovl (pattern.match (str));
2496
9823f8bfd1a5 [project @ 1996-11-11 03:17:10 by jwe]
jwe
parents: 2495
diff changeset
649 }
9823f8bfd1a5 [project @ 1996-11-11 03:17:10 by jwe]
jwe
parents: 2495
diff changeset
650
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
651 DEFUN (filesep, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
652 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
653 @deftypefn {} {} filesep ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
654 @deftypefnx {} {} filesep ("all")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
655 Return the system-dependent character used to separate directory names.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
656
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
657 If @qcode{"all"} is given, the function returns all valid file separators
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
658 in the form of a string. The list of file separators is system-dependent.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
659 It is @samp{/} (forward slash) under UNIX or @w{Mac OS X}, @samp{/} and
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
660 @samp{\} (forward and backward slashes) under Windows.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
661 @seealso{pathsep}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
662 @end deftypefn */)
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
663 {
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20898
diff changeset
664 int nargin = args.length ();
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
665
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
666 if (nargin > 1)
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
667 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
668
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20898
diff changeset
669 octave_value retval;
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20898
diff changeset
670
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
671 if (nargin == 0)
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
672 retval = octave::sys::file_ops::dir_sep_str ();
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
673 else
8317
135c0e7d7802 Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8109
diff changeset
674 {
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20667
diff changeset
675 std::string s = args(0).xstring_value ("filesep: argument must be a string");
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20898
diff changeset
676 if (s != "all")
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23743
diff changeset
677 error (R"(filesep: argument must be "all")");
20918
6f0bd96f93c0 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20898
diff changeset
678
21733
cb0fdd941d84 use namespace for system file_ops class
John W. Eaton <jwe@octave.org>
parents: 21732
diff changeset
679 retval = octave::sys::file_ops::dir_sep_chars ();
8317
135c0e7d7802 Extend filesep functionality by allowing to return all valid file separators
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8109
diff changeset
680 }
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
681
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
682 return retval;
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
683 }
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
684
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23445
diff changeset
685 DEFUN (pathsep, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
686 doc: /* -*- texinfo -*-
24986
0b9e7fcaab91 doc: grammarcheck docstrings in C++ files ahead of 4.4 release.
Rik <rik@octave.org>
parents: 24534
diff changeset
687 @deftypefn {} {@var{val} =} pathsep ()
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23445
diff changeset
688 Query the character used to separate directories in a path.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
689 @seealso{filesep}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
690 @end deftypefn */)
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
691 {
9266
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
692 int nargin = args.length ();
1d3b91166b9c allow pathsep to be set
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
693
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23445
diff changeset
694 if (nargin > 0)
20804
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
695 print_usage ();
a6eaedd8bd75 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20752
diff changeset
696
23743
e919cc8d9d92 don't use singleton pattern in pathsearch class; treat pathsep as constant
John W. Eaton <jwe@octave.org>
parents: 23445
diff changeset
697 return ovl (octave::directory_path::path_sep_str ());
5777
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
698 }
246b1fc1e628 [project @ 2006-04-26 18:16:24 by jwe]
jwe
parents: 5775
diff changeset
699
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5777
diff changeset
700 DEFUN (confirm_recursive_rmdir, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
701 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
702 @deftypefn {} {@var{val} =} confirm_recursive_rmdir ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
703 @deftypefnx {} {@var{old_val} =} confirm_recursive_rmdir (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
704 @deftypefnx {} {} confirm_recursive_rmdir (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
705 Query or set the internal variable that controls whether Octave
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
706 will ask for confirmation before recursively removing a directory tree.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
707
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
708 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
709 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
710 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
711 @seealso{rmdir}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
712 @end deftypefn */)
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5639
diff changeset
713 {
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5777
diff changeset
714 return SET_INTERNAL_VARIABLE (confirm_recursive_rmdir);
4264
4e2d2516da22 [project @ 2003-01-03 05:30:34 by jwe]
jwe
parents: 4233
diff changeset
715 }