home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / amiga / jpeg / jpegv4.lha / jpegv4 / src / jmemname.c.diff next >
Encoding:
Text File  |  1993-06-10  |  1.8 KB  |  57 lines

  1. *** jmemname.c    Fri Jul 24 23:06:50 1992
  2. --- jmemsys.c    Thu Jun 10 01:06:08 1993
  3. ***************
  4. *** 82,87 ****
  5. --- 82,98 ----
  6.   
  7.   static int next_file_num;       /* to distinguish among several temp files */
  8.   
  9. + LOCAL char *
  10. + get_temp_dir (void)
  11. + {
  12. +     char * env;
  13. +     env = getenv("JPEGTMP");
  14. +     if (env)
  15. +         return env;
  16. +     return TEMP_DIRECTORY;
  17. + }
  18.   #ifdef NO_MKTEMP
  19.   
  20.   #ifndef TEMP_FILE_NAME          /* so can override from Makefile */
  21. ***************
  22. *** 96,102 ****
  23.     /* Keep generating file names till we find one that's not in use */
  24.     for (;;) {
  25.       next_file_num++;        /* advance counter */
  26. !     sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
  27.       if ((tfile = fopen(fname, READ_BINARY)) == NULL)
  28.         break;
  29.       fclose(tfile);        /* oops, it's there; close tfile & try again */
  30. --- 107,113 ----
  31.     /* Keep generating file names till we find one that's not in use */
  32.     for (;;) {
  33.       next_file_num++;            /* advance counter */
  34. !     sprintf(fname, TEMP_FILE_NAME, get_temp_dir(), next_file_num);
  35.       if ((tfile = fopen(fname, READ_BINARY)) == NULL)
  36.         break;
  37.       fclose(tfile);              /* oops, it's there; close tfile & try again */
  38. ***************
  39. *** 114,120 ****
  40.   select_file_name (char * fname)
  41.   {
  42.     next_file_num++;        /* advance counter */
  43. !   sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
  44.     mktemp(fname);        /* make sure file name is unique */
  45.     /* mktemp replaces the trailing XXXXXX with a unique string of characters */
  46.   }
  47. --- 125,131 ----
  48.   select_file_name (char * fname)
  49.   {
  50.     next_file_num++;              /* advance counter */
  51. !   sprintf(fname, TEMP_FILE_NAME, get_temp_dir(), next_file_num);
  52.     mktemp(fname);                /* make sure file name is unique */
  53.     /* mktemp replaces the trailing XXXXXX with a unique string of characters */
  54.   }
  55.