home *** CD-ROM | disk | FTP | other *** search
- *** jmemname.c Fri Jul 24 23:06:50 1992
- --- jmemsys.c Thu Jun 10 01:06:08 1993
- ***************
- *** 82,87 ****
- --- 82,98 ----
-
- static int next_file_num; /* to distinguish among several temp files */
-
- + LOCAL char *
- + get_temp_dir (void)
- + {
- + char * env;
- +
- + env = getenv("JPEGTMP");
- + if (env)
- + return env;
- + return TEMP_DIRECTORY;
- + }
- +
- #ifdef NO_MKTEMP
-
- #ifndef TEMP_FILE_NAME /* so can override from Makefile */
- ***************
- *** 96,102 ****
- /* Keep generating file names till we find one that's not in use */
- for (;;) {
- next_file_num++; /* advance counter */
- ! sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
- if ((tfile = fopen(fname, READ_BINARY)) == NULL)
- break;
- fclose(tfile); /* oops, it's there; close tfile & try again */
- --- 107,113 ----
- /* Keep generating file names till we find one that's not in use */
- for (;;) {
- next_file_num++; /* advance counter */
- ! sprintf(fname, TEMP_FILE_NAME, get_temp_dir(), next_file_num);
- if ((tfile = fopen(fname, READ_BINARY)) == NULL)
- break;
- fclose(tfile); /* oops, it's there; close tfile & try again */
- ***************
- *** 114,120 ****
- select_file_name (char * fname)
- {
- next_file_num++; /* advance counter */
- ! sprintf(fname, TEMP_FILE_NAME, TEMP_DIRECTORY, next_file_num);
- mktemp(fname); /* make sure file name is unique */
- /* mktemp replaces the trailing XXXXXX with a unique string of characters */
- }
- --- 125,131 ----
- select_file_name (char * fname)
- {
- next_file_num++; /* advance counter */
- ! sprintf(fname, TEMP_FILE_NAME, get_temp_dir(), next_file_num);
- mktemp(fname); /* make sure file name is unique */
- /* mktemp replaces the trailing XXXXXX with a unique string of characters */
- }
-