#include "config.h"
#endif
+#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#define TMP_MAX 16384
#endif
-/* Generate a unique temporary file name from TEMPLATE.
+/*
- TEMPLATE has the form:
+@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
- <path>/ccXXXXXX<suffix>
+Generate a unique temporary file name from @var{template}.
+@var{template} has the form:
- SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
+@example
+ @var{path}/ccXXXXXX@var{suffix}
+@end example
- The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
- they are replaced with a string that makes the filename unique.
+@var{suffix_len} tells us how long @var{suffix} is (it can be zero
+length). The last six characters of @var{template} before @var{suffix}
+must be @samp{XXXXXX}; they are replaced with a string that makes the
+filename unique. Returns a file descriptor open on the file for
+reading and writing.
+
+@end deftypefn
+
+*/
- Returns a file descriptor open on the file for reading and writing. */
int
mkstemps (template, suffix_len)
char *template;
v /= 62;
XXXXXX[5] = letters[v % 62];
+#ifdef VMS
+ fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
+#else
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
+#endif
if (fd >= 0)
/* The file does not exist. */
return fd;