about summary refs log tree commit diff stats
path: root/src/LYDownload.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYDownload.c')
-rw-r--r--src/LYDownload.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/LYDownload.c b/src/LYDownload.c
index f355672d..f4e57a30 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -608,37 +608,24 @@ PUBLIC int LYdownload_options ARGS2(
 	char *, 	data_file)
 {
     static char tempfile[256];
-    static BOOLEAN first = TRUE;
     static char download_filename[256];
     char *sug_filename = NULL;
     FILE *fp0;
     lynx_html_item_type *cur_download;
     int count;
 
-    if (first) {
-	tempname(tempfile, NEW_FILE);
-	first = FALSE;
-#if defined (VMS) || defined (DOSPATH) || defined (__EMX__)
-        sprintf(download_filename, "file://localhost/%s", tempfile);
-#else
-        sprintf(download_filename, "file://localhost%s", tempfile);
-#endif /* VMS */
-#ifdef VMS
-    } else {
-	remove(tempfile);   /* Remove duplicates on VMS. */
-#endif /* VMS */
-    }
-
     /*
      *	Get a suggested filename.
      */
     StrAllocCopy(sug_filename, *newfile);
     change_sug_filename(sug_filename);
 
-    if ((fp0 = LYNewTxtFile(tempfile)) == NULL) {
+    LYRemoveTemp(tempfile);
+    if ((fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w")) == NULL) {
 	HTAlert(CANNOT_OPEN_TEMP);
 	return(-1);
     }
+    LYLocalFileToURL(download_filename, tempfile);
 
     LYstrncpy(LYValidDownloadFile,
 	      data_file,
@@ -690,7 +677,7 @@ No other download methods have been defined yet.  You may define\n\
 an unlimited number of download methods using the lynx.cfg file.\n");
     }
     fprintf(fp0, "</pre>\n</body>\n");
-    fclose(fp0);
+    LYCloseTempFP(fp0);
 
     /*
      *	Free off temp copy.