2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 POSIX function mkstemp().
11 #include <proto/dos.h>
13 /*****************************************************************************
26 A template that must end with 'XXXXXX'
40 ******************************************************************************/
42 char *c
= template + strlen(template);
46 static char filename_letters
[] = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZFILLTO64";
48 while (c
> template && *--c
== 'X') {
61 *c
= filename_letters
[rand() & 0x3F];
64 if (!(lock
= Lock(template, ACCESS_READ
))) {
65 int fd
= open(template, O_CREAT
|O_EXCL
);
72 * Try around 1000 filenames and then give up.