mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added mktemp(3).
This is a stupid, ugly function added for compatibility.
This commit is contained in:
parent
5d826ec284
commit
b1b123109a
2 changed files with 14 additions and 0 deletions
|
@ -89,6 +89,9 @@ size_t mbstowcs(wchar_t *restrict, const char* restrict, size_t);
|
||||||
int mbtowc(wchar_t *restrict, const char* restrict, size_t);
|
int mbtowc(wchar_t *restrict, const char* restrict, size_t);
|
||||||
char* mkdtemp(char*);
|
char* mkdtemp(char*);
|
||||||
int mkstemp(char*);
|
int mkstemp(char*);
|
||||||
|
#if !defined(_SORTIX_SOURCE)
|
||||||
|
char* mktemp(char* templ);
|
||||||
|
#endif
|
||||||
long mrand48(void);
|
long mrand48(void);
|
||||||
long nrand48(unsigned short[3]);
|
long nrand48(unsigned short[3]);
|
||||||
int posix_memalign(void**, size_t, size_t);
|
int posix_memalign(void**, size_t, size_t);
|
||||||
|
|
|
@ -292,6 +292,17 @@ namespace Maxsi
|
||||||
{
|
{
|
||||||
return SysFStat(fd, st);
|
return SysFStat(fd, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This is a hacky implementation of a stupid function.
|
||||||
|
char* mktemp(char* templ)
|
||||||
|
{
|
||||||
|
size_t templlen = strlen(templ);
|
||||||
|
for ( size_t i = templlen-6UL; i < templlen; i++ )
|
||||||
|
{
|
||||||
|
templ[i] = '0' + rand() % 10;
|
||||||
|
}
|
||||||
|
return templ;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue