projects
/
fw
/
pdclib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Almost done on tmpfile / tmpnam.
[fw/pdclib]
/
platform
/
example
/
functions
/
stdio
/
tmpnam.c
diff --git
a/platform/example/functions/stdio/tmpnam.c
b/platform/example/functions/stdio/tmpnam.c
index c4a0a4d968402848ae28bdde0e48d809caecb028..a9f5385c1e0723e45eba248a1e44091a14a3553c 100644
(file)
--- a/
platform/example/functions/stdio/tmpnam.c
+++ b/
platform/example/functions/stdio/tmpnam.c
@@
-7,14
+7,23
@@
*/
#include <stdio.h>
*/
#include <stdio.h>
-#include <stdarg.h>
#ifndef REGTEST
#ifndef REGTEST
+#include <string.h>
+#include <_PDCLIB_glue.h>
+
char * tmpnam( char * s )
{
char * tmpnam( char * s )
{
- /* TODO: Implement. */
- return NULL;
+ static char filename[ L_tmpnam ];
+ FILE * file = tmpfile();
+ if ( s == NULL )
+ {
+ s = filename;
+ }
+ strcpy( s, file->filename );
+ fclose( file );
+ return s;
}
#endif
}
#endif
@@
-22,10
+31,13
@@
char * tmpnam( char * s )
#ifdef TEST
#include <_PDCLIB_test.h>
#ifdef TEST
#include <_PDCLIB_test.h>
+#include <string.h>
+
int main( void )
{
int main( void )
{
- TESTCASE(
NO_TESTDRIVER
);
+ TESTCASE(
strlen( tmpnam( NULL ) ) < L_tmpnam
);
return TEST_RESULTS;
}
#endif
return TEST_RESULTS;
}
#endif
+