summaryrefslogtreecommitdiff
path: root/src/libs/libgroff/mkstemp.cc
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-07-20 14:36:50 +0000
committerwlemb <wlemb>2001-07-20 14:36:50 +0000
commit0c2857af24a536366560a8a13c64fd6ea25f8408 (patch)
tree581239e098ec25f99e3939b5eca17f5054061dbc /src/libs/libgroff/mkstemp.cc
parent8ec25476b88dc3138d74c285cf249a90200ae6ac (diff)
downloadgroff-0c2857af24a536366560a8a13c64fd6ea25f8408.tar.gz
* src/libs/libgroff/tmpname.cc: New file, defining get_tempname().
* src/libs/libgroff/mkstemp.cc: New file. * src/libs/libgroff/mksdir.cc: New file. * src/libs/libgroff/tmpfile.cc [HAVE_MKSTEMP_PROTO]: Removed. (xtmpfile) [!HAVE_MKSTEMP]: Removed. * src/libs/libgroff/Makefile.sub: Updated. * src/include/lib.h: Add mksdir() prototype. * src/include/posix.h: Define S_IXUSR if not yet defined. * src/preproc/html/pre-html.cc (MAX_RETRIES): Removed. (createAllPages): Use mksdir() instead of current code. * src/utils/indxbib/indxbib.cc [HAVE_MKSTEMP_PROTO]: Removed. (main): [!HAVE_MKSTEMP]: Removed. * aclocal.m4 (GROFF_MKSTEMP): Updated to use new mkstemp.cc file. (GROFF_INTTYPES_H, GROFF_UNSIGNED_LONG_LONG, GROFF_UINTMAX_T): New macros. * configure.ac: Add tests for stdint.h, sys/time.h, and gettimeofday(). Call new GROFF_xxx macros. * configure: Regenerated. * Makefile.in: Comments updated.
Diffstat (limited to 'src/libs/libgroff/mkstemp.cc')
-rw-r--r--src/libs/libgroff/mkstemp.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libs/libgroff/mkstemp.cc b/src/libs/libgroff/mkstemp.cc
new file mode 100644
index 00000000..cd2717c3
--- /dev/null
+++ b/src/libs/libgroff/mkstemp.cc
@@ -0,0 +1,34 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Werner Lemberg (wl@gnu.org)
+
+This file is part of groff.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License along
+with groff; see the file COPYING. If not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+
+/* This file is heavily based on the file mkstemp.c which is part of the
+ fileutils package. */
+
+
+extern int gen_tempname(char *, int);
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int mkstemp(char *tmpl)
+{
+ return gen_tempname(tmpl, 0);
+}