# HG changeset patch # User John W. Eaton # Date 1294987199 18000 # Node ID fe199165212ec3ae7ecc3fcd9b7ca82d5e458773 # Parent 4f60db87514724920554ed1c8f47ad757b29987d use mkstemp from gnulib diff -r 4f60db875147 -r fe199165212e ChangeLog --- a/ChangeLog Thu Jan 13 16:53:08 2011 -0500 +++ b/ChangeLog Fri Jan 14 01:39:59 2011 -0500 @@ -1,3 +1,7 @@ +2011-01-13 John W. Eaton + + * bootstrap.conf (gnulib_modules): Include mkstemp in the list. + 2011-01-13 John W. Eaton * configure.ac (AC_ARG_ENABLE(extra-warning-flags)): diff -r 4f60db875147 -r fe199165212e bootstrap.conf --- a/bootstrap.conf Thu Jan 13 16:53:08 2011 -0500 +++ b/bootstrap.conf Fri Jan 14 01:39:59 2011 -0500 @@ -32,6 +32,7 @@ lstat mkdir mkfifo + mkstemp mktime nanosleep pathmax diff -r 4f60db875147 -r fe199165212e src/ChangeLog --- a/src/ChangeLog Thu Jan 13 16:53:08 2011 -0500 +++ b/src/ChangeLog Fri Jan 14 01:39:59 2011 -0500 @@ -1,3 +1,9 @@ +2011-01-13 John W. Eaton + + * file-io.cc (mkstemp): Delete. + Delete decl for mkstemps. + (Fmkstemp): Assume we have mkstemp from gnulib. + 2011-01-13 John W. Eaton * DLD-FUNCTIONS/__pchip_deriv__.cc, DLD-FUNCTIONS/dot.cc, diff -r 4f60db875147 -r fe199165212e src/file-io.cc --- a/src/file-io.cc Thu Jan 13 16:53:08 2011 -0500 +++ b/src/file-io.cc Fri Jan 14 01:39:59 2011 -0500 @@ -1945,25 +1945,6 @@ return retval; } -#if defined (HAVE_MKSTEMPS) -// Prototype for mkstemps in libiberty -extern "C" int mkstemps (char *pattern, int suffix_len); -#endif - -#if ! defined (HAVE_MKSTEMP) && ! defined (HAVE_MKSTEMPS) && defined (_MSC_VER) -#include -#include -int mkstemp (char *tmpl) -{ - int ret=-1; - mktemp (tmpl); - ret = open (tmpl, O_RDWR | O_BINARY | O_CREAT | O_EXCL | _O_SHORT_LIVED, - _S_IREAD | _S_IWRITE); - return ret; -} -#define HAVE_MKSTEMP 1 -#endif - DEFUN (mkstemp, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {[@var{fid}, @var{name}, @var{msg}] =} mkstemp (@var{template}, @var{delete})\n\ @@ -1992,8 +1973,6 @@ retval(1) = std::string (); retval(0) = -1; -#if defined (HAVE_MKSTEMP) || defined (HAVE_MKSTEMPS) - int nargin = args.length (); if (nargin == 1 || nargin == 2) @@ -2005,11 +1984,7 @@ OCTAVE_LOCAL_BUFFER (char, tmp, tmpl8.size () + 1); strcpy (tmp, tmpl8.c_str ()); -#if defined (HAVE_MKSTEMP) int fd = mkstemp (tmp); -#else - int fd = mkstemps (tmp, 0); -#endif if (fd < 0) { @@ -2054,10 +2029,6 @@ else print_usage (); -#else - retval(2) = "mkstemp: not supported on this sytem"; -#endif - return retval; }