tmpnam implemented by using tmpfile.
authorsolar <solar@546481bc-9713-0410-bf18-d3337bbf4a3e>
Sun, 16 May 2010 10:38:54 +0000 (10:38 +0000)
committersolar <solar@546481bc-9713-0410-bf18-d3337bbf4a3e>
Sun, 16 May 2010 10:38:54 +0000 (10:38 +0000)
git-svn-id: https://srv7.svn-repos.de/dev34/pdclib/trunk@421 546481bc-9713-0410-bf18-d3337bbf4a3e

functions/stdio/tmpnam.c [new file with mode: 0644]
platform/example/functions/stdio/tmpnam.c [deleted file]
platform/example_cygwin/functions/stdio/tmpnam.c [deleted file]

diff --git a/functions/stdio/tmpnam.c b/functions/stdio/tmpnam.c
new file mode 100644 (file)
index 0000000..a9f5385
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id$ */
+
+/* tmpnam( char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+
+#include <string.h>
+#include <_PDCLIB_glue.h>
+
+char * tmpnam( char * s )
+{
+    static char filename[ L_tmpnam ];
+    FILE * file = tmpfile();
+    if ( s == NULL )
+    {
+        s = filename;
+    }
+    strcpy( s, file->filename );
+    fclose( file );
+    return s;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+#include <string.h>
+
+int main( void )
+{
+    TESTCASE( strlen( tmpnam( NULL ) ) < L_tmpnam );
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/example/functions/stdio/tmpnam.c b/platform/example/functions/stdio/tmpnam.c
deleted file mode 100644 (file)
index a9f5385..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $Id$ */
-
-/* tmpnam( char * )
-
-   This file is part of the Public Domain C Library (PDCLib).
-   Permission is granted to use, modify, and / or redistribute at will.
-*/
-
-#include <stdio.h>
-
-#ifndef REGTEST
-
-#include <string.h>
-#include <_PDCLIB_glue.h>
-
-char * tmpnam( char * s )
-{
-    static char filename[ L_tmpnam ];
-    FILE * file = tmpfile();
-    if ( s == NULL )
-    {
-        s = filename;
-    }
-    strcpy( s, file->filename );
-    fclose( file );
-    return s;
-}
-
-#endif
-
-#ifdef TEST
-#include <_PDCLIB_test.h>
-
-#include <string.h>
-
-int main( void )
-{
-    TESTCASE( strlen( tmpnam( NULL ) ) < L_tmpnam );
-    return TEST_RESULTS;
-}
-
-#endif
-
diff --git a/platform/example_cygwin/functions/stdio/tmpnam.c b/platform/example_cygwin/functions/stdio/tmpnam.c
deleted file mode 100644 (file)
index c4a0a4d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $Id$ */
-
-/* tmpnam( char * )
-
-   This file is part of the Public Domain C Library (PDCLib).
-   Permission is granted to use, modify, and / or redistribute at will.
-*/
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#ifndef REGTEST
-
-char * tmpnam( char * s )
-{
-    /* TODO: Implement. */
-    return NULL;
-}
-
-#endif
-
-#ifdef TEST
-#include <_PDCLIB_test.h>
-
-int main( void )
-{
-    TESTCASE( NO_TESTDRIVER );
-    return TEST_RESULTS;
-}
-
-#endif