]> pd.if.org Git - pdclib/blob - functions/stdio/tmpnam.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdio / tmpnam.c
1 /* tmpnam( char * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <stdio.h>
8
9 #ifndef REGTEST
10
11 #include <string.h>
12 #include "_PDCLIB_io.h"
13
14 char * tmpnam( char * s )
15 {
16     static char filename[ L_tmpnam ];
17     FILE * file = tmpfile();
18     if ( s == NULL )
19     {
20         s = filename;
21     }
22     strcpy( s, file->filename );
23     fclose( file );
24     return s;
25 }
26
27 #endif
28
29 #ifdef TEST
30 #include "_PDCLIB_test.h"
31
32 #include <string.h>
33
34 int main( void )
35 {
36     TESTCASE( strlen( tmpnam( NULL ) ) < L_tmpnam );
37     return TEST_RESULTS;
38 }
39
40 #endif
41