]> pd.if.org Git - pdclib/blob - functions/stdio/tmpnam.c
Whitespace cleanups.
[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 "_PDCLIB_glue.h"
12
13 #include <string.h>
14
15 char * tmpnam( char * s )
16 {
17     static char filename[ L_tmpnam ];
18     FILE * file = tmpfile();
19     if ( s == NULL )
20     {
21         s = filename;
22     }
23     strcpy( s, file->filename );
24     fclose( file );
25     return s;
26 }
27
28 #endif
29
30 #ifdef TEST
31
32 #include "_PDCLIB_test.h"
33
34 #include <string.h>
35
36 int main( void )
37 {
38     TESTCASE( strlen( tmpnam( NULL ) ) < L_tmpnam );
39     return TEST_RESULTS;
40 }
41
42 #endif