toaruos/libc/stdio/tmpnam.c

17 lines
221 B
C
Raw Normal View History

2018-06-25 07:15:09 +03:00
#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;
}