annotate liboctave/file-ops.h @ 7961:a5d1e27ee1f4 ss-3-1-51

3.1.51 snapshot
author John W. Eaton <jwe@octave.org>
date Tue, 22 Jul 2008 11:40:48 -0400
parents 05ee52d7fad6
children a2ab20ba78f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
1 /*
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1996, 1997, 2000, 2002, 2005, 2006, 2007 John W. Eaton
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
4
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
6
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
10 option) any later version.
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
11
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
15 for more details.
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
16
a51354c34bea [project @ 1996-01-23 03:33:34 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: 6108
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 <http://www.gnu.org/licenses/>.
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
20
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
21 */
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
22
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_file_ops_h)
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
24 #define octave_file_ops_h 1
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
25
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
26 #include <string>
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
27
2283
cc9b29d0b43e [project @ 1996-05-27 17:40:57 by jwe]
jwe
parents: 2074
diff changeset
28 #ifdef HAVE_SYS_TYPES_H
cc9b29d0b43e [project @ 1996-05-27 17:40:57 by jwe]
jwe
parents: 2074
diff changeset
29 #include <sys/types.h>
cc9b29d0b43e [project @ 1996-05-27 17:40:57 by jwe]
jwe
parents: 2074
diff changeset
30 #endif
cc9b29d0b43e [project @ 1996-05-27 17:40:57 by jwe]
jwe
parents: 2074
diff changeset
31
3040
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
32 #include "str-vec.h"
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
33
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
34 struct
6108
143b556ce725 [project @ 2006-10-27 01:45:54 by jwe]
jwe
parents: 5476
diff changeset
35 OCTAVE_API
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
36 file_ops
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
37 {
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
38 static int mkdir (const std::string&, mode_t);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
39 static int mkdir (const std::string&, mode_t, std::string&);
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
40
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
41 static int mkfifo (const std::string&, mode_t);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
42 static int mkfifo (const std::string&, mode_t, std::string&);
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
43
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
44 static int link (const std::string&, const std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
45 static int link (const std::string&, const std::string&, std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
46
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
47 static int symlink (const std::string&, const std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
48 static int symlink (const std::string&, const std::string&, std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
49
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
50 static int readlink (const std::string&, std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
51 static int readlink (const std::string&, std::string&, std::string&);
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
52
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
53 static int rename (const std::string&, const std::string&);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
54 static int rename (const std::string&, const std::string&, std::string&);
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
55
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
56 static int rmdir (const std::string&);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
57 static int rmdir (const std::string&, std::string&);
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
58
5476
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
59 static int recursive_rmdir (const std::string&);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
60 static int recursive_rmdir (const std::string&, std::string&);
941f0fc6b596 [project @ 2005-09-29 22:46:07 by jwe]
jwe
parents: 5307
diff changeset
61
5138
5fa9670b5956 [project @ 2005-02-09 23:13:03 by jwe]
jwe
parents: 4101
diff changeset
62 static std::string canonicalize_file_name (const std::string&);
5fa9670b5956 [project @ 2005-02-09 23:13:03 by jwe]
jwe
parents: 4101
diff changeset
63 static std::string canonicalize_file_name (const std::string&, std::string&);
5fa9670b5956 [project @ 2005-02-09 23:13:03 by jwe]
jwe
parents: 4101
diff changeset
64
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
65 static std::string tempnam (const std::string&, const std::string&);
3710
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
66 static std::string tempnam (const std::string&, const std::string&,
9a77deefb8c9 [project @ 2000-08-02 20:47:44 by jwe]
jwe
parents: 3504
diff changeset
67 std::string&);
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
68
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
69 typedef std::string (*tilde_expansion_hook) (const std::string&);
3040
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
70
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
71 static tilde_expansion_hook tilde_expansion_preexpansion_hook;
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
72
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
73 static tilde_expansion_hook tilde_expansion_failure_hook;
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
74
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
75 static string_vector tilde_additional_prefixes;
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
76
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
77 static string_vector tilde_additional_suffixes;
443851377f3f [project @ 1997-06-06 09:29:28 by jwe]
jwe
parents: 2937
diff changeset
78
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
79 static std::string tilde_expand (const std::string&);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
80 static string_vector tilde_expand (const string_vector&);
1778
cb7512dadf2d [project @ 1996-01-24 05:20:38 by jwe]
jwe
parents: 1773
diff changeset
81
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
82 static int umask (mode_t);
2668
0d865ef7478f [project @ 1997-02-13 18:21:47 by jwe]
jwe
parents: 2283
diff changeset
83
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
84 static int unlink (const std::string&);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3040
diff changeset
85 static int unlink (const std::string&, std::string&);
4097
596f88296519 [project @ 2002-10-09 20:26:27 by jwe]
jwe
parents: 3710
diff changeset
86
596f88296519 [project @ 2002-10-09 20:26:27 by jwe]
jwe
parents: 3710
diff changeset
87 static bool is_dir_sep (char);
4101
ea537559ab07 [project @ 2002-10-11 20:57:21 by jwe]
jwe
parents: 4099
diff changeset
88
7272
05ee52d7fad6 [project @ 2007-12-10 07:06:00 by jwe]
jwe
parents: 7017
diff changeset
89 static std::string concat (const std::string&, const std::string&);
05ee52d7fad6 [project @ 2007-12-10 07:06:00 by jwe]
jwe
parents: 7017
diff changeset
90
4101
ea537559ab07 [project @ 2002-10-11 20:57:21 by jwe]
jwe
parents: 4099
diff changeset
91 static char dir_sep_char;
ea537559ab07 [project @ 2002-10-11 20:57:21 by jwe]
jwe
parents: 4099
diff changeset
92 static std::string dir_sep_str;
ea537559ab07 [project @ 2002-10-11 20:57:21 by jwe]
jwe
parents: 4099
diff changeset
93 static std::string dir_sep_chars;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
94 };
1765
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
95
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
96 #endif
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
97
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
98 /*
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
99 ;;; Local Variables: ***
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
100 ;;; mode: C++ ***
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
101 ;;; End: ***
a51354c34bea [project @ 1996-01-23 03:33:34 by jwe]
jwe
parents:
diff changeset
102 */