toaruos/libc/stdio/tmpnam.c
2018-06-25 13:15:09 +09:00

17 lines
221 B
C

#include <stdio.h>
#include <unistd.h>
static char _internal[L_tmpnam];
char * tmpnam(char * s) {
static int tmp_id = 1;
if (!s) {
s = _internal;
}
sprintf(s, "/tmp/tmp%d.%d", getpid(), tmp_id++);
return s;
}