summaryrefslogtreecommitdiff
path: root/lib/tempname.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-02-20 23:31:17 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-02-20 23:32:45 -0800
commit066b17df681fabb40108d719086669957aebbc51 (patch)
tree27f9362ed6a6e68ef6b61925932f84bb1afb37b8 /lib/tempname.h
parent43fb42da8bd6851b5b22d2bbb5d2cd8ceede9c09 (diff)
downloademacs-066b17df681fabb40108d719086669957aebbc51.tar.gz
Merge from gnulib
* doc/misc/texinfo.tex: Update from gnulib. * lib/getdtablesize.c, lib/getopt.c, lib/signal.in.h, lib/tempname.c: * lib/tempname.h, m4/dup2.m4, m4/fcntl.m4, m4/getdtablesize.m4: Update from gnulib, incorporating: 2015-02-20 getdtablesize: port better for Android 2015-02-19 fcntl: Fix cross compiling 2015-02-18 dup2, fcntl: cross-compile better for Android 2015-02-18 getopt: don't crash on memory exhaustion 2015-02-17 tempname: allow compilation with C++ (trivial) 2015-02-17 dup2, fcntl: port to AIX 2015-02-16 getdtablesize, dup2, fcntl: port to Android 2015-02-11 getdtablesize, signal_h: Fix Android build 2015-02-11 maint: various whitespace cleanups in tempname
Diffstat (limited to 'lib/tempname.h')
-rw-r--r--lib/tempname.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tempname.h b/lib/tempname.h
index b560ee5cb14..e6093607463 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -32,6 +32,10 @@
# define GT_NOCREATE 2
# endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
The name constructed does not exist at the time of the call to
@@ -47,4 +51,15 @@
We use a clever algorithm to get hard-to-predict names. */
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+/* Similar to gen_tempname, but TRYFUNC is called for each temporary
+ name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME
+ returns with this value. Otherwise, if errno is set to EEXIST, another
+ name is tried, or else TRY_GEN_TEMPNAME returns -1. */
+extern int try_tempname (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *));
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GL_TEMPNAME_H */