Mercurial > hg > octave-nkf
annotate libinterp/corefcn/syscalls.cc @ 19301:e90bfaadb489
doc: Increase seealso links between low level C IO functions.
* file-io.cc (Ffclose, Ffclear, Ffflush, Ffrewind, Ffseek, Fftell, Ffprintf,
Fpclose, Ftmpfile, Fmkstemp, Fumask, FP_tmpdir, FSEEK_SET): Increase seealso
links between low level C IO functions. Redo some docstrings.
* syscalls.cc (Fdup2, Ffcntl): Increase seealso links between low level C IO
functions. Redo some docstrings.
* is_valid_file_id.m: Add seealso link to freport.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 20 Sep 2014 12:56:47 -0700 |
parents | b560bac0fca2 |
children | 0f9c5a15c8fa |
rev | line source |
---|---|
2075 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17397
diff
changeset
|
3 Copyright (C) 1996-2013 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10336
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
2075 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2075 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2075 | 21 |
22 */ | |
23 | |
24 // Thomas Baier <baier@ci.tuwien.ac.at> added the original versions of | |
25 // the following functions: | |
26 // | |
27 // mkfifo unlink waitpid | |
28 | |
29 #ifdef HAVE_CONFIG_H | |
30 #include <config.h> | |
31 #endif | |
32 | |
33 #include <cstdio> | |
2669 | 34 #include <cstring> |
2075 | 35 |
36 #include <sys/types.h> | |
37 #include <unistd.h> | |
38 | |
39 #include <fcntl.h> | |
40 | |
17236
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
41 #include "cmd-hist.h" |
2926 | 42 #include "file-ops.h" |
43 #include "file-stat.h" | |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
44 #include "oct-env.h" |
2937 | 45 #include "oct-syscalls.h" |
5547 | 46 #include "oct-uname.h" |
2926 | 47 |
2075 | 48 #include "defun.h" |
49 #include "error.h" | |
2078 | 50 #include "gripes.h" |
2075 | 51 #include "lo-utils.h" |
17236
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
52 #include "oct-hist.h" |
2075 | 53 #include "oct-map.h" |
54 #include "oct-obj.h" | |
55 #include "oct-stdstrm.h" | |
56 #include "oct-stream.h" | |
57 #include "sysdep.h" | |
58 #include "utils.h" | |
2366 | 59 #include "variables.h" |
6321 | 60 #include "input.h" |
2075 | 61 |
10762
d53eb6249892
use scalar map in some syscalls
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
62 static octave_scalar_map |
8549 | 63 mk_stat_map (const base_file_stat& fs) |
2075 | 64 { |
10762
d53eb6249892
use scalar map in some syscalls
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
65 octave_scalar_map m; |
2075 | 66 |
4675 | 67 m.assign ("dev", static_cast<double> (fs.dev ())); |
68 m.assign ("ino", fs.ino ()); | |
5476 | 69 m.assign ("mode", fs.mode ()); |
4675 | 70 m.assign ("modestr", fs.mode_as_string ()); |
71 m.assign ("nlink", fs.nlink ()); | |
72 m.assign ("uid", fs.uid ()); | |
73 m.assign ("gid", fs.gid ()); | |
3887 | 74 #if defined (HAVE_STRUCT_STAT_ST_RDEV) |
4675 | 75 m.assign ("rdev", static_cast<double> (fs.rdev ())); |
2075 | 76 #endif |
4675 | 77 m.assign ("size", fs.size ()); |
78 m.assign ("atime", fs.atime ()); | |
79 m.assign ("mtime", fs.mtime ()); | |
80 m.assign ("ctime", fs.ctime ()); | |
3887 | 81 #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE) |
4675 | 82 m.assign ("blksize", fs.blksize ()); |
2075 | 83 #endif |
3887 | 84 #if defined (HAVE_STRUCT_STAT_ST_BLOCKS) |
4675 | 85 m.assign ("blocks", fs.blocks ()); |
2075 | 86 #endif |
87 | |
88 return m; | |
89 } | |
90 | |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
91 static octave_value_list |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
92 mk_stat_result (const base_file_stat& fs) |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
93 { |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
94 octave_value_list retval; |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
95 |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
96 if (fs) |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
97 { |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
98 retval(2) = std::string (); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
99 retval(1) = 0; |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
100 retval(0) = octave_value (mk_stat_map (fs)); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
101 } |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
102 else |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
103 { |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
104 retval(2) = fs.error (); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
105 retval(1) = -1; |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
106 retval(0) = Matrix (); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
107 } |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
108 |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
109 return retval; |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
110 } |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
111 |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
112 DEFUNX ("dup2", Fdup2, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
113 "-*- texinfo -*-\n\ |
3301 | 114 @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new})\n\ |
2669 | 115 Duplicate a file descriptor.\n\ |
116 \n\ | |
3301 | 117 If successful, @var{fid} is greater than zero and contains the new file\n\ |
10840 | 118 ID@. Otherwise, @var{fid} is negative and @var{msg} contains a\n\ |
3301 | 119 system-dependent error message.\n\ |
19301
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
120 @seealso{fopen, fclose, fcntl}\n\ |
3301 | 121 @end deftypefn") |
2075 | 122 { |
2669 | 123 octave_value_list retval; |
124 | |
3523 | 125 retval(1) = std::string (); |
4294 | 126 retval(0) = -1; |
2075 | 127 |
128 int nargin = args.length (); | |
129 | |
130 if (nargin == 2) | |
131 { | |
3341 | 132 octave_stream old_stream |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
133 = octave_stream_list::lookup (args(0), "dup2"); |
2075 | 134 |
3341 | 135 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
136 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
137 octave_stream new_stream |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
138 = octave_stream_list::lookup (args(1), "dup2"); |
2075 | 139 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
140 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
141 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
142 int i_old = old_stream.file_number (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
143 int i_new = new_stream.file_number (); |
2937 | 144 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
145 if (i_old >= 0 && i_new >= 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
146 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
147 std::string msg; |
2669 | 148 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
149 int status = octave_syscalls::dup2 (i_old, i_new, msg); |
3341 | 150 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
151 retval(1) = msg; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
152 retval(0) = status; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
153 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
154 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
155 } |
3145 | 156 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
157 error ("dup2: invalid stream"); |
2075 | 158 } |
159 else | |
5823 | 160 print_usage (); |
2075 | 161 |
162 return retval; | |
163 } | |
164 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
165 DEFUNX ("exec", Fexec, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 "-*- texinfo -*-\n\ |
3301 | 167 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} exec (@var{file}, @var{args})\n\ |
168 Replace current process with a new process. Calling @code{exec} without\n\ | |
169 first calling @code{fork} will terminate your current Octave process and\n\ | |
170 replace it with the program named by @var{file}. For example,\n\ | |
2669 | 171 \n\ |
3301 | 172 @example\n\ |
173 exec (\"ls\" \"-l\")\n\ | |
174 @end example\n\ | |
2669 | 175 \n\ |
3301 | 176 @noindent\n\ |
177 will run @code{ls} and return you to your shell prompt.\n\ | |
178 \n\ | |
179 If successful, @code{exec} does not return. If @code{exec} does return,\n\ | |
180 @var{err} will be nonzero, and @var{msg} will contain a system-dependent\n\ | |
181 error message.\n\ | |
182 @end deftypefn") | |
2075 | 183 { |
2669 | 184 octave_value_list retval; |
185 | |
3523 | 186 retval(1) = std::string (); |
4294 | 187 retval(0) = -1; |
2075 | 188 |
189 int nargin = args.length (); | |
190 | |
191 if (nargin == 1 || nargin == 2) | |
192 { | |
3523 | 193 std::string exec_file = args(0).string_value (); |
2075 | 194 |
195 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
196 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
197 string_vector exec_args; |
2075 | 198 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
199 if (nargin == 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
200 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
201 string_vector tmp = args(1).all_strings (); |
2075 | 202 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
203 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
204 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
205 int len = tmp.length (); |
2075 | 206 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
207 exec_args.resize (len + 1); |
2075 | 208 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
209 exec_args[0] = exec_file; |
2075 | 210 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
211 for (int i = 0; i < len; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
212 exec_args[i+1] = tmp[i]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
213 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
214 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
215 error ("exec: arguments must be character strings"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
216 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
217 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
218 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
219 exec_args.resize (1); |
2075 | 220 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
221 exec_args[0] = exec_file; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
222 } |
2075 | 223 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
224 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
225 { |
17236
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
226 octave_history_write_timestamp (); |
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
227 |
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
228 if (! command_history::ignoring_entries ()) |
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
229 command_history::clean_up_and_save (); |
6a6e3f1a824c
save history on exec (bug #39734)
John W. Eaton <jwe@octave.org>
parents:
15221
diff
changeset
|
230 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
231 std::string msg; |
2937 | 232 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
233 int status = octave_syscalls::execvp (exec_file, exec_args, msg); |
2669 | 234 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
235 retval(1) = msg; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
236 retval(0) = status; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
237 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
238 } |
2075 | 239 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
240 error ("exec: FILE must be a string"); |
2075 | 241 } |
242 else | |
5823 | 243 print_usage (); |
2075 | 244 |
245 return retval; | |
246 } | |
247 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
248 DEFUNX ("popen2", Fpopen2, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
249 "-*- texinfo -*-\n\ |
6678 | 250 @deftypefn {Built-in Function} {[@var{in}, @var{out}, @var{pid}] =} popen2 (@var{command}, @var{args})\n\ |
6321 | 251 Start a subprocess with two-way communication. The name of the process\n\ |
252 is given by @var{command}, and @var{args} is an array of strings\n\ | |
253 containing options for the command. The file identifiers for the input\n\ | |
254 and output streams of the subprocess are returned in @var{in} and\n\ | |
255 @var{out}. If execution of the command is successful, @var{pid}\n\ | |
256 contains the process ID of the subprocess. Otherwise, @var{pid} is\n\ | |
257 @minus{}1.\n\ | |
258 \n\ | |
10840 | 259 For example:\n\ |
6321 | 260 \n\ |
261 @example\n\ | |
6923 | 262 [in, out, pid] = popen2 (\"sort\", \"-r\");\n\ |
6321 | 263 fputs (in, \"these\\nare\\nsome\\nstrings\\n\");\n\ |
264 fclose (in);\n\ | |
265 EAGAIN = errno (\"EAGAIN\");\n\ | |
266 done = false;\n\ | |
267 do\n\ | |
268 s = fgets (out);\n\ | |
269 if (ischar (s))\n\ | |
270 fputs (stdout, s);\n\ | |
271 elseif (errno () == EAGAIN)\n\ | |
272 sleep (0.1);\n\ | |
273 fclear (out);\n\ | |
274 else\n\ | |
275 done = true;\n\ | |
276 endif\n\ | |
277 until (done)\n\ | |
278 fclose (out);\n\ | |
9563
f5c28d8f5147
syscalls.cc: Recommend waitpid() in popen2() documentation.
Rob Mahurin <rob@utk.edu>
parents:
9209
diff
changeset
|
279 waitpid (pid);\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
280 \n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
281 @print{} these\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
282 @print{} strings\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
283 @print{} some\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
284 @print{} are\n\ |
6321 | 285 @end example\n\ |
9563
f5c28d8f5147
syscalls.cc: Recommend waitpid() in popen2() documentation.
Rob Mahurin <rob@utk.edu>
parents:
9209
diff
changeset
|
286 \n\ |
17968
43c199e83ed7
Reap child process in popen2 %!test block.
Rik <rik@octave.org>
parents:
17951
diff
changeset
|
287 Note that @code{popen2}, unlike @code{popen}, will not @nospell{\"reap\"} the\n\ |
9563
f5c28d8f5147
syscalls.cc: Recommend waitpid() in popen2() documentation.
Rob Mahurin <rob@utk.edu>
parents:
9209
diff
changeset
|
288 child process. If you don't use @code{waitpid} to check the child's\n\ |
9564 | 289 exit status, it will linger until Octave exits.\n\ |
17968
43c199e83ed7
Reap child process in popen2 %!test block.
Rik <rik@octave.org>
parents:
17951
diff
changeset
|
290 @seealso{popen, waitpid}\n\ |
6321 | 291 @end deftypefn") |
292 { | |
293 octave_value_list retval; | |
294 | |
295 retval(2) = -1; | |
296 retval(1) = Matrix (); | |
297 retval(0) = Matrix (); | |
298 | |
299 int nargin = args.length (); | |
300 | |
301 if (nargin >= 1 && nargin <= 3) | |
302 { | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14819
diff
changeset
|
303 std::string exec_file = args(0).string_value (); |
6321 | 304 |
305 if (! error_state) | |
306 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
307 string_vector arg_list; |
6321 | 308 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
309 if (nargin >= 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
310 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
311 string_vector tmp = args(1).all_strings (); |
6321 | 312 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
313 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
314 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
315 int len = tmp.length (); |
6321 | 316 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
317 arg_list.resize (len + 1); |
6321 | 318 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
319 arg_list[0] = exec_file; |
6321 | 320 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
321 for (int i = 0; i < len; i++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
322 arg_list[i+1] = tmp[i]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
323 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
324 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
325 error ("popen2: arguments must be character strings"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
326 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
327 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
328 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
329 arg_list.resize (1); |
6321 | 330 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
331 arg_list[0] = exec_file; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
332 } |
6321 | 333 |
334 if (! error_state) | |
335 { | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14819
diff
changeset
|
336 bool sync_mode = (nargin == 3 ? args(2).bool_value () : false); |
6321 | 337 |
338 if (! error_state) | |
339 { | |
340 int fildes[2]; | |
341 std::string msg; | |
342 pid_t pid; | |
343 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
344 pid = octave_syscalls::popen2 (exec_file, arg_list, sync_mode, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
345 fildes, msg, interactive); |
6321 | 346 if (pid >= 0) |
347 { | |
348 FILE *ifile = fdopen (fildes[1], "r"); | |
349 FILE *ofile = fdopen (fildes[0], "w"); | |
350 | |
351 std::string nm; | |
352 | |
353 octave_stream is = octave_stdiostream::create (nm, ifile, | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
354 std::ios::in); |
6321 | 355 |
356 octave_stream os = octave_stdiostream::create (nm, ofile, | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
357 std::ios::out); |
6321 | 358 |
359 Cell file_ids (1, 2); | |
360 | |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
361 retval(2) = pid; |
6321 | 362 retval(1) = octave_stream_list::insert (is); |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
363 retval(0) = octave_stream_list::insert (os); |
6321 | 364 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
365 else |
6321 | 366 error (msg.c_str ()); |
367 } | |
368 } | |
369 else | |
370 error ("popen2: arguments must be character strings"); | |
371 } | |
372 else | |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
373 error ("popen2: COMMAND argument must be a string"); |
6321 | 374 } |
375 else | |
376 print_usage (); | |
377 | |
378 return retval; | |
379 } | |
380 | |
381 /* | |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
382 |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
383 %!test # UNIX-style test |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
384 %! if (isunix () || ismac ()) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
385 %! [in, out, pid] = popen2 ("sort", "-r"); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
386 %! EAGAIN = errno ("EAGAIN"); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
387 %! fputs (in, "these\nare\nsome\nstrings\n"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
388 %! fclose (in); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
389 %! done = false; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
390 %! str = {}; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
391 %! idx = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
392 %! errs = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
393 %! do |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
394 %! if (ismac ()) # FIXME: Is this necessary? |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
395 %! errno (0); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
396 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
397 %! s = fgets (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
398 %! if (ischar (s)) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
399 %! idx++; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
400 %! str{idx} = s; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
401 %! elseif (errno () == EAGAIN) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
402 %! fclear (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
403 %! sleep (0.1); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
404 %! if (++errs == 100) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
405 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
406 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
407 %! else |
6321 | 408 %! done = true; |
409 %! endif | |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
410 %! until (done) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
411 %! fclose (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
412 %! waitpid (pid); |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
413 %! assert (str, {"these\n","strings\n","some\n","are\n"}); |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
414 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
415 |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
416 %!test # Windows-style test |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
417 %! if (ispc () && ! isunix ()) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
418 %! [in, out, pid] = popen2 ('C:\Windows\system32\sort.exe', "/R"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
419 %! EAGAIN = errno ("EINVAL"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
420 %! fputs (in, "these\r\nare\r\nsome\r\nstrings\r\n"); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
421 %! fclose (in); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
422 %! done = false; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
423 %! str = {}; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
424 %! idx = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
425 %! errs = 0; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
426 %! do |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
427 %! errno (0); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
428 %! s = fgets (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
429 %! if (ischar (s)) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
430 %! idx++; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
431 %! str{idx} = s; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
432 %! elseif (errno () == EAGAIN) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
433 %! fclear (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
434 %! sleep (0.1); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
435 %! if (++errs == 100) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
436 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
437 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
438 %! else |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
439 %! done = true; |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
440 %! endif |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
441 %! until (done) |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
442 %! fclose (out); |
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
443 %! waitpid (pid); |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
444 %! assert (str, {"these\r\n","strings\r\n","some\r\n","are\r\n"}); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
445 %! endif |
18022
c3cd335bd71b
Rewrite failing popen2 test for Windows (bug #40606).
Rik <rik@octave.org>
parents:
17969
diff
changeset
|
446 |
6321 | 447 */ |
448 | |
10259 | 449 DEFUNX ("fcntl", Ffcntl, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
450 "-*- texinfo -*-\n\ |
3301 | 451 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} fcntl (@var{fid}, @var{request}, @var{arg})\n\ |
19301
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
452 Change the properties of the open file @var{fid}.\n\ |
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
453 \n\ |
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
454 The following values may be passed as @var{request}:\n\ |
3301 | 455 \n\ |
456 @vtable @code\n\ | |
457 @item F_DUPFD\n\ | |
458 Return a duplicate file descriptor.\n\ | |
459 \n\ | |
460 @item F_GETFD\n\ | |
461 Return the file descriptor flags for @var{fid}.\n\ | |
462 \n\ | |
463 @item F_SETFD\n\ | |
464 Set the file descriptor flags for @var{fid}.\n\ | |
465 \n\ | |
466 @item F_GETFL\n\ | |
467 Return the file status flags for @var{fid}. The following codes may be\n\ | |
468 returned (some of the flags may be undefined on some systems).\n\ | |
469 \n\ | |
470 @vtable @code\n\ | |
471 @item O_RDONLY\n\ | |
472 Open for reading only.\n\ | |
473 \n\ | |
474 @item O_WRONLY\n\ | |
475 Open for writing only.\n\ | |
2669 | 476 \n\ |
3301 | 477 @item O_RDWR\n\ |
478 Open for reading and writing.\n\ | |
479 \n\ | |
480 @item O_APPEND\n\ | |
481 Append on each write.\n\ | |
482 \n\ | |
5040 | 483 @item O_CREAT\n\ |
484 Create the file if it does not exist.\n\ | |
485 \n\ | |
3301 | 486 @item O_NONBLOCK\n\ |
10791
3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents:
10762
diff
changeset
|
487 Non-blocking mode.\n\ |
3301 | 488 \n\ |
489 @item O_SYNC\n\ | |
490 Wait for writes to complete.\n\ | |
2669 | 491 \n\ |
3301 | 492 @item O_ASYNC\n\ |
493 Asynchronous I/O.\n\ | |
494 @end vtable\n\ | |
495 \n\ | |
496 @item F_SETFL\n\ | |
497 Set the file status flags for @var{fid} to the value specified by\n\ | |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9064
diff
changeset
|
498 @var{arg}. The only flags that can be changed are @w{@code{O_APPEND}} and\n\ |
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9064
diff
changeset
|
499 @w{@code{O_NONBLOCK}}.\n\ |
3301 | 500 @end vtable\n\ |
501 \n\ | |
502 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ | |
503 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
504 system-dependent error message.\n\ | |
19301
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
505 @seealso{fopen, dup2}\n\ |
3301 | 506 @end deftypefn") |
2075 | 507 { |
2669 | 508 octave_value_list retval; |
509 | |
3523 | 510 retval(1) = std::string (); |
4294 | 511 retval(0) = -1; |
2075 | 512 |
513 int nargin = args.length (); | |
514 | |
515 if (nargin == 3) | |
516 { | |
18111
b560bac0fca2
maint: Don't use space between 'args' and '(' when doing indexing.
Rik <rik@octave.org>
parents:
18022
diff
changeset
|
517 octave_stream strm = octave_stream_list::lookup (args(0), "fcntl"); |
2075 | 518 |
3202 | 519 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
520 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
521 int fid = strm.file_number (); |
3715 | 522 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
523 int req = args(1).int_value (true); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
524 int arg = args(2).int_value (true); |
3715 | 525 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
526 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
527 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
528 // FIXME: Need better checking here? |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
529 if (fid < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
530 error ("fcntl: invalid file id"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
531 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
532 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
533 std::string msg; |
2937 | 534 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
535 int status = octave_fcntl (fid, req, arg, msg); |
2669 | 536 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
537 retval(1) = msg; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
538 retval(0) = status; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
539 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
540 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
541 } |
2075 | 542 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
543 error ("fcntl: FID, REQUEST, and ARG must be integers"); |
2075 | 544 } |
545 else | |
5823 | 546 print_usage (); |
2075 | 547 |
548 return retval; | |
549 } | |
550 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
551 DEFUNX ("fork", Ffork, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
552 "-*- texinfo -*-\n\ |
3301 | 553 @deftypefn {Built-in Function} {[@var{pid}, @var{msg}] =} fork ()\n\ |
2669 | 554 Create a copy of the current process.\n\ |
555 \n\ | |
3301 | 556 Fork can return one of the following values:\n\ |
557 \n\ | |
558 @table @asis\n\ | |
559 @item > 0\n\ | |
560 You are in the parent process. The value returned from @code{fork} is\n\ | |
561 the process id of the child process. You should probably arrange to\n\ | |
562 wait for any child processes to exit.\n\ | |
563 \n\ | |
564 @item 0\n\ | |
565 You are in the child process. You can call @code{exec} to start another\n\ | |
566 process. If that fails, you should probably call @code{exit}.\n\ | |
567 \n\ | |
568 @item < 0\n\ | |
569 The call to @code{fork} failed for some reason. You must take evasive\n\ | |
570 action. A system dependent error message will be waiting in @var{msg}.\n\ | |
571 @end table\n\ | |
572 @end deftypefn") | |
2075 | 573 { |
2669 | 574 octave_value_list retval; |
575 | |
3523 | 576 retval(1) = std::string (); |
4294 | 577 retval(0) = -1; |
2075 | 578 |
579 int nargin = args.length (); | |
580 | |
581 if (nargin == 0) | |
2475 | 582 { |
3523 | 583 std::string msg; |
2937 | 584 |
585 pid_t pid = octave_syscalls::fork (msg); | |
2669 | 586 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
587 retval(1) = msg; |
4233 | 588 retval(0) = pid; |
2475 | 589 } |
2075 | 590 else |
5823 | 591 print_usage (); |
2075 | 592 |
593 return retval; | |
594 } | |
595 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
596 DEFUNX ("getpgrp", Fgetpgrp, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
597 "-*- texinfo -*-\n\ |
3301 | 598 @deftypefn {Built-in Function} {pgid =} getpgrp ()\n\ |
599 Return the process group id of the current process.\n\ | |
600 @end deftypefn") | |
2075 | 601 { |
2937 | 602 octave_value_list retval; |
603 | |
3523 | 604 retval(1) = std::string (); |
4294 | 605 retval(0) = -1; |
2075 | 606 |
607 int nargin = args.length (); | |
608 | |
609 if (nargin == 0) | |
2475 | 610 { |
3523 | 611 std::string msg; |
2937 | 612 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
613 retval(1) = msg; |
4233 | 614 retval(0) = octave_syscalls::getpgrp (msg); |
2475 | 615 } |
2075 | 616 else |
5823 | 617 print_usage (); |
2075 | 618 |
619 return retval; | |
620 } | |
621 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
622 DEFUNX ("getpid", Fgetpid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
623 "-*- texinfo -*-\n\ |
3301 | 624 @deftypefn {Built-in Function} {pid =} getpid ()\n\ |
625 Return the process id of the current process.\n\ | |
626 @end deftypefn") | |
2075 | 627 { |
4233 | 628 octave_value retval = -1; |
2075 | 629 |
630 int nargin = args.length (); | |
631 | |
632 if (nargin == 0) | |
2937 | 633 retval = octave_syscalls::getpid (); |
2075 | 634 else |
5823 | 635 print_usage (); |
2075 | 636 |
637 return retval; | |
638 } | |
639 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
640 DEFUNX ("getppid", Fgetppid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
641 "-*- texinfo -*-\n\ |
3301 | 642 @deftypefn {Built-in Function} {pid =} getppid ()\n\ |
643 Return the process id of the parent process.\n\ | |
644 @end deftypefn") | |
2075 | 645 { |
4233 | 646 octave_value retval = -1; |
2075 | 647 |
2475 | 648 int nargin = args.length (); |
649 | |
650 if (nargin == 0) | |
2937 | 651 retval = octave_syscalls::getppid (); |
2475 | 652 else |
5823 | 653 print_usage (); |
2475 | 654 |
655 return retval; | |
656 } | |
657 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
658 DEFUNX ("getegid", Fgetegid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
659 "-*- texinfo -*-\n\ |
3301 | 660 @deftypefn {Built-in Function} {egid =} getegid ()\n\ |
661 Return the effective group id of the current process.\n\ | |
662 @end deftypefn") | |
2475 | 663 { |
4233 | 664 octave_value retval = -1; |
2475 | 665 |
2075 | 666 int nargin = args.length (); |
667 | |
668 if (nargin == 0) | |
4254 | 669 retval = octave_syscalls::getegid (); |
2075 | 670 else |
5823 | 671 print_usage (); |
2475 | 672 |
673 return retval; | |
674 } | |
675 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
676 DEFUNX ("getgid", Fgetgid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
677 "-*- texinfo -*-\n\ |
3301 | 678 @deftypefn {Built-in Function} {gid =} getgid ()\n\ |
679 Return the real group id of the current process.\n\ | |
680 @end deftypefn") | |
2475 | 681 { |
4233 | 682 octave_value retval = -1; |
2475 | 683 |
684 int nargin = args.length (); | |
685 | |
686 if (nargin == 0) | |
4254 | 687 retval = octave_syscalls::getgid (); |
2475 | 688 else |
5823 | 689 print_usage (); |
2075 | 690 |
691 return retval; | |
692 } | |
693 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
694 DEFUNX ("geteuid", Fgeteuid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
695 "-*- texinfo -*-\n\ |
3301 | 696 @deftypefn {Built-in Function} {euid =} geteuid ()\n\ |
697 Return the effective user id of the current process.\n\ | |
698 @end deftypefn") | |
2472 | 699 { |
4233 | 700 octave_value retval = -1; |
2472 | 701 |
702 int nargin = args.length (); | |
703 | |
704 if (nargin == 0) | |
4254 | 705 retval = octave_syscalls::geteuid (); |
2472 | 706 else |
5823 | 707 print_usage (); |
2473 | 708 |
709 return retval; | |
2472 | 710 } |
711 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
712 DEFUNX ("getuid", Fgetuid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
713 "-*- texinfo -*-\n\ |
3301 | 714 @deftypefn {Built-in Function} {uid =} getuid ()\n\ |
715 Return the real user id of the current process.\n\ | |
716 @end deftypefn") | |
2472 | 717 { |
4233 | 718 octave_value retval = -1; |
2472 | 719 |
720 int nargin = args.length (); | |
721 | |
722 if (nargin == 0) | |
4254 | 723 retval = octave_syscalls::getuid (); |
2472 | 724 else |
5823 | 725 print_usage (); |
2473 | 726 |
727 return retval; | |
2472 | 728 } |
729 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
730 DEFUNX ("kill", Fkill, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
731 "-*- texinfo -*-\n\ |
4294 | 732 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} kill (@var{pid}, @var{sig})\n\ |
733 Send signal @var{sig} to process @var{pid}.\n\ | |
734 \n\ | |
735 If @var{pid} is positive, then signal @var{sig} is sent to @var{pid}.\n\ | |
736 \n\ | |
737 If @var{pid} is 0, then signal @var{sig} is sent to every process\n\ | |
738 in the process group of the current process.\n\ | |
739 \n\ | |
740 If @var{pid} is -1, then signal @var{sig} is sent to every process\n\ | |
741 except process 1.\n\ | |
742 \n\ | |
743 If @var{pid} is less than -1, then signal @var{sig} is sent to every\n\ | |
744 process in the process group @var{-pid}.\n\ | |
745 \n\ | |
4371 | 746 If @var{sig} is 0, then no signal is sent, but error checking is still\n\ |
4294 | 747 performed.\n\ |
748 \n\ | |
7001 | 749 Return 0 if successful, otherwise return -1.\n\ |
4294 | 750 @end deftypefn") |
751 { | |
752 octave_value_list retval; | |
753 | |
754 retval(1) = std::string (); | |
755 retval(0) = -1; | |
756 | |
757 if (args.length () == 2) | |
758 { | |
759 pid_t pid = args(0).int_value (true); | |
760 | |
761 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
762 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
763 int sig = args(1).int_value (true); |
4294 | 764 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
765 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
766 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
767 std::string msg; |
4294 | 768 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
769 int status = octave_syscalls::kill (pid, sig, msg); |
4294 | 770 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
771 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
772 retval(0) = status; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
773 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
774 } |
4294 | 775 } |
776 else | |
5823 | 777 print_usage (); |
4294 | 778 |
779 return retval; | |
780 } | |
781 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
782 DEFUNX ("lstat", Flstat, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
783 "-*- texinfo -*-\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
784 @deftypefn {Built-in Function} {@var{info} =} lstat (@var{symlink})\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
785 @deftypefnx {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{symlink})\n\ |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11586
diff
changeset
|
786 Return a structure @var{info} containing information about the symbolic link\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
787 @var{symlink}.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
788 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
789 The function outputs are described in the documentation for @code{stat}.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
790 @seealso{stat, symlink}\n\ |
3458 | 791 @end deftypefn") |
2075 | 792 { |
2263 | 793 octave_value_list retval; |
2075 | 794 |
795 if (args.length () == 1) | |
796 { | |
5872 | 797 std::string fname = args(0).string_value (); |
2075 | 798 |
799 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
800 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
801 file_stat fs (fname, false); |
2075 | 802 |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
803 retval = mk_stat_result (fs); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
804 } |
2075 | 805 } |
806 else | |
5823 | 807 print_usage (); |
2075 | 808 |
809 return retval; | |
810 } | |
811 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
812 DEFUNX ("mkfifo", Fmkfifo, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
813 "-*- texinfo -*-\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
814 @deftypefn {Built-in Function} {} mkfifo (@var{name}, @var{mode})\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
815 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode})\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
816 Create a FIFO special file named @var{name} with file mode @var{mode}\n\ |
2075 | 817 \n\ |
3301 | 818 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ |
819 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
820 system-dependent error message.\n\ | |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
821 @seealso{pipe}\n\ |
3301 | 822 @end deftypefn") |
2075 | 823 { |
2669 | 824 octave_value_list retval; |
825 | |
3523 | 826 retval(1) = std::string (); |
4294 | 827 retval(0) = -1; |
2075 | 828 |
829 int nargin = args.length (); | |
830 | |
831 if (nargin == 2) | |
832 { | |
833 if (args(0).is_string ()) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
834 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
835 std::string name = args(0).string_value (); |
2075 | 836 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
837 if (args(1).is_scalar_type ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
838 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
839 long mode = args(1).long_value (); |
2075 | 840 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
841 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
842 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
843 std::string msg; |
4254 | 844 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
845 int status = octave_mkfifo (name, mode, msg); |
2669 | 846 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
847 retval(0) = status; |
2669 | 848 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
849 if (status < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
850 retval(1) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
851 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
852 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
853 error ("mkfifo: invalid MODE"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
854 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
855 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
856 error ("mkfifo: MODE must be an integer"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
857 } |
2075 | 858 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
859 error ("mkfifo: FILE must be a string"); |
2075 | 860 } |
861 else | |
5823 | 862 print_usage (); |
2075 | 863 |
864 return retval; | |
865 } | |
866 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
867 DEFUNX ("pipe", Fpipe, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
868 "-*- texinfo -*-\n\ |
6321 | 869 @deftypefn {Built-in Function} {[@var{read_fd}, @var{write_fd}, @var{err}, @var{msg}] =} pipe ()\n\ |
870 Create a pipe and return the reading and writing ends of the pipe\n\ | |
871 into @var{read_fd} and @var{write_fd} respectively.\n\ | |
2669 | 872 \n\ |
3301 | 873 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ |
874 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
875 system-dependent error message.\n\ | |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
876 @seealso{mkfifo}\n\ |
3301 | 877 @end deftypefn") |
2075 | 878 { |
2669 | 879 octave_value_list retval; |
880 | |
6321 | 881 retval(3) = std::string (); |
882 retval(2) = -1; | |
4294 | 883 retval(1) = -1; |
6321 | 884 retval(0) = -1; |
2075 | 885 |
886 int nargin = args.length (); | |
887 | |
888 if (nargin == 0) | |
889 { | |
890 int fid[2]; | |
891 | |
3523 | 892 std::string msg; |
2937 | 893 |
894 int status = octave_syscalls::pipe (fid, msg); | |
2669 | 895 |
896 if (status < 0) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
897 retval(3) = msg; |
2669 | 898 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
899 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
900 FILE *ifile = fdopen (fid[0], "r"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
901 FILE *ofile = fdopen (fid[1], "w"); |
2075 | 902 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
903 std::string nm; |
4327 | 904 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
905 octave_stream is = octave_stdiostream::create (nm, ifile, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
906 std::ios::in); |
4327 | 907 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
908 octave_stream os = octave_stdiostream::create (nm, ofile, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
909 std::ios::out); |
2075 | 910 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
911 retval(2) = status; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
912 retval(1) = octave_stream_list::insert (os); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
913 retval(0) = octave_stream_list::insert (is); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
914 } |
2075 | 915 } |
916 else | |
5823 | 917 print_usage (); |
2075 | 918 |
919 return retval; | |
920 } | |
921 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
922 DEFUNX ("stat", Fstat, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
923 "-*- texinfo -*-\n\ |
10840 | 924 @deftypefn {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} stat (@var{file})\n\ |
11417
1a7b41db5432
Add additional calling form using file descriptor (fid) to docstring for stat.
Rik <octave@nomad.inbox5.com>
parents:
11152
diff
changeset
|
925 @deftypefnx {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} stat (@var{fid})\n\ |
3301 | 926 @deftypefnx {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{file})\n\ |
11417
1a7b41db5432
Add additional calling form using file descriptor (fid) to docstring for stat.
Rik <octave@nomad.inbox5.com>
parents:
11152
diff
changeset
|
927 @deftypefnx {Built-in Function} {[@var{info}, @var{err}, @var{msg}] =} lstat (@var{fid})\n\ |
12211
11faa69c4eaa
Add S_ISBLK and family of functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11586
diff
changeset
|
928 Return a structure @var{info} containing the following information about\n\ |
11417
1a7b41db5432
Add additional calling form using file descriptor (fid) to docstring for stat.
Rik <octave@nomad.inbox5.com>
parents:
11152
diff
changeset
|
929 @var{file} or file identifier @var{fid}.\n\ |
3301 | 930 \n\ |
931 @table @code\n\ | |
932 @item dev\n\ | |
933 ID of device containing a directory entry for this file.\n\ | |
934 \n\ | |
935 @item ino\n\ | |
936 File number of the file.\n\ | |
937 \n\ | |
5476 | 938 @item mode\n\ |
9209
923c7cb7f13f
Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents:
9064
diff
changeset
|
939 File mode, as an integer. Use the functions @w{@code{S_ISREG}},\n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17236
diff
changeset
|
940 @w{@code{S_ISDIR}}, @w{@code{S_ISCHR}}, @w{@code{S_ISBLK}},\n\ |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17236
diff
changeset
|
941 @w{@code{S_ISFIFO}}, @w{@code{S_ISLNK}}, or @w{@code{S_ISSOCK}} to extract\n\ |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17236
diff
changeset
|
942 information from this value.\n\ |
5476 | 943 \n\ |
3301 | 944 @item modestr\n\ |
945 File mode, as a string of ten letters or dashes as would be returned by\n\ | |
946 @kbd{ls -l}.\n\ | |
947 \n\ | |
948 @item nlink\n\ | |
949 Number of links.\n\ | |
2075 | 950 \n\ |
3301 | 951 @item uid\n\ |
952 User ID of file's owner.\n\ | |
953 \n\ | |
954 @item gid\n\ | |
955 Group ID of file's group.\n\ | |
956 \n\ | |
957 @item rdev\n\ | |
958 ID of device for block or character special files.\n\ | |
959 \n\ | |
960 @item size\n\ | |
961 Size in bytes.\n\ | |
962 \n\ | |
963 @item atime\n\ | |
964 Time of last access in the same form as time values returned from\n\ | |
965 @code{time}. @xref{Timing Utilities}.\n\ | |
966 \n\ | |
967 @item mtime\n\ | |
968 Time of last modification in the same form as time values returned from\n\ | |
969 @code{time}. @xref{Timing Utilities}.\n\ | |
2075 | 970 \n\ |
3301 | 971 @item ctime\n\ |
972 Time of last file status change in the same form as time values\n\ | |
973 returned from @code{time}. @xref{Timing Utilities}.\n\ | |
974 \n\ | |
975 @item blksize\n\ | |
976 Size of blocks in the file.\n\ | |
977 \n\ | |
978 @item blocks\n\ | |
979 Number of blocks allocated for file.\n\ | |
980 @end table\n\ | |
981 \n\ | |
982 If the call is successful @var{err} is 0 and @var{msg} is an empty\n\ | |
15065
f7215831fe78
doc: be consistent on var name on stat help text
Carnë Draug <carandraug+dev@gmail.com>
parents:
14861
diff
changeset
|
983 string. If the file does not exist, or some other error occurs, @var{info}\n\ |
3301 | 984 is an empty matrix, @var{err} is @minus{}1, and @var{msg} contains the\n\ |
985 corresponding system error message.\n\ | |
986 \n\ | |
987 If @var{file} is a symbolic link, @code{stat} will return information\n\ | |
7001 | 988 about the actual file that is referenced by the link. Use @code{lstat}\n\ |
3301 | 989 if you want information about the symbolic link itself.\n\ |
990 \n\ | |
10840 | 991 For example:\n\ |
2075 | 992 \n\ |
3301 | 993 @example\n\ |
15065
f7215831fe78
doc: be consistent on var name on stat help text
Carnë Draug <carandraug+dev@gmail.com>
parents:
14861
diff
changeset
|
994 [info, err, msg] = stat (\"/vmlinuz\")\n\ |
f7215831fe78
doc: be consistent on var name on stat help text
Carnë Draug <carandraug+dev@gmail.com>
parents:
14861
diff
changeset
|
995 @result{} info =\n\ |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
996 @{\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
997 atime = 855399756\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
998 rdev = 0\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
999 ctime = 847219094\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1000 uid = 0\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1001 size = 389218\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1002 blksize = 4096\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1003 mtime = 847219094\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1004 gid = 6\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1005 nlink = 1\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1006 blocks = 768\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1007 mode = -rw-r--r--\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1008 modestr = -rw-r--r--\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1009 ino = 9316\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1010 dev = 2049\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1011 @}\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1012 @result{} err = 0\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1013 @result{} msg =\n\ |
3301 | 1014 @end example\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1015 @seealso{lstat, ls, dir}\n\ |
3301 | 1016 @end deftypefn") |
2075 | 1017 { |
2262 | 1018 octave_value_list retval; |
2075 | 1019 |
1020 if (args.length () == 1) | |
1021 { | |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1022 if (args(0).is_scalar_type ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1023 { |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1024 int fid = octave_stream_list::get_file_number (args(0)); |
2075 | 1025 |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1026 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1027 { |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1028 file_fstat fs (fid); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1029 |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1030 retval = mk_stat_result (fs); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1031 } |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1032 } |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1033 else |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1034 { |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1035 std::string fname = args(0).string_value (); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1036 |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1037 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1038 { |
10336
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1039 file_stat fs (fname); |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1040 |
1603dfe72933
obsolete fstat, handle the functionality by stat
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
1041 retval = mk_stat_result (fs); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1042 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1043 } |
2075 | 1044 } |
1045 else | |
5823 | 1046 print_usage (); |
2075 | 1047 |
1048 return retval; | |
1049 } | |
1050 | |
5476 | 1051 DEFUNX ("S_ISREG", FS_ISREG, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1052 "-*- texinfo -*-\n\ |
5476 | 1053 @deftypefn {Built-in Function} {} S_ISREG (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1054 Return true if @var{mode} corresponds to a regular file.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1055 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1056 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1057 @seealso{stat, lstat}\n\ |
1058 @end deftypefn") | |
1059 { | |
1060 octave_value retval = false; | |
1061 | |
1062 if (args.length () == 1) | |
1063 { | |
1064 double mode = args(0).double_value (); | |
1065 | |
1066 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1067 retval = file_stat::is_reg (static_cast<mode_t> (mode)); |
5476 | 1068 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1069 error ("S_ISREG: invalid MODE value"); |
5476 | 1070 } |
1071 else | |
5823 | 1072 print_usage (); |
5476 | 1073 |
1074 return retval; | |
1075 } | |
1076 | |
1077 DEFUNX ("S_ISDIR", FS_ISDIR, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1078 "-*- texinfo -*-\n\ |
5476 | 1079 @deftypefn {Built-in Function} {} S_ISDIR (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1080 Return true if @var{mode} corresponds to a directory.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1081 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1082 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1083 @seealso{stat, lstat}\n\ |
1084 @end deftypefn") | |
1085 { | |
1086 octave_value retval = false; | |
1087 | |
1088 if (args.length () == 1) | |
1089 { | |
1090 double mode = args(0).double_value (); | |
1091 | |
1092 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1093 retval = file_stat::is_dir (static_cast<mode_t> (mode)); |
5476 | 1094 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1095 error ("S_ISDIR: invalid MODE value"); |
5476 | 1096 } |
1097 else | |
5823 | 1098 print_usage (); |
5476 | 1099 |
1100 return retval; | |
1101 } | |
1102 | |
1103 DEFUNX ("S_ISCHR", FS_ISCHR, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1104 "-*- texinfo -*-\n\ |
5476 | 1105 @deftypefn {Built-in Function} {} S_ISCHR (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1106 Return true if @var{mode} corresponds to a character device.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1107 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1108 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1109 @seealso{stat, lstat}\n\ |
1110 @end deftypefn") | |
1111 { | |
1112 octave_value retval = false; | |
1113 | |
1114 if (args.length () == 1) | |
1115 { | |
1116 double mode = args(0).double_value (); | |
1117 | |
1118 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1119 retval = file_stat::is_chr (static_cast<mode_t> (mode)); |
5476 | 1120 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1121 error ("S_ISCHR: invalid MODE value"); |
5476 | 1122 } |
1123 else | |
5823 | 1124 print_usage (); |
5476 | 1125 |
1126 return retval; | |
1127 } | |
1128 | |
1129 DEFUNX ("S_ISBLK", FS_ISBLK, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1130 "-*- texinfo -*-\n\ |
5476 | 1131 @deftypefn {Built-in Function} {} S_ISBLK (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1132 Return true if @var{mode} corresponds to a block device.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1133 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1134 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1135 @seealso{stat, lstat}\n\ |
1136 @end deftypefn") | |
1137 { | |
1138 octave_value retval = false; | |
1139 | |
1140 if (args.length () == 1) | |
1141 { | |
1142 double mode = args(0).double_value (); | |
1143 | |
1144 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1145 retval = file_stat::is_blk (static_cast<mode_t> (mode)); |
5476 | 1146 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1147 error ("S_ISBLK: invalid MODE value"); |
5476 | 1148 } |
1149 else | |
5823 | 1150 print_usage (); |
5476 | 1151 |
1152 return retval; | |
1153 } | |
1154 | |
1155 DEFUNX ("S_ISFIFO", FS_ISFIFO, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1156 "-*- texinfo -*-\n\ |
5476 | 1157 @deftypefn {Built-in Function} {} S_ISFIFO (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1158 Return true if @var{mode} corresponds to a fifo.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1159 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1160 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1161 @seealso{stat, lstat}\n\ |
1162 @end deftypefn") | |
1163 { | |
1164 octave_value retval = false; | |
1165 | |
1166 if (args.length () == 1) | |
1167 { | |
1168 double mode = args(0).double_value (); | |
1169 | |
1170 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1171 retval = file_stat::is_fifo (static_cast<mode_t> (mode)); |
5476 | 1172 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1173 error ("S_ISFIFO: invalid MODE value"); |
5476 | 1174 } |
1175 else | |
5823 | 1176 print_usage (); |
5476 | 1177 |
1178 return retval; | |
1179 } | |
1180 | |
1181 DEFUNX ("S_ISLNK", FS_ISLNK, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1182 "-*- texinfo -*-\n\ |
5476 | 1183 @deftypefn {Built-in Function} {} S_ISLNK (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1184 Return true if @var{mode} corresponds to a symbolic link.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1185 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1186 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1187 @seealso{stat, lstat}\n\ |
1188 @end deftypefn") | |
1189 { | |
1190 octave_value retval = false; | |
1191 | |
1192 if (args.length () == 1) | |
1193 { | |
1194 double mode = args(0).double_value (); | |
1195 | |
1196 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1197 retval = file_stat::is_lnk (static_cast<mode_t> (mode)); |
5476 | 1198 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1199 error ("S_ISLNK: invalid MODE value"); |
5476 | 1200 } |
1201 else | |
5823 | 1202 print_usage (); |
5476 | 1203 |
1204 return retval; | |
1205 } | |
1206 | |
1207 DEFUNX ("S_ISSOCK", FS_ISSOCK, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1208 "-*- texinfo -*-\n\ |
5476 | 1209 @deftypefn {Built-in Function} {} S_ISSOCK (@var{mode})\n\ |
17397
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1210 Return true if @var{mode} corresponds to a socket.\n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1211 \n\ |
0bf2fc8562c9
doc: Update documentation for file and directory functions.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
1212 The value of @var{mode} is assumed to be returned from a call to @code{stat}.\n\ |
5476 | 1213 @seealso{stat, lstat}\n\ |
1214 @end deftypefn") | |
1215 { | |
1216 octave_value retval = false; | |
1217 | |
1218 if (args.length () == 1) | |
1219 { | |
1220 double mode = args(0).double_value (); | |
1221 | |
1222 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1223 retval = file_stat::is_sock (static_cast<mode_t> (mode)); |
5476 | 1224 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1225 error ("S_ISSOCK: invalid MODE value"); |
5476 | 1226 } |
1227 else | |
5823 | 1228 print_usage (); |
5476 | 1229 |
1230 return retval; | |
1231 } | |
1232 | |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1233 DEFUN (gethostname, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1234 "-*- texinfo -*-\n\ |
12514
e5e66c389597
Add gethostname to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1235 @deftypefn {Built-in Function} {} gethostname ()\n\ |
e5e66c389597
Add gethostname to documentation.
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1236 Return the hostname of the system where Octave is running.\n\ |
11006
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1237 @end deftypefn") |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1238 { |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1239 octave_value retval; |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1240 |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1241 if (args.length () == 0) |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1242 retval = octave_env::get_host_name (); |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1243 else |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1244 print_usage (); |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1245 |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1246 return retval; |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1247 } |
aca961a3f387
provide gethostname function
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
1248 |
5547 | 1249 DEFUN (uname, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1250 "-*- texinfo -*-\n\ |
5547 | 1251 @deftypefn {Built-in Function} {[@var{uts}, @var{err}, @var{msg}] =} uname ()\n\ |
10840 | 1252 Return system information in the structure. For example:\n\ |
5547 | 1253 \n\ |
1254 @example\n\ | |
1255 @group\n\ | |
1256 uname ()\n\ | |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1257 @result{} @{\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1258 sysname = x86_64\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1259 nodename = segfault\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1260 release = 2.6.15-1-amd64-k8-smp\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1261 version = Linux\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1262 machine = #2 SMP Thu Feb 23 04:57:49 UTC 2006\n\ |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14171
diff
changeset
|
1263 @}\n\ |
5547 | 1264 @end group\n\ |
1265 @end example\n\ | |
1266 \n\ | |
1267 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ | |
1268 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
1269 system-dependent error message.\n\ | |
1270 @end deftypefn") | |
1271 { | |
1272 octave_value_list retval; | |
1273 | |
1274 if (args.length () == 0) | |
1275 { | |
1276 octave_uname sysinfo; | |
1277 | |
10762
d53eb6249892
use scalar map in some syscalls
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
1278 octave_scalar_map m; |
5547 | 1279 |
1280 m.assign ("sysname", sysinfo.sysname ()); | |
1281 m.assign ("nodename", sysinfo.nodename ()); | |
1282 m.assign ("release", sysinfo.release ()); | |
1283 m.assign ("version", sysinfo.version ()); | |
1284 m.assign ("machine", sysinfo.machine ()); | |
1285 | |
1286 retval(2) = sysinfo.message (); | |
1287 retval(1) = sysinfo.error (); | |
1288 retval(0) = m; | |
1289 } | |
1290 else | |
5823 | 1291 print_usage (); |
5547 | 1292 |
1293 return retval; | |
1294 } | |
1295 | |
10197
4d433bd2d4dc
attempt to avoid trouble with gnulib #defines in a consistent way
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
1296 DEFUNX ("unlink", Funlink, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1297 "-*- texinfo -*-\n\ |
3301 | 1298 @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} unlink (@var{file})\n\ |
1299 Delete the file named @var{file}.\n\ | |
2075 | 1300 \n\ |
3301 | 1301 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\ |
1302 Otherwise, @var{err} is nonzero and @var{msg} contains a\n\ | |
1303 system-dependent error message.\n\ | |
1304 @end deftypefn") | |
2075 | 1305 { |
2669 | 1306 octave_value_list retval; |
1307 | |
3523 | 1308 retval(1) = std::string (); |
4294 | 1309 retval(0) = -1; |
2075 | 1310 |
1311 int nargin = args.length (); | |
1312 | |
1313 if (nargin == 1) | |
1314 { | |
1315 if (args(0).is_string ()) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1316 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1317 std::string name = args(0).string_value (); |
2075 | 1318 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1319 std::string msg; |
2669 | 1320 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1321 int status = octave_unlink (name, msg); |
2669 | 1322 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
1323 retval(1) = msg; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1324 retval(0) = status; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1325 } |
2075 | 1326 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1327 error ("unlink: FILE must be a string"); |
2075 | 1328 } |
1329 else | |
5823 | 1330 print_usage (); |
2075 | 1331 |
1332 return retval; | |
1333 } | |
1334 | |
10299
c992efc0c2fa
use DEFUNX instead of DEFUN for all functions in syscalls.cc
John W. Eaton <jwe@octave.org>
parents:
10259
diff
changeset
|
1335 DEFUNX ("waitpid", Fwaitpid, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1336 "-*- texinfo -*-\n\ |
5453 | 1337 @deftypefn {Built-in Function} {[@var{pid}, @var{status}, @var{msg}] =} waitpid (@var{pid}, @var{options})\n\ |
3301 | 1338 Wait for process @var{pid} to terminate. The @var{pid} argument can be:\n\ |
2075 | 1339 \n\ |
3301 | 1340 @table @asis\n\ |
1341 @item @minus{}1\n\ | |
1342 Wait for any child process.\n\ | |
2075 | 1343 \n\ |
3301 | 1344 @item 0\n\ |
1345 Wait for any child process whose process group ID is equal to that of\n\ | |
1346 the Octave interpreter process.\n\ | |
2075 | 1347 \n\ |
3301 | 1348 @item > 0\n\ |
1349 Wait for termination of the child process with ID @var{pid}.\n\ | |
1350 @end table\n\ | |
1351 \n\ | |
5453 | 1352 The @var{options} argument can be a bitwise OR of zero or more of\n\ |
1353 the following constants:\n\ | |
2075 | 1354 \n\ |
5453 | 1355 @table @code\n\ |
3301 | 1356 @item 0\n\ |
1357 Wait until signal is received or a child process exits (this is the\n\ | |
1358 default if the @var{options} argument is missing).\n\ | |
1359 \n\ | |
5453 | 1360 @item WNOHANG\n\ |
3301 | 1361 Do not hang if status is not immediately available.\n\ |
2075 | 1362 \n\ |
5453 | 1363 @item WUNTRACED\n\ |
3301 | 1364 Report the status of any child processes that are stopped, and whose\n\ |
1365 status has not yet been reported since they stopped.\n\ | |
1366 \n\ | |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7924
diff
changeset
|
1367 @item WCONTINUE\n\ |
5453 | 1368 Return if a stopped child has been resumed by delivery of @code{SIGCONT}.\n\ |
1369 This value may not be meaningful on all systems.\n\ | |
3301 | 1370 @end table\n\ |
1371 \n\ | |
1372 If the returned value of @var{pid} is greater than 0, it is the process\n\ | |
1373 ID of the child process that exited. If an error occurs, @var{pid} will\n\ | |
1374 be less than zero and @var{msg} will contain a system-dependent error\n\ | |
7001 | 1375 message. The value of @var{status} contains additional system-dependent\n\ |
5453 | 1376 information about the subprocess that exited.\n\ |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7924
diff
changeset
|
1377 @seealso{WCONTINUE, WCOREDUMP, WEXITSTATUS, WIFCONTINUED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG, WTERMSIG, WUNTRACED}\n\ |
3301 | 1378 @end deftypefn") |
2075 | 1379 { |
2669 | 1380 octave_value_list retval; |
1381 | |
5453 | 1382 retval(2) = std::string (); |
1383 retval(1) = 0; | |
4294 | 1384 retval(0) = -1; |
2075 | 1385 |
1386 int nargin = args.length (); | |
1387 | |
1388 if (nargin == 1 || nargin == 2) | |
1389 { | |
3202 | 1390 pid_t pid = args(0).int_value (true); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
1391 |
2075 | 1392 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1393 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1394 int options = 0; |
2075 | 1395 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1396 if (args.length () == 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1397 options = args(1).int_value (true); |
2937 | 1398 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1399 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1400 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1401 std::string msg; |
2669 | 1402 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1403 int status = 0; |
5453 | 1404 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1405 pid_t result = octave_syscalls::waitpid (pid, &status, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1406 options, msg); |
3202 | 1407 |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
1408 retval(2) = msg; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1409 retval(1) = status; |
14022
de90542b7afc
Return retval(1) before retval(0) to avoid re-sizing call on retval.
Rik <octave@nomad.inbox5.com>
parents:
12642
diff
changeset
|
1410 retval(0) = result; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1411 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1412 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1413 error ("waitpid: OPTIONS must be an integer"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1414 } |
3202 | 1415 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1416 error ("waitpid: PID must be an integer value"); |
2075 | 1417 } |
1418 else | |
5823 | 1419 print_usage (); |
2075 | 1420 |
1421 return retval; | |
1422 } | |
1423 | |
5453 | 1424 DEFUNX ("WIFEXITED", FWIFEXITED, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1425 "-*- texinfo -*-\n\ |
5453 | 1426 @deftypefn {Built-in Function} {} WIFEXITED (@var{status})\n\ |
1427 Given @var{status} from a call to @code{waitpid}, return true if the\n\ | |
1428 child terminated normally.\n\ | |
1429 @seealso{waitpid, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED}\n\ | |
5646 | 1430 @end deftypefn") |
5453 | 1431 { |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1432 octave_value retval = false; |
5453 | 1433 |
1434 if (args.length () == 1) | |
1435 { | |
1436 int status = args(0).int_value (); | |
1437 | |
1438 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1439 retval = octave_wait::ifexited (status); |
5453 | 1440 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1441 error ("WIFEXITED: STATUS must be an integer"); |
5453 | 1442 } |
1443 | |
1444 return retval; | |
1445 } | |
1446 | |
1447 DEFUNX ("WEXITSTATUS", FWEXITSTATUS, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1448 "-*- texinfo -*-\n\ |
5453 | 1449 @deftypefn {Built-in Function} {} WEXITSTATUS (@var{status})\n\ |
1450 Given @var{status} from a call to @code{waitpid}, return the exit\n\ | |
1451 status of the child. This function should only be employed if\n\ | |
1452 @code{WIFEXITED} returned true.\n\ | |
1453 @seealso{waitpid, WIFEXITED, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED}\n\ | |
1454 @end deftypefn") | |
1455 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1456 octave_value retval = 0; |
5453 | 1457 |
1458 if (args.length () == 1) | |
1459 { | |
1460 int status = args(0).int_value (); | |
1461 | |
1462 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1463 retval = octave_wait::exitstatus (status); |
5453 | 1464 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1465 error ("WEXITSTATUS: STATUS must be an integer"); |
5453 | 1466 } |
1467 | |
1468 return retval; | |
1469 } | |
1470 | |
1471 DEFUNX ("WIFSIGNALED", FWIFSIGNALED, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1472 "-*- texinfo -*-\n\ |
5453 | 1473 @deftypefn {Built-in Function} {} WIFSIGNALED (@var{status})\n\ |
1474 Given @var{status} from a call to @code{waitpid}, return true if the\n\ | |
1475 child process was terminated by a signal.\n\ | |
1476 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED}\n\ | |
1477 @end deftypefn") | |
1478 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1479 octave_value retval = false; |
5453 | 1480 |
1481 if (args.length () == 1) | |
1482 { | |
1483 int status = args(0).int_value (); | |
1484 | |
1485 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1486 retval = octave_wait::ifsignaled (status); |
5453 | 1487 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1488 error ("WIFSIGNALED: STATUS must be an integer"); |
5453 | 1489 } |
1490 | |
1491 return retval; | |
1492 } | |
1493 | |
1494 DEFUNX ("WTERMSIG", FWTERMSIG, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1495 "-*- texinfo -*-\n\ |
5453 | 1496 @deftypefn {Built-in Function} {} WTERMSIG (@var{status})\n\ |
1497 Given @var{status} from a call to @code{waitpid}, return the number of\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
1498 the signal that caused the child process to terminate. This function\n\ |
5453 | 1499 should only be employed if @code{WIFSIGNALED} returned true.\n\ |
1500 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WCOREDUMP, WIFSTOPPED, WSTOPSIG, WIFCONTINUED}\n\ | |
1501 @end deftypefn") | |
1502 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1503 octave_value retval = 0; |
5453 | 1504 |
1505 if (args.length () == 1) | |
1506 { | |
1507 int status = args(0).int_value (); | |
1508 | |
1509 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1510 retval = octave_wait::termsig (status); |
5453 | 1511 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1512 error ("WTERMSIG: STATUS must be an integer"); |
5453 | 1513 } |
1514 | |
1515 return retval; | |
1516 } | |
1517 | |
1518 DEFUNX ("WCOREDUMP", FWCOREDUMP, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1519 "-*- texinfo -*-\n\ |
5453 | 1520 @deftypefn {Built-in Function} {} WCOREDUMP (@var{status})\n\ |
1521 Given @var{status} from a call to @code{waitpid}, return true if the\n\ | |
1522 child produced a core dump. This function should only be employed if\n\ | |
1523 @code{WIFSIGNALED} returned true. The macro used to implement this\n\ | |
1524 function is not specified in POSIX.1-2001 and is not available on some\n\ | |
1525 Unix implementations (e.g., AIX, SunOS).\n\ | |
1526 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED, WSTOPSIG, WIFCONTINUED}\n\ | |
1527 @end deftypefn") | |
1528 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1529 octave_value retval = false; |
5453 | 1530 |
1531 if (args.length () == 1) | |
1532 { | |
1533 int status = args(0).int_value (); | |
1534 | |
1535 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1536 retval = octave_wait::coredump (status); |
5453 | 1537 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1538 error ("WCOREDUMP: STATUS must be an integer"); |
5453 | 1539 } |
1540 | |
1541 return retval; | |
1542 } | |
1543 | |
1544 DEFUNX ("WIFSTOPPED", FWIFSTOPPED, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1545 "-*- texinfo -*-\n\ |
5453 | 1546 @deftypefn {Built-in Function} {} WIFSTOPPED (@var{status})\n\ |
1547 Given @var{status} from a call to @code{waitpid}, return true if the\n\ | |
1548 child process was stopped by delivery of a signal; this is only\n\ | |
1549 possible if the call was done using @code{WUNTRACED} or when the child\n\ | |
1550 is being traced (see ptrace(2)).\n\ | |
1551 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WSTOPSIG, WIFCONTINUED}\n\ | |
1552 @end deftypefn") | |
1553 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1554 octave_value retval = false; |
5453 | 1555 |
1556 if (args.length () == 1) | |
1557 { | |
1558 int status = args(0).int_value (); | |
1559 | |
1560 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1561 retval = octave_wait::ifstopped (status); |
5453 | 1562 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1563 error ("WIFSTOPPED: STATUS must be an integer"); |
5453 | 1564 } |
1565 | |
1566 return retval; | |
1567 } | |
1568 | |
1569 DEFUNX ("WSTOPSIG", FWSTOPSIG, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1570 "-*- texinfo -*-\n\ |
5453 | 1571 @deftypefn {Built-in Function} {} WSTOPSIG (@var{status})\n\ |
1572 Given @var{status} from a call to @code{waitpid}, return the number of\n\ | |
1573 the signal which caused the child to stop. This function should only\n\ | |
1574 be employed if @code{WIFSTOPPED} returned true.\n\ | |
1575 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WIFCONTINUED}\n\ | |
1576 @end deftypefn") | |
1577 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1578 octave_value retval = 0; |
5453 | 1579 |
1580 if (args.length () == 1) | |
1581 { | |
1582 int status = args(0).int_value (); | |
1583 | |
1584 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1585 retval = octave_wait::stopsig (status); |
5453 | 1586 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1587 error ("WSTOPSIG: STATUS must be an integer"); |
5453 | 1588 } |
1589 | |
1590 return retval; | |
1591 } | |
1592 | |
1593 DEFUNX ("WIFCONTINUED", FWIFCONTINUED, args, , | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1594 "-*- texinfo -*-\n\ |
5453 | 1595 @deftypefn {Built-in Function} {} WIFCONTINUED (@var{status})\n\ |
1596 Given @var{status} from a call to @code{waitpid}, return true if the\n\ | |
1597 child process was resumed by delivery of @code{SIGCONT}.\n\ | |
1598 @seealso{waitpid, WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WCOREDUMP, WIFSTOPPED, WSTOPSIG}\n\ | |
1599 @end deftypefn") | |
1600 { | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1601 octave_value retval = false; |
5453 | 1602 |
1603 if (args.length () == 1) | |
1604 { | |
1605 int status = args(0).int_value (); | |
1606 | |
1607 if (! error_state) | |
15221
a83b7b2f95ee
avoid C-style cast warnings from GCC for wait-related macros
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
1608 retval = octave_wait::ifcontinued (status); |
5453 | 1609 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1610 error ("WIFCONTINUED: STATUS must be an integer"); |
5453 | 1611 } |
1612 | |
1613 return retval; | |
1614 } | |
1615 | |
10249
14eba566f9f0
use DEFUNX instead of DEFUN for canonicalize_file_name
John W. Eaton <jwe@octave.org>
parents:
10197
diff
changeset
|
1616 DEFUNX ("canonicalize_file_name", Fcanonicalize_file_name, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1617 "-*- texinfo -*-\n\ |
14819
67b6b47a22f6
doc: Clarify docstrings for canonicalize_file_name, make_absolute_filename
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1618 @deftypefn {Built-in Function} {[@var{cname}, @var{status}, @var{msg}] =} canonicalize_file_name (@var{fname})\n\ |
67b6b47a22f6
doc: Clarify docstrings for canonicalize_file_name, make_absolute_filename
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1619 Return the canonical name of file @var{fname}. If the file does not exist\n\ |
67b6b47a22f6
doc: Clarify docstrings for canonicalize_file_name, make_absolute_filename
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1620 the empty string (\"\") is returned.\n\ |
67b6b47a22f6
doc: Clarify docstrings for canonicalize_file_name, make_absolute_filename
Rik <octave@nomad.inbox5.com>
parents:
14429
diff
changeset
|
1621 @seealso{make_absolute_filename, is_absolute_filename, is_rooted_relative_filename}\n\ |
5138 | 1622 @end deftypefn") |
1623 { | |
1624 octave_value_list retval; | |
1625 | |
1626 if (args.length () == 1) | |
1627 { | |
1628 std::string name = args(0).string_value (); | |
1629 | |
1630 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1631 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1632 std::string msg; |
5138 | 1633 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1634 std::string result = octave_canonicalize_file_name (name, msg); |
5138 | 1635 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1636 retval(2) = msg; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1637 retval(1) = msg.empty () ? 0 : -1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1638 retval(0) = result; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10299
diff
changeset
|
1639 } |
5138 | 1640 else |
12483
7a5aacf65f81
Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents:
12212
diff
changeset
|
1641 error ("canonicalize_file_name: NAME must be a character string"); |
5138 | 1642 } |
1643 else | |
5823 | 1644 print_usage (); |
5138 | 1645 |
1646 return retval; | |
1647 } | |
1648 | |
5749 | 1649 static octave_value |
7924 | 1650 const_value (const octave_value_list& args, int val) |
5749 | 1651 { |
1652 octave_value retval; | |
1653 | |
1654 int nargin = args.length (); | |
1655 | |
1656 if (nargin == 0) | |
1657 retval = val; | |
1658 else | |
5823 | 1659 print_usage (); |
5749 | 1660 |
1661 return retval; | |
1662 } | |
1663 | |
2075 | 1664 #if !defined (O_NONBLOCK) && defined (O_NDELAY) |
1665 #define O_NONBLOCK O_NDELAY | |
1666 #endif | |
1667 | |
5749 | 1668 DEFUNX ("F_DUPFD", FF_DUPFD, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1669 "-*- texinfo -*-\n\ |
5749 | 1670 @deftypefn {Built-in Function} {} F_DUPFD ()\n\ |
14171
2ced2f59f523
doc: miscellaneous documentation improvements
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1671 Return the numerical value to pass to @code{fcntl} to return a\n\ |
5749 | 1672 duplicate file descriptor.\n\ |
1673 @seealso{fcntl, F_GETFD, F_GETFL, F_SETFD, F_SETFL}\n\ | |
1674 @end deftypefn") | |
2075 | 1675 { |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1676 #if defined (F_DUPFD) |
7924 | 1677 return const_value (args, F_DUPFD); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1678 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1679 error ("F_DUPFD: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1680 return octave_value (); |
2075 | 1681 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1682 } |
2075 | 1683 |
5749 | 1684 DEFUNX ("F_GETFD", FF_GETFD, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1685 "-*- texinfo -*-\n\ |
5749 | 1686 @deftypefn {Built-in Function} {} F_GETFD ()\n\ |
14171
2ced2f59f523
doc: miscellaneous documentation improvements
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1687 Return the numerical value to pass to @code{fcntl} to return the\n\ |
5749 | 1688 file descriptor flags.\n\ |
5333 | 1689 @seealso{fcntl, F_DUPFD, F_GETFL, F_SETFD, F_SETFL}\n\ |
5749 | 1690 @end deftypefn") |
1691 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1692 #if defined (F_GETFD) |
7924 | 1693 return const_value (args, F_GETFD); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1694 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1695 error ("F_GETFD: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1696 return octave_value (); |
2075 | 1697 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1698 } |
2075 | 1699 |
5749 | 1700 DEFUNX ("F_GETFL", FF_GETFL, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1701 "-*- texinfo -*-\n\ |
5749 | 1702 @deftypefn {Built-in Function} {} F_GETFL ()\n\ |
14171
2ced2f59f523
doc: miscellaneous documentation improvements
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1703 Return the numerical value to pass to @code{fcntl} to return the\n\ |
5749 | 1704 file status flags.\n\ |
5333 | 1705 @seealso{fcntl, F_DUPFD, F_GETFD, F_SETFD, F_SETFL}\n\ |
5749 | 1706 @end deftypefn") |
1707 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1708 #if defined (F_GETFL) |
7924 | 1709 return const_value (args, F_GETFL); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1710 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1711 error ("F_GETFL: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1712 return octave_value (); |
2075 | 1713 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1714 } |
2075 | 1715 |
5749 | 1716 DEFUNX ("F_SETFD", FF_SETFD, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1717 "-*- texinfo -*-\n\ |
5749 | 1718 @deftypefn {Built-in Function} {} F_SETFD ()\n\ |
14171
2ced2f59f523
doc: miscellaneous documentation improvements
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1719 Return the numerical value to pass to @code{fcntl} to set the file\n\ |
5749 | 1720 descriptor flags.\n\ |
5333 | 1721 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFL}\n\ |
5749 | 1722 @end deftypefn") |
1723 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1724 #if defined (F_SETFD) |
7924 | 1725 return const_value (args, F_SETFD); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1726 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1727 error ("F_SETFD: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1728 return octave_value (); |
2075 | 1729 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1730 } |
2075 | 1731 |
5749 | 1732 DEFUNX ("F_SETFL", FF_SETFL, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1733 "-*- texinfo -*-\n\ |
5749 | 1734 @deftypefn {Built-in Function} {} F_SETFL ()\n\ |
14171
2ced2f59f523
doc: miscellaneous documentation improvements
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
1735 Return the numerical value to pass to @code{fcntl} to set the file\n\ |
5749 | 1736 status flags.\n\ |
5333 | 1737 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFD}\n\ |
5749 | 1738 @end deftypefn") |
1739 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1740 #if defined (F_SETFL) |
7924 | 1741 return const_value (args, F_SETFL); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1742 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1743 error ("F_SETFL: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1744 return octave_value (); |
2075 | 1745 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1746 } |
2075 | 1747 |
5749 | 1748 DEFUNX ("O_APPEND", FO_APPEND, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1749 "-*- texinfo -*-\n\ |
5749 | 1750 @deftypefn {Built-in Function} {} O_APPEND ()\n\ |
1751 Return the numerical value of the file status flag that may be\n\ | |
1752 returned by @code{fcntl} to indicate each write operation appends,\n\ | |
11152
39ae406df598
Improve docstrings for functions found in undocumented list.
Rik <octave@nomad.inbox5.com>
parents:
11006
diff
changeset
|
1753 or that may be passed to @code{fcntl} to set the write mode to append.\n\ |
5333 | 1754 @seealso{fcntl, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1755 @end deftypefn") |
1756 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1757 #if defined (O_APPEND) |
7924 | 1758 return const_value (args, O_APPEND); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1759 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1760 error ("O_APPEND: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1761 return octave_value (); |
2075 | 1762 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1763 } |
2075 | 1764 |
5749 | 1765 DEFUNX ("O_ASYNC", FO_ASYNC, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1766 "-*- texinfo -*-\n\ |
5749 | 1767 @deftypefn {Built-in Function} {} O_ASYNC ()\n\ |
1768 Return the numerical value of the file status flag that may be\n\ | |
1769 returned by @code{fcntl} to indicate asynchronous I/O.\n\ | |
5333 | 1770 @seealso{fcntl, O_APPEND, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1771 @end deftypefn") |
1772 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1773 #if defined (O_ASYNC) |
7924 | 1774 return const_value (args, O_ASYNC); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1775 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1776 error ("O_ASYNC: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1777 return octave_value (); |
2669 | 1778 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1779 } |
2669 | 1780 |
5749 | 1781 DEFUNX ("O_CREAT", FO_CREAT, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1782 "-*- texinfo -*-\n\ |
5749 | 1783 @deftypefn {Built-in Function} {} O_CREAT ()\n\ |
1784 Return the numerical value of the file status flag that may be\n\ | |
1785 returned by @code{fcntl} to indicate that a file should be\n\ | |
1786 created if it does not exist.\n\ | |
5333 | 1787 @seealso{fcntl, O_APPEND, O_ASYNC, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1788 @end deftypefn") |
1789 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1790 #if defined (O_CREAT) |
7924 | 1791 return const_value (args, O_CREAT); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1792 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1793 error ("O_CREAT: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1794 return octave_value (); |
2075 | 1795 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1796 } |
2075 | 1797 |
5749 | 1798 DEFUNX ("O_EXCL", FO_EXCL, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1799 "-*- texinfo -*-\n\ |
5749 | 1800 @deftypefn {Built-in Function} {} O_EXCL ()\n\ |
1801 Return the numerical value of the file status flag that may be\n\ | |
1802 returned by @code{fcntl} to indicate that file locking is used.\n\ | |
5333 | 1803 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1804 @end deftypefn") |
1805 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1806 #if defined (O_EXCL) |
7924 | 1807 return const_value (args, O_EXCL); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1808 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1809 error ("O_EXCL: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1810 return octave_value (); |
2075 | 1811 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1812 } |
2075 | 1813 |
5749 | 1814 DEFUNX ("O_NONBLOCK", FO_NONBLOCK, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1815 "-*- texinfo -*-\n\ |
5749 | 1816 @deftypefn {Built-in Function} {} O_NONBLOCK ()\n\ |
1817 Return the numerical value of the file status flag that may be\n\ | |
1818 returned by @code{fcntl} to indicate that non-blocking I/O is in use,\n\ | |
1819 or that may be passsed to @code{fcntl} to set non-blocking I/O.\n\ | |
5333 | 1820 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1821 @end deftypefn") |
1822 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1823 #if defined (O_NONBLOCK) |
7924 | 1824 return const_value (args, O_NONBLOCK); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1825 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1826 error ("O_NONBLOCK: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1827 return octave_value (); |
2075 | 1828 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1829 } |
2075 | 1830 |
5749 | 1831 DEFUNX ("O_RDONLY", FO_RDONLY, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1832 "-*- texinfo -*-\n\ |
5749 | 1833 @deftypefn {Built-in Function} {} O_RDONLY ()\n\ |
1834 Return the numerical value of the file status flag that may be\n\ | |
1835 returned by @code{fcntl} to indicate that a file is open for\n\ | |
1836 reading only.\n\ | |
5333 | 1837 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1838 @end deftypefn") |
1839 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1840 #if defined (O_RDONLY) |
7924 | 1841 return const_value (args, O_RDONLY); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1842 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1843 error ("O_RDONLY: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1844 return octave_value (); |
2075 | 1845 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1846 } |
2075 | 1847 |
5749 | 1848 DEFUNX ("O_RDWR", FO_RDWR, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1849 "-*- texinfo -*-\n\ |
5749 | 1850 @deftypefn {Built-in Function} {} O_RDWR ()\n\ |
1851 Return the numerical value of the file status flag that may be\n\ | |
1852 returned by @code{fcntl} to indicate that a file is open for both\n\ | |
1853 reading and writing.\n\ | |
5333 | 1854 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_SYNC, O_TRUNC, O_WRONLY}\n\ |
5749 | 1855 @end deftypefn") |
1856 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1857 #if defined (O_RDWR) |
7924 | 1858 return const_value (args, O_RDWR); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1859 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1860 error ("O_RDWR: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1861 return octave_value (); |
2075 | 1862 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1863 } |
2075 | 1864 |
5749 | 1865 DEFUNX ("O_SYNC", FO_SYNC, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1866 "-*- texinfo -*-\n\ |
5749 | 1867 @deftypefn {Built-in Function} {} O_SYNC ()\n\ |
1868 Return the numerical value of the file status flag that may be\n\ | |
1869 returned by @code{fcntl} to indicate that a file is open for\n\ | |
1870 synchronous I/O.\n\ | |
5333 | 1871 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY}\n\ |
5749 | 1872 @end deftypefn") |
1873 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1874 #if defined (O_SYNC) |
7924 | 1875 return const_value (args, O_SYNC); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1876 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1877 error ("O_SYNC: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1878 return octave_value (); |
2669 | 1879 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1880 } |
2669 | 1881 |
5749 | 1882 DEFUNX ("O_TRUNC", FO_TRUNC, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1883 "-*- texinfo -*-\n\ |
11572
7d6d8c1e471f
Grammarcheck Texinfo for files in src directory.
Rik <octave@nomad.inbox5.com>
parents:
11546
diff
changeset
|
1884 @deftypefn {Built-in Function} O_TRUNC ()\n\ |
5749 | 1885 Return the numerical value of the file status flag that may be\n\ |
1886 returned by @code{fcntl} to indicate that if file exists, it should\n\ | |
1887 be truncated when writing.\n\ | |
5333 | 1888 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_WRONLY}\n\ |
5749 | 1889 @end deftypefn") |
1890 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1891 #if defined (O_TRUNC) |
7924 | 1892 return const_value (args, O_TRUNC); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1893 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1894 error ("O_TRUNC: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1895 return octave_value (); |
2075 | 1896 #endif |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1897 } |
2075 | 1898 |
5749 | 1899 DEFUNX ("O_WRONLY", FO_WRONLY, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1900 "-*- texinfo -*-\n\ |
5749 | 1901 @deftypefn {Built-in Function} {} O_WRONLY ()\n\ |
1902 Return the numerical value of the file status flag that may be\n\ | |
1903 returned by @code{fcntl} to indicate that a file is open for\n\ | |
1904 writing only.\n\ | |
5333 | 1905 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC}\n\ |
5749 | 1906 @end deftypefn") |
1907 { | |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1908 #if defined (O_WRONLY) |
7924 | 1909 return const_value (args, O_WRONLY); |
14111
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1910 #else |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1911 error ("O_WRONLY: not available on this system"); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1912 return octave_value (); |
c5222658dc3c
doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents:
14022
diff
changeset
|
1913 #endif |
5749 | 1914 } |
3446 | 1915 |
5453 | 1916 #if !defined (WNOHANG) |
1917 #define WNOHANG 0 | |
1918 #endif | |
1919 | |
5749 | 1920 DEFUNX ("WNOHANG", FWNOHANG, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1921 "-*- texinfo -*-\n\ |
5749 | 1922 @deftypefn {Built-in Function} {} WNOHANG ()\n\ |
1923 Return the numerical value of the option argument that may be\n\ | |
1924 passed to @code{waitpid} to indicate that it should return its\n\ | |
1925 status immediately instead of waiting for a process to exit.\n\ | |
5453 | 1926 @seealso{waitpid, WUNTRACED, WCONTINUE}\n\ |
5749 | 1927 @end deftypefn") |
1928 { | |
7924 | 1929 return const_value (args, WNOHANG); |
5749 | 1930 } |
5453 | 1931 |
1932 #if !defined (WUNTRACED) | |
1933 #define WUNTRACED 0 | |
1934 #endif | |
1935 | |
5749 | 1936 DEFUNX ("WUNTRACED", FWUNTRACED, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1937 "-*- texinfo -*-\n\ |
5749 | 1938 @deftypefn {Built-in Function} {} WUNTRACED ()\n\ |
1939 Return the numerical value of the option argument that may be\n\ | |
1940 passed to @code{waitpid} to indicate that it should also return\n\ | |
1941 if the child process has stopped but is not traced via the\n\ | |
1942 @code{ptrace} system call\n\ | |
5453 | 1943 @seealso{waitpid, WNOHANG, WCONTINUE}\n\ |
5749 | 1944 @end deftypefn") |
1945 { | |
7924 | 1946 return const_value (args, WUNTRACED); |
5749 | 1947 } |
5453 | 1948 |
1949 #if !defined (WCONTINUE) | |
1950 #define WCONTINUE 0 | |
1951 #endif | |
1952 | |
5749 | 1953 DEFUNX ("WCONTINUE", FWCONTINUE, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1954 "-*- texinfo -*-\n\ |
9724
f22bbc5d56e9
Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents:
9564
diff
changeset
|
1955 @deftypefn {Built-in Function} {} WCONTINUE ()\n\ |
5749 | 1956 Return the numerical value of the option argument that may be\n\ |
1957 passed to @code{waitpid} to indicate that it should also return\n\ | |
1958 if a stopped child has been resumed by delivery of a @code{SIGCONT}\n\ | |
1959 signal.\n\ | |
5453 | 1960 @seealso{waitpid, WNOHANG, WUNTRACED}\n\ |
5749 | 1961 @end deftypefn") |
1962 { | |
7924 | 1963 return const_value (args, WCONTINUE); |
2075 | 1964 } |
19301
e90bfaadb489
doc: Increase seealso links between low level C IO functions.
Rik <rik@octave.org>
parents:
18111
diff
changeset
|
1965 |