1 /* 2 * pANS stdio -- tmpnam 3 */ 4 #include "iolib.h" 5 #include <string.h> 6 7 char *tmpnam(char *s){ 8 static char name[]="/tmp/tn000000000000"; 9 char *p; 10 do{ 11 p=name+7; 12 while(*p=='9') *p++='0'; 13 if(*p=='\0') return NULL; 14 ++*p; 15 }while(access(name, 0)==0); 16 if(s){ 17 strcpy(s, name); 18 return s; 19 } 20 return name; 21 } 22