From: gpk AT physics DOT att DOT com Date: Tue, 2 Feb 93 08:44:03 EST Original-From: physics!gpk (Greg Kochanski) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Gcc 2.3.3 >I was thinking about a solution to use gcc 2.3.3 on a 8.3 dos file >system. >The idea is to intercept the "creat" and "open" calls either in the >library or in go32 so that they generate unique file names for the >TMPDIR. It's a nice solution. You'd just use those open, creat (and unlink, and stat(), and access()) in Gcc itself, and fall back to the normal versions in the library. >There will be need to keep a corespondance table between the >long file names and the generated ones Too much work. Just write a good hash function from an arbitrary string into an 8+3 filename. There are about 10^16 possible 8+3 filenames, so the odds of getting a duplicate are pretty small. Something like (and this is just a sketch): const char fnset[] = "abcdefghijklmnopqrstuvwxyz0123456789-_+"; #define NC (sizeof(fnset)-1) #define BIGPRIME something_big_that_fits_in_an_int void makedosname(const char *s, char name[13]) { const static int mult[11] = {1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; int i; char *p; for(i=0;i<11;i++) { int accum = 0; for(p=s;*p;p++) accum = (accum*mult[i] + ((unsigned)(*p)&0377))%BIGPRIME; name[i>=8 ? i+1 : i] = fnset[accum%NC]; } name[8] = "."; name[12] = '\0'; } So, every input string will be mapped into a filename, and the mapping will be the same every time (depending only on NC, BIGPRIME, and mult[i]). The names will be totally garbled, but it doesn't matter for temp. files. Greg Kochanski gpk AT physics DOT att DOT com AT&T Physics Research -- Physics for Fun and Profit