diff --git a/libmaxsi/include/stdlib.h b/libmaxsi/include/stdlib.h index a65b7246..1e3bfb36 100644 --- a/libmaxsi/include/stdlib.h +++ b/libmaxsi/include/stdlib.h @@ -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); char* mkdtemp(char*); int mkstemp(char*); +#if !defined(_SORTIX_SOURCE) +char* mktemp(char* templ); +#endif long mrand48(void); long nrand48(unsigned short[3]); int posix_memalign(void**, size_t, size_t); diff --git a/libmaxsi/io.cpp b/libmaxsi/io.cpp index 8ac74e90..e3e03223 100644 --- a/libmaxsi/io.cpp +++ b/libmaxsi/io.cpp @@ -292,6 +292,17 @@ namespace Maxsi { 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 }