6dbdd9127b
Submitted by: tkato@prontomail.com
49 lines
919 B
Text
49 lines
919 B
Text
--- readRC.c.orig Sun Sep 3 07:07:09 2000
|
|
+++ readRC.c Fri Mar 9 03:31:53 2001
|
|
@@ -30,11 +30,13 @@
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
+#ifndef HAVE_MKSTEMP
|
|
#ifdef __STDC__
|
|
extern char *mktemp(char *);
|
|
#else
|
|
extern char *mktemp();
|
|
#endif /* __STDC__ */
|
|
+#endif
|
|
|
|
#define RC_FILENAME ".XPaintrc"
|
|
|
|
@@ -64,19 +66,32 @@
|
|
static FILE *
|
|
openTemp(char **np)
|
|
{
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ int fd;
|
|
+#endif
|
|
char *n;
|
|
char xx[256];
|
|
|
|
if ((n = getenv("TMPDIR")) == NULL)
|
|
n = "/tmp";
|
|
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ snprintf(xx, 256, "%s/%s", n, "/XPaintXXXXXXX");
|
|
+ fd = mkstemp(xx);
|
|
+ n = xx;
|
|
+#else
|
|
strcpy(xx, n);
|
|
strcat(xx, "/XPaintXXXXXXX");
|
|
n = mktemp(xx);
|
|
+#endif
|
|
tempName[++tempIndex] = XtNewString(n);
|
|
if (np != NULL)
|
|
*np = tempName[tempIndex];
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ return fdopen(fd, "w");
|
|
+#else
|
|
return fopen(tempName[tempIndex], "w");
|
|
+#endif
|
|
}
|
|
|
|
static void
|