Changeset 1082 for trunk/dll/copyf.c


Ignore:
Timestamp:
Jul 20, 2008, 12:37:36 AM (17 years ago)
Author:
Gregg Young
Message:

Changes so FM2 will use TMP/TEMP directory for all temp files; Replaced save_dir2 with global variable so BldFullPathName could easily replace code that performed the same function; Added #ifdef FORTIFY to free_ function that are only used when fortified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/copyf.c

    r1039 r1082  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2006 Steven H.Levine
     9  Copyright (c) 2001, 2008 Steven H.Levine
    1010
    1111  14 Sep 02 SHL Drop obsolete debug code
     
    1919  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
    2020  29 Feb 08 GKY Use xfree where appropriate
     21  19 Jul 08 GKY Modify MakeTempName for use making temp directory names
    2122
    2223***********************************************************************/
     
    4950#endif
    5051
    51 char *MakeTempName(char *buffer)
     52char *MakeTempName(char *buffer, char *temproot, INT type)
    5253{
    5354  FILESTATUS3 fs3;
     
    5556  char *p, *o;
    5657
     58  if (strlen(buffer) > 3 && buffer[strlen(buffer) - 1] != '\\')
     59    strcat(buffer, "\\");
    5760  p = o = buffer + strlen(buffer);
    58   sprintf(p, "%08lx.%03lx", clock(), mypid);
     61  switch (type) {
     62  case 0:
     63    sprintf(p, "%08lx.%03lx", rand() & 4095L, mypid);
     64    break;
     65  case 1:
     66    sprintf(p, "%s%04lx.%03lx", "$FM2", rand() & 4095L, mypid);
     67    break;
     68  case 2:
     69    sprintf(p, "%s.%03x", temproot, (rand() & 4095));
     70    break;
     71  default:
     72    break;
     73  }
    5974  p = buffer + (strlen(buffer) - 1);
    6075  for (;;) {
     
    510525          *p = 0;
    511526        strcat(dir, "\\");
    512         MakeTempName(dir);
     527        MakeTempName(dir, NULL, 0);
    513528        if (DosMove(fullnewname, dir))
    514529          *dir = 0;
     
    894909#pragma alloc_text(LONGNAMES,TruncName,GetLongName,WriteLongName)
    895910#pragma alloc_text(LONGNAMES,ZapLongName,AdjustWildcardName)
    896 #pragma alloc_text(COPYF,default_disk,docopyf)
     911#pragma alloc_text(COPYF,default_disk,docopyf,MakeTempName)
    897912#pragma alloc_text(UNLINKF,unlinkf,unlink_allf,make_deleteable,wipeallf)
Note: See TracChangeset for help on using the changeset viewer.