tmpnam.c 469 B

1234567891011121314151617181920212223
  1. #include <stdio.h>
  2. #include <vat.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. //tmpnam implementation by Greg Dietsche
  6. //email: gforce@calc.org
  7. //webpage: http://gforce.calc.org/
  8. __ATTR_LIB_C__ char *tmpnam(char *s)
  9. {
  10. static char buff[10]={0}; //"\0 ";
  11. register char *bptr=buff;
  12. register short i;
  13. do {
  14. for(i=1;i<9;i++)
  15. bptr[i]=((rand()%25)+97);
  16. } while(SymFind(bptr+9).offset);
  17. if(s) return strcpy(s,bptr+1);
  18. else return bptr+1;
  19. }