Mercurial > hg > octave-lyh
changeset 11520:fe199165212e
use mkstemp from gnulib
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jan 2011 01:39:59 -0500 |
parents | 4f60db875147 |
children | 00fe5069b70e |
files | ChangeLog bootstrap.conf src/ChangeLog src/file-io.cc |
diffstat | 4 files changed, 11 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-01-13 John W. Eaton <jwe@octave.org> + + * bootstrap.conf (gnulib_modules): Include mkstemp in the list. + 2011-01-13 John W. Eaton <jwe@octave.org> * configure.ac (AC_ARG_ENABLE(extra-warning-flags)):
--- a/bootstrap.conf +++ b/bootstrap.conf @@ -32,6 +32,7 @@ lstat mkdir mkfifo + mkstemp mktime nanosleep pathmax
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-01-13 John W. Eaton <jwe@octave.org> + + * file-io.cc (mkstemp): Delete. + Delete decl for mkstemps. + (Fmkstemp): Assume we have mkstemp from gnulib. + 2011-01-13 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/__pchip_deriv__.cc, DLD-FUNCTIONS/dot.cc,
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -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 <fcntl.h> -#include <sys/stat.h> -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; }