tmpfile/mkstemp: Add all the other bits
authorAlan Cox <alan@linux.intel.com>
Tue, 17 Mar 2015 22:21:32 +0000 (22:21 +0000)
committerAlan Cox <alan@linux.intel.com>
Tue, 17 Mar 2015 22:21:32 +0000 (22:21 +0000)
Library/include/stdio.h
Library/include/stdlib.h
Library/libs/Makefile
Library/libs/Makefile.6502
Library/libs/tmpfile.c [new file with mode: 0644]

index 975f219..8229539 100644 (file)
@@ -109,6 +109,8 @@ extern FILE *__fopen __P((const char*, int, FILE*, const char*));
 #define freopen(__file, __mode, __fp) __fopen((__file), -1, (__fp), (__mode))
 #define fdopen(__file, __mode) __fopen((char*)0, (__file), (FILE*)0, (__mode))
 
+extern FILE *tmpfile __P((void));
+
 extern int fputs __P((const void *, FILE*));
 extern int puts __P((const void *));
 
index afec743..2dac44c 100644 (file)
@@ -51,6 +51,10 @@ extern char *__ltostr __P((long value, int radix));
 extern long strtol __P ((const char * nptr, char ** endptr, int base));
 extern unsigned long strtoul __P ((const char * nptr,
                                   char ** endptr, int base));
+
+extern int mkstemp(char *template);
+extern int mkstemps(char *template, int suffix);
+
 #ifndef __HAS_NO_DOUBLES__
 extern double strtod __P ((const char * nptr, char ** endptr));
 #endif
index dfa8855..92b8b91 100644 (file)
@@ -37,7 +37,7 @@ SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c
 SRC_C += stat.c stdio0.c stime.c
 SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
 SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c
-SRC_C += strtod.c strtol.c system.c time.c tmpnam.c ttyname.c
+SRC_C += strtod.c strtol.c system.c time.c tmpfile.c tmpnam.c ttyname.c
 SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c
 SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
 SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
index 6484e1a..7685702 100644 (file)
@@ -51,7 +51,7 @@ SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c
 SRC_C += stat.c stdio0.c stime.c
 SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
 SRC_C += strnicmp.c strnlen.c strsep.c
-SRC_C += system.c time.c tmpnam.c ttyname.c
+SRC_C += system.c time.c tmpfile.c tmpnam.c ttyname.c
 SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c
 SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
 SRC_C += gethostname.c sysconf.c confstr.c memccpy.c getpass.c
diff --git a/Library/libs/tmpfile.c b/Library/libs/tmpfile.c
new file mode 100644 (file)
index 0000000..ca2da44
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+FILE *tmpfile(void)
+{
+  int fd = mkstemp("/tmp/tmpfileXXXXXX");
+  if (fd == -1)
+    return;
+  return fdopen(fd, "r+");
+}
+