Mercurial > octave-antonio
annotate doc/interpreter/system.txi @ 8817:03b7f618ab3d
include docstrings for new functions in the manual
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Feb 2009 15:39:19 -0500 |
parents | 2479ebf1c33f |
children | eb63fbe60fab |
rev | line source |
---|---|
7018 | 1 @c Copyright (C) 1996, 1997, 1999, 2000, 2002, 2007 John W. Eaton |
2 @c | |
3 @c This file is part of Octave. | |
4 @c | |
5 @c Octave is free software; you can redistribute it and/or modify it | |
6 @c under the terms of the GNU General Public License as published by the | |
7 @c Free Software Foundation; either version 3 of the License, or (at | |
8 @c your option) any later version. | |
9 @c | |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 @c for more details. | |
14 @c | |
15 @c You should have received a copy of the GNU General Public License | |
16 @c along with Octave; see the file COPYING. If not, see | |
17 @c <http://www.gnu.org/licenses/>. | |
3294 | 18 |
4167 | 19 @node System Utilities |
3294 | 20 @chapter System Utilities |
21 | |
22 This chapter describes the functions that are available to allow you to | |
23 get information about what is happening outside of Octave, while it is | |
24 still running, and use this information in your program. For example, | |
25 you can get information about environment variables, the current time, | |
26 and even start other programs from the Octave prompt. | |
27 | |
28 @menu | |
29 * Timing Utilities:: | |
30 * Filesystem Utilities:: | |
6549 | 31 * File Archiving Utilities:: |
32 * Networking Utilities:: | |
3294 | 33 * Controlling Subprocesses:: |
34 * Process ID Information:: | |
35 * Environment Variables:: | |
36 * Current Working Directory:: | |
37 * Password Database Functions:: | |
38 * Group Database Functions:: | |
39 * System Information:: | |
6702 | 40 * Hashing Functions:: |
3294 | 41 @end menu |
42 | |
4167 | 43 @node Timing Utilities |
3294 | 44 @section Timing Utilities |
45 | |
46 Octave's core set of functions for manipulating time values are | |
47 patterned after the corresponding functions from the standard C library. | |
48 Several of these functions use a data structure for time that includes | |
49 the following elements: | |
50 | |
51 @table @code | |
52 @item usec | |
53 Microseconds after the second (0-999999). | |
54 | |
55 @item sec | |
56 Seconds after the minute (0-61). This number can be 61 to account | |
57 for leap seconds. | |
58 | |
59 @item min | |
60 Minutes after the hour (0-59). | |
61 | |
62 @item hour | |
63 Hours since midnight (0-23). | |
64 | |
65 @item mday | |
66 Day of the month (1-31). | |
67 | |
68 @item mon | |
69 Months since January (0-11). | |
70 | |
71 @item year | |
72 Years since 1900. | |
73 | |
74 @item wday | |
75 Days since Sunday (0-6). | |
76 | |
77 @item yday | |
78 Days since January 1 (0-365). | |
79 | |
80 @item isdst | |
81 Daylight Savings Time flag. | |
82 | |
83 @item zone | |
84 Time zone. | |
85 @end table | |
86 | |
87 @noindent | |
88 In the descriptions of the following functions, this structure is | |
89 referred to as a @var{tm_struct}. | |
90 | |
3301 | 91 @DOCSTRING(time) |
3294 | 92 |
6502 | 93 @DOCSTRING(now) |
94 | |
3294 | 95 @DOCSTRING(ctime) |
96 | |
3301 | 97 @DOCSTRING(gmtime) |
3294 | 98 |
3301 | 99 @DOCSTRING(localtime) |
3294 | 100 |
3301 | 101 @DOCSTRING(mktime) |
3294 | 102 |
3301 | 103 @DOCSTRING(asctime) |
3294 | 104 |
105 @DOCSTRING(strftime) | |
106 | |
4169 | 107 @DOCSTRING(strptime) |
108 | |
3294 | 109 Most of the remaining functions described in this section are not |
110 patterned after the standard C library. Some are available for | |
6939 | 111 compatibility with @sc{Matlab} and others are provided because they are |
3294 | 112 useful. |
113 | |
3301 | 114 @DOCSTRING(clock) |
3294 | 115 |
3301 | 116 @DOCSTRING(date) |
3294 | 117 |
3301 | 118 @DOCSTRING(etime) |
3294 | 119 |
3301 | 120 @DOCSTRING(cputime) |
3294 | 121 |
3301 | 122 @DOCSTRING(is_leap_year) |
3294 | 123 |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
124 @anchor{doc-toc} |
3301 | 125 @DOCSTRING(tic) |
3294 | 126 |
3301 | 127 @DOCSTRING(pause) |
3294 | 128 |
3301 | 129 @DOCSTRING(sleep) |
3294 | 130 |
3301 | 131 @DOCSTRING(usleep) |
3294 | 132 |
7984
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
133 @DOCSTRING(datenum) |
6502 | 134 |
135 @DOCSTRING(datestr) | |
136 | |
137 @DOCSTRING(datevec) | |
138 | |
7984
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
139 @DOCSTRING(addtodate) |
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
140 |
6502 | 141 @DOCSTRING(calendar) |
142 | |
143 @DOCSTRING(weekday) | |
144 | |
145 @DOCSTRING(eomday) | |
146 | |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
147 @DOCSTRING(datetick) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
148 |
4167 | 149 @node Filesystem Utilities |
3294 | 150 @section Filesystem Utilities |
151 | |
152 Octave includes the following functions for renaming and deleting files, | |
153 creating, deleting, and reading directories, and for getting information | |
154 about the status of files. | |
155 | |
3301 | 156 @DOCSTRING(rename) |
3294 | 157 |
3710 | 158 @DOCSTRING(link) |
159 | |
160 @DOCSTRING(symlink) | |
161 | |
4169 | 162 @DOCSTRING(readlink) |
163 | |
3301 | 164 @DOCSTRING(unlink) |
3294 | 165 |
3301 | 166 @DOCSTRING(readdir) |
3294 | 167 |
3301 | 168 @DOCSTRING(mkdir) |
3294 | 169 |
3301 | 170 @DOCSTRING(rmdir) |
3294 | 171 |
6550 | 172 @DOCSTRING(confirm_recursive_rmdir) |
173 | |
3301 | 174 @DOCSTRING(mkfifo) |
3294 | 175 |
3301 | 176 @DOCSTRING(umask) |
3294 | 177 |
8549 | 178 @anchor{doc-lstat} |
3301 | 179 @DOCSTRING(stat) |
3294 | 180 |
8549 | 181 @DOCSTRING(fstat) |
6549 | 182 |
183 @DOCSTRING(fileattrib) | |
184 | |
185 @DOCSTRING(isdir) | |
186 | |
3301 | 187 @DOCSTRING(glob) |
3294 | 188 |
3428 | 189 @DOCSTRING(fnmatch) |
190 | |
3301 | 191 @DOCSTRING(file_in_path) |
3294 | 192 |
3301 | 193 @DOCSTRING(tilde_expand) |
3294 | 194 |
6549 | 195 @DOCSTRING(canonicalize_file_name) |
196 | |
197 @DOCSTRING(movefile) | |
198 | |
199 @DOCSTRING(copyfile) | |
200 | |
201 @DOCSTRING(fileparts) | |
202 | |
203 @DOCSTRING(filesep) | |
204 | |
7984
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
205 @DOCSTRING(filemarker) |
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
206 |
6549 | 207 @DOCSTRING(fullfile) |
208 | |
209 @DOCSTRING(tempdir) | |
210 | |
211 @DOCSTRING(tempname) | |
212 | |
213 @DOCSTRING(P_tmpdir) | |
214 | |
8817
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
215 @DOCSTRING(is_absolute_filename) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
216 |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
217 @DOCSTRING(is_rooted_relative_filename) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
218 |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
219 @DOCSTRING(make_absolute_filename) |
03b7f618ab3d
include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents:
8653
diff
changeset
|
220 |
6549 | 221 @node File Archiving Utilities |
222 @section File Archiving Utilities | |
223 | |
224 @DOCSTRING(bunzip2) | |
225 | |
6868 | 226 @DOCSTRING(gzip) |
227 | |
6549 | 228 @DOCSTRING(gunzip) |
229 | |
230 @DOCSTRING(tar) | |
231 | |
232 @DOCSTRING(untar) | |
233 | |
234 @DOCSTRING(zip) | |
235 | |
236 @DOCSTRING(unzip) | |
237 | |
238 @DOCSTRING(pack) | |
239 | |
240 @DOCSTRING(unpack) | |
241 | |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
242 @DOCSTRING(bzip2) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
243 |
6549 | 244 @node Networking Utilities |
245 @section Networking Utilities | |
246 | |
247 @DOCSTRING(urlread) | |
248 | |
249 @DOCSTRING(urlwrite) | |
250 | |
4167 | 251 @node Controlling Subprocesses |
3294 | 252 @section Controlling Subprocesses |
253 | |
254 Octave includes some high-level commands like @code{system} and | |
255 @code{popen} for starting subprocesses. If you want to run another | |
256 program to perform some task and then look at its output, you will | |
257 probably want to use these functions. | |
258 | |
259 Octave also provides several very low-level Unix-like functions which | |
260 can also be used for starting subprocesses, but you should probably only | |
261 use them if you can't find any way to do what you need with the | |
262 higher-level functions. | |
263 | |
3301 | 264 @DOCSTRING(system) |
3294 | 265 |
6549 | 266 @DOCSTRING(unix) |
267 | |
268 @DOCSTRING(dos) | |
269 | |
7984
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
270 @DOCSTRING(perl) |
bbaa5d7d0143
Some documentation updates
David Bateman <dbateman@free.fr>
parents:
7018
diff
changeset
|
271 |
3301 | 272 @DOCSTRING(popen) |
3294 | 273 |
3301 | 274 @DOCSTRING(pclose) |
3294 | 275 |
3301 | 276 @DOCSTRING(popen2) |
3294 | 277 |
3301 | 278 @DOCSTRING(EXEC_PATH) |
3294 | 279 |
280 In most cases, the following functions simply decode their arguments and | |
281 make the corresponding Unix system calls. For a complete example of how | |
282 they can be used, look at the definition of the function @code{popen2}. | |
283 | |
3301 | 284 @DOCSTRING(fork) |
3294 | 285 |
3301 | 286 @DOCSTRING(exec) |
3294 | 287 |
3301 | 288 @DOCSTRING(pipe) |
3294 | 289 |
3301 | 290 @DOCSTRING(dup2) |
3294 | 291 |
3301 | 292 @DOCSTRING(waitpid) |
3294 | 293 |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
294 @DOCSTRING(WCONTINUE) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
295 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
296 @DOCSTRING(WCOREDUMP) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
297 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
298 @DOCSTRING(WEXITSTATUS) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
299 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
300 @DOCSTRING(WIFCONTINUED) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
301 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
302 @DOCSTRING(WIFSIGNALED) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
303 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
304 @DOCSTRING(WIFSTOPPED) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
305 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
306 @DOCSTRING(WIFEXITED) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
307 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
308 @DOCSTRING(WNOHANG) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
309 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
310 @DOCSTRING(WSTOPSIG) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
311 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
312 @DOCSTRING(WTERMSIG) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
313 |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
314 @DOCSTRING(WUNTRACED) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
315 |
3301 | 316 @DOCSTRING(fcntl) |
3294 | 317 |
6549 | 318 @DOCSTRING(kill) |
319 | |
320 @DOCSTRING(SIG) | |
321 | |
4167 | 322 @node Process ID Information |
3294 | 323 @section Process, Group, and User IDs |
324 | |
3301 | 325 @DOCSTRING(getpgrp) |
3294 | 326 |
3301 | 327 @DOCSTRING(getpid) |
3294 | 328 |
3301 | 329 @DOCSTRING(getppid) |
3294 | 330 |
3301 | 331 @DOCSTRING(geteuid) |
3294 | 332 |
3301 | 333 @DOCSTRING(getuid) |
3294 | 334 |
3301 | 335 @DOCSTRING(getegid) |
3294 | 336 |
3301 | 337 @DOCSTRING(getgid) |
3294 | 338 |
4167 | 339 @node Environment Variables |
3294 | 340 @section Environment Variables |
341 | |
3301 | 342 @DOCSTRING(getenv) |
3294 | 343 |
3301 | 344 @DOCSTRING(putenv) |
3294 | 345 |
4167 | 346 @node Current Working Directory |
3294 | 347 @section Current Working Directory |
348 | |
3301 | 349 @DOCSTRING(cd) |
3294 | 350 |
3301 | 351 @DOCSTRING(ls) |
3294 | 352 |
6549 | 353 @DOCSTRING(ls_command) |
354 | |
355 @DOCSTRING(dir) | |
356 | |
3301 | 357 @DOCSTRING(pwd) |
3294 | 358 |
4167 | 359 @node Password Database Functions |
3294 | 360 @section Password Database Functions |
361 | |
362 Octave's password database functions return information in a structure | |
363 with the following fields. | |
364 | |
365 @table @code | |
366 @item name | |
367 The user name. | |
368 | |
369 @item passwd | |
370 The encrypted password, if available. | |
371 | |
372 @item uid | |
373 The numeric user id. | |
374 | |
375 @item gid | |
376 The numeric group id. | |
377 | |
378 @item gecos | |
379 The GECOS field. | |
380 | |
381 @item dir | |
382 The home directory. | |
383 | |
384 @item shell | |
385 The initial shell. | |
386 @end table | |
387 | |
388 In the descriptions of the following functions, this data structure is | |
389 referred to as a @var{pw_struct}. | |
390 | |
3301 | 391 @DOCSTRING(getpwent) |
3294 | 392 |
3301 | 393 @DOCSTRING(getpwuid) |
3294 | 394 |
3301 | 395 @DOCSTRING(getpwnam) |
3294 | 396 |
3301 | 397 @DOCSTRING(setpwent) |
3294 | 398 |
3301 | 399 @DOCSTRING(endpwent) |
3294 | 400 |
4167 | 401 @node Group Database Functions |
3294 | 402 @section Group Database Functions |
403 | |
404 Octave's group database functions return information in a structure | |
405 with the following fields. | |
406 | |
407 @table @code | |
408 @item name | |
409 The user name. | |
410 | |
411 @item passwd | |
412 The encrypted password, if available. | |
413 | |
414 @item gid | |
415 The numeric group id. | |
416 | |
417 @item mem | |
418 The members of the group. | |
419 @end table | |
420 | |
421 In the descriptions of the following functions, this data structure is | |
422 referred to as a @var{grp_struct}. | |
423 | |
3301 | 424 @DOCSTRING(getgrent) |
3294 | 425 |
3301 | 426 @DOCSTRING(getgrgid) |
427 | |
428 @DOCSTRING(getgrnam) | |
3294 | 429 |
3301 | 430 @DOCSTRING(setgrent) |
3294 | 431 |
3301 | 432 @DOCSTRING(endgrent) |
3294 | 433 |
4167 | 434 @node System Information |
3294 | 435 @section System Information |
436 | |
3301 | 437 @DOCSTRING(computer) |
3294 | 438 |
6549 | 439 @DOCSTRING(uname) |
440 | |
441 @DOCSTRING(ispc) | |
442 | |
443 @DOCSTRING(isunix) | |
444 | |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
445 @DOCSTRING(ismac) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
446 |
3301 | 447 @DOCSTRING(isieee) |
3294 | 448 |
6623 | 449 @DOCSTRING(OCTAVE_HOME) |
450 | |
3301 | 451 @DOCSTRING(OCTAVE_VERSION) |
3294 | 452 |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
453 @DOCSTRING(license) |
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7984
diff
changeset
|
454 |
6623 | 455 @DOCSTRING(version) |
456 | |
457 @DOCSTRING(ver) | |
458 | |
3301 | 459 @DOCSTRING(octave_config_info) |
3294 | 460 |
3301 | 461 @DOCSTRING(getrusage) |
6702 | 462 |
463 @node Hashing Functions | |
464 @section Hashing Functions | |
465 | |
466 It is often necessary to find if two strings or files are | |
467 identical. This might be done by comparing them character by character | |
468 and looking for differences. However, this can be slow, and so comparing | |
469 a hash of the string or file can be a rapid way of finding if the files | |
470 differ. | |
471 | |
472 Another use of the hashing function is to check for file integrity. The | |
473 user can check the hash of the file against a known value and find if | |
474 the file they have is the same as the one that the original hash was | |
475 produced with. | |
476 | |
7007 | 477 Octave supplies the @code{md5sum} function to perform MD5 hashes on |
6702 | 478 strings and files. An example of the use of @code{md5sum} function might |
479 be | |
480 | |
481 @example | |
482 @group | |
483 if exist (file, "file") | |
484 hash = md5sum (file); | |
485 else | |
486 # Treat the variable "file" as a string | |
487 hash = md5sum (file, true); | |
488 endif | |
489 @end group | |
490 @end example | |
491 | |
492 @DOCSTRING(md5sum) |