19460
|
1 ## Copyright (C) 2014 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
|
18 |
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Built-in Function} {@var{fname} =} octave_tmp_file_name () |
|
21 ## @deftypefnx {Built-in Function} {@var{fname} =} octave_tmp_file_name (@var{dir}) |
|
22 ## @deftypefnx {Built-in Function} {@var{fname} =} octave_tmp_file_name (@var{dir}, @var{prefix}) |
|
23 ## |
|
24 ## @code{octave_tmp_file_name} is deprecated and will be removed in Octave |
|
25 ## version 4.6. Use @code{tempname} for equivalent functionality. |
|
26 ## |
|
27 ## Return a unique temporary file name as a string. |
|
28 ## |
|
29 ## If @var{prefix} is omitted, a value of @qcode{"oct-"} is used. |
|
30 ## If @var{dir} is also omitted, the default directory for temporary files |
|
31 ## (@code{P_tmpdir} is used. If @var{dir} is provided, it must exist, |
|
32 ## otherwise the default directory for temporary files is used. |
|
33 ## @seealso{tempname, tmpnam, mkstemp, tempdir, P_tmpdir, tmpfile} |
|
34 ## @end deftypefn |
|
35 |
|
36 ## Deprecated in version 4.2 |
|
37 |
|
38 |
|
39 function filename = octave_tmp_file_name (varargin) |
|
40 |
|
41 persistent warned = false; |
|
42 if (! warned) |
|
43 warned = true; |
|
44 warning ("Octave:deprecated-function", |
|
45 "octave_tmp_file_name is obsolete and will be removed from a future version of Octave, please use tempname instead"); |
|
46 endif |
|
47 |
|
48 filename = tmpnam (varargin{:}); |
|
49 |
|
50 endfunction |
|
51 |
|
52 |
|
53 %!assert (1) |
|
54 |