Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 * pANS stdio -- tmpnam
3
 */
4
#include "iolib.h"
5
#include <string.h>
6
 
7
char *
8
tmpnam(char *s)
9
{
10
	static char name[] = "/tmp/tn000000000000";
11
	char *p;
12
 
13
	do {
14
		p = name + 7;
15
		while (*p == '9')
16
			*p++ = '0';
17
		if (*p == '\0')
18
			return NULL;
19
		++*p;
20
	} while (access(name, 0) == 0);
21
	if (s) {
22
		strcpy(s, name);
23
		return s;
24
	}
25
	return name;
26
}
27
 
28
 
29
char *
30
tmpnam_r(char *s)
31
{
32
	return s ? tmpnam(s) : NULL;
33
}