4 #include "popplercompat.h"
7 static char* getTempDir()
10 char*dir = getenv("TMP");
11 if(!dir) dir = getenv("TEMP");
12 if(!dir) dir = getenv("tmp");
13 if(!dir) dir = getenv("temp");
14 if(!dir) dir = "C:\\";
21 char* mktmpname(char*ptr) {
22 static char tmpbuf[128];
23 char*dir = getTempDir();
28 if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
36 // used to be mktemp. This does remove the warnings, but
37 // It's not exactly an improvement.
39 sprintf(ptr, "%s%s%08x%08x",dir,sep,(unsigned int)lrand48(),(unsigned int)lrand48());
42 sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
45 sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned int)tmpbuf^((unsigned int)tmpbuf)>>16,count);