# HG changeset patch # User Michael Goffioul # Date 1242936728 -3600 # Node ID c02224afead667683be30e023f0212ceaa457b85 # Parent b0395373253052d1795f9cfae9fae86341ef9a30 Add mkstemp implementation based on mktemp, for platforms missing it diff -r b03953732530 -r c02224afead6 src/ChangeLog --- a/src/ChangeLog Thu May 21 21:07:36 2009 +0100 +++ b/src/ChangeLog Thu May 21 21:12:08 2009 +0100 @@ -1,5 +1,9 @@ 2009-05-21 Michael Goffioul + * file-io.cc (mkstemp): Add mktemp-based implementation of mkstemp on + platforms that do not have it (mkstemp is required by the new help + system). + * TEMPLATE-INST/Array-os.cc: Add "extern template" declaration for Array to avoid implicit instantiation (and duplicate symbols at link-time) [Win32] diff -r b03953732530 -r c02224afead6 src/file-io.cc --- a/src/file-io.cc Thu May 21 21:07:36 2009 +0100 +++ b/src/file-io.cc Thu May 21 21:12:08 2009 +0100 @@ -1912,6 +1912,24 @@ extern "C" int mkstemps (char *pattern, int suffix_len); #endif +#if ! defined (HAVE_MKSTEMP) && ! defined (HAVE_MKSTEMPS) && defined (_MSC_VER) +# if defined (HAVE_FCNTL_H) +# include +# endif +# if defined (HAVE_SYS_STAT_H) +# include +# endif +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\