annotate scripts/miscellaneous/tmpnam.m @ 19312:6ca096827123

Use tempname() rather than tmpnam() in core Octave. * scripts/miscellaneous/tempname.m: Removed m-file as function is now C++. * scripts/miscellaneous/tmpnam.m: New m-file is an alias that calls tempname. * scripts/miscellaneous/module.mk: Add tmpnam.m to build system. * io.txi: Place tempname, tempdir, P_tmpdir docstrings in section on temporary files. * system.txi: Remove tempname, tempdir, P_tmpdir docstrings from generic system functions section of manual. * dirfns.cc, dlmread.cc, md5sum.cc, ov-fcn-handle.cc: Replace instances of tmpnam with tempname in BIST code. * file-io.cc (Ftempname): Change DEFUNX for tmpnam to DEFUN for tempname. Remove seealso links to tmpnam. * ftp.m, playaudio.m, wavwrite.m, imformats.m, imread.m, imwrite.m, imageIO.m, csvwrite.m, dlmwrite.m, fileread.m, importdata.m, textread.m, textscan.m, genvarname.m, unpack.m, install.m, legend.m, __gnuplot_drawnow__.m, copyobj.m, hgsave.m, print.m, __ghostscript__.m, __gnuplot_get_var__.m, __gnuplot_ginput__.m, __gnuplot_print__.m: Replace tmpnam with tempname in core code. * build-sparse-tests.sh, io.tst, prefer.tst, system.tst: Replace tmpnam with tempname in test code.
author Rik <rik@octave.org>
date Wed, 22 Oct 2014 10:41:15 -0700
parents
children db92e7e28e1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19312
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
1 ## Copyright (C) 2003-2013 John W. Eaton
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
2 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
4 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
8 ## your option) any later version.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
9 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
13 ## General Public License for more details.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
14 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
18
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{fname} =} tmpnam ()
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
21 ## @deftypefnx {Function File} {@var{fname} =} tmpnam (@var{dir})
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
22 ## @deftypefnx {Function File} {@var{fname} =} tmpnam (@var{dir}, @var{prefix})
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
23 ## Return a unique temporary file name as a string.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
24 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
25 ## If @var{prefix} is omitted, a value of @qcode{"oct-"} is used.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
26 ## If @var{dir} is also omitted, the default directory for temporary files
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
27 ## (@code{P_tmpdir} is used. If @var{dir} is provided, it must exist,
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
28 ## otherwise the default directory for temporary files is used.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
29 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
30 ## Programming Note: Because the named file is not opened by @code{tmpnam},
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
31 ## it is possible, though relatively unlikely, that it will not be available
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
32 ## by the time your program attempts to open it. If this is a concern,
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
33 ## see @code{tmpfile}. The functions @code{tmpnam} and @code{tmpnam} are
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
34 ## equivalent with the latter provided for @sc{matlab} compatibility.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
35 ##
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
36 ## @strong{Caution}: @code{tmpnam} will be removed in a future version of
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
37 ## Octave. Use the equivalent @code{tempname} in all new code.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
38 ## @seealso{tempname, mkstemp, tempdir, P_tmpdir, tmpfile}
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
39 ## @end deftypefn
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
40
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
41 function filename = tmpnam (varargin)
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
42
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
43 filename = tempname (varargin{:});
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
44
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
45 endfunction
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
46
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
47
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
48 ## No tests needed for alias.
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
49 %!assert (1)
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents:
diff changeset
50