summaryrefslogtreecommitdiff
path: root/src/stdio/tmpnam_s.c
blob: 3f5462a06920ca4c313f7cf94370774454c88c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#if 0

#include <stdio.h>

/** generate a temporary file name **/
errno_t tmpnam_s(char *s, rsize_t maxsize)
{
	__C_EXT(1, 201112L);
	static int ntimescalled = 0;
	static char path[L_tmpnam];

	if (ntimescalled >= TMP_MAX) {
		return 0;
	}
	ntimescalled++;

	if (s == NULL) {
		s = path;
	}

	return 0;
}

/***
The fn(tmpnam) function generates a unique file name that can be used as a
temporary file. A new file name is generated every time the function is called
up to macro(TMP_MAX) times.

If arg(s) is macro(NULL), the temporary name is stored in a static internal
buffer. This buffer may be overwritten by additional calls to fn(tmpnam).

If arg(s) is not macro(NULL), it should point to a type(char) array of at least
macro(L_tmpnam) characters. The temporary name will be copied to this array.
***/

/* UNSPECIFIED: - */
/* UNDEFINED: - */
/* IMPLEMENTATION: behavior if fn(tmpnam) is called more than macro(TMP_MAX) times */
/* LOCALE: - */

/* RETURN: a pointer to the temporary file name */

/*
CEXT1(201112)
*/


#endif