diff libinterp/corefcn/file-io.cc @ 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 e5a1e7951908
children 3b4d6780d6b8
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc	Tue Oct 21 14:37:44 2014 -0400
+++ b/libinterp/corefcn/file-io.cc	Wed Oct 22 10:41:15 2014 -0700
@@ -1930,11 +1930,11 @@
   return retval;
 }
 
-DEFUNX ("tmpnam", Ftmpnam, args, ,
-        "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{fname} =} tmpnam ()\n\
-@deftypefnx {Built-in Function} {@var{fname} =} tmpnam (@var{dir})\n\
-@deftypefnx {Built-in Function} {@var{fname} =} tmpnam (@var{dir}, @var{prefix})\n\
+DEFUN (tempname, args, ,
+       "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{fname} =} tempname ()\n\
+@deftypefnx {Built-in Function} {@var{fname} =} tempname (@var{dir})\n\
+@deftypefnx {Built-in Function} {@var{fname} =} tempname (@var{dir}, @var{prefix})\n\
 Return a unique temporary file name as a string.\n\
 \n\
 If @var{prefix} is omitted, a value of @qcode{\"oct-\"} is used.\n\
@@ -1942,12 +1942,11 @@
 (@code{P_tmpdir} is used.  If @var{dir} is provided, it must exist,\n\
 otherwise the default directory for temporary files is used.\n\
 \n\
-Programming Note: Because the named file is not opened by @code{tmpnam},\n\
+Programming Note: Because the named file is not opened by @code{tempname},\n\
 it is possible, though relatively unlikely, that it will not be available\n\
 by the time your program attempts to open it.  If this is a concern,\n\
-see @code{tmpfile}.  The functions @code{tmpnam} and @code{tempname} are\n\
-equivalent with the latter provided for @sc{matlab} compatibility.\n\
-@seealso{tempname, mkstemp, tempdir, P_tmpdir, tmpfile}\n\
+see @code{tmpfile}.\n\
+@seealso{mkstemp, tempdir, P_tmpdir, tmpfile}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -1989,7 +1988,7 @@
 If successful, @var{fid} is a valid file ID and @var{msg} is an empty\n\
 string.  Otherwise, @var{fid} is -1 and @var{msg} contains a\n\
 system-dependent error message.\n\
-@seealso{tempname, tmpnam, mkstemp, tempdir, P_tmpdir}\n\
+@seealso{tempname, mkstemp, tempdir, P_tmpdir}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -2049,7 +2048,7 @@
 If successful, @var{fid} is a valid file ID, @var{name} is the name of the\n\
 file, and @var{msg} is an empty string.  Otherwise, @var{fid} is -1,\n\
 @var{name} is empty, and @var{msg} contains a system-dependent error message.\n\
-@seealso{tempname, tmpnam, tempdir, P_tmpdir, tmpfile, fopen}\n\
+@seealso{tempname, tempdir, P_tmpdir, tmpfile, fopen}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -2220,7 +2219,7 @@
 default location.  This value may not agree with that returned from\n\
 @code{tempdir} if the user has overriden the default with the @env{TMPDIR}\n\
 environment variable.\n\
-@seealso{tempdir, tempname, tmpnam, mkstemp, tmpfile}\n\
+@seealso{tempdir, tempname, mkstemp, tmpfile}\n\
 @end deftypefn")
 {
   octave_value retval;