about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-10-04 16:57:56 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-10-04 16:57:56 -0400
commit5d4274cacfd5304314b484a46475d3df53bdfb6d (patch)
treed30b16b0c308b6fc2af8fe97f689095e6a8f8293 /src
parent24efd81edda1e797719e0f4eb231604d9b273dad (diff)
downloadlynx-snapshots-5d4274cacfd5304314b484a46475d3df53bdfb6d.tar.gz
snapshot of project "lynx", label v2-8-1pre_7
Diffstat (limited to 'src')
-rw-r--r--src/HTAlert.c4
-rw-r--r--src/LYCurses.h7
-rw-r--r--src/LYDownload.c11
-rw-r--r--src/LYHistory.c14
-rw-r--r--src/LYMain.c4
-rw-r--r--src/LYMainLoop.c13
-rw-r--r--src/LYUtils.c33
7 files changed, 59 insertions, 27 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 017354a4..42aa340f 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -122,7 +122,7 @@ PUBLIC void HTReadProgress ARGS2(
 	    if (LYshow_kb_rate
 	     && (total >= kb_units || bytes >= kb_units)) {
 		units = "KB";
-		divisor = 1024;
+		divisor = kb_units;
 		bytes /= divisor;
 		if (total > 0) total /= divisor;
 	    }
@@ -132,7 +132,7 @@ PUBLIC void HTReadProgress ARGS2(
 	    else
 		sprintf (line, "Read %ld %s of data", bytes, units);
 	    if ((transfer_rate > 0)
-		     && (!LYshow_kb_rate || (bytes * divisor > kb_units)))
+		     && (!LYshow_kb_rate || (bytes * divisor >= kb_units)))
 		sprintf (line + strlen(line), ", %ld %s/sec.", transfer_rate / divisor, units);
 	    else
 		sprintf (line + strlen(line), ".");
diff --git a/src/LYCurses.h b/src/LYCurses.h
index ace10813..48bea1e5 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -392,9 +392,12 @@ extern void lynx_stop_radio_color NOPARAMS;
 extern void lynx_stop_all_colors NOPARAMS;
 
 /*
- * To prevent corrupting binary data with _WINDOWS and DJGPP we open files and
- * stdout in BINARY mode by default.  Where necessary we should open and
+ * To prevent corrupting binary data on DOS, MS-WINDOWS or OS/2 we open files
+ * and stdout in BINARY mode by default.  Where necessary we should open and
  * (close!) TEXT mode.
+ *
+ * Note:  EMX has no corresponding variable like _fmode on DOS, but it does
+ * have setmode.
  */
 #if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__)
 #define SetOutputMode(mode) setmode(fileno(stdout), mode)
diff --git a/src/LYDownload.c b/src/LYDownload.c
index e55d0dbc..acf6d882 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -614,15 +614,20 @@ PUBLIC int LYdownload_options ARGS2(
     BeginInternalPage(fp0, DOWNLOAD_OPTIONS_TITLE, DOWNLOAD_OPTIONS_HELP);
 
     fprintf(fp0, "<pre>\n");
+
+    fprintf(fp0, "\
+  <em>Downloaded link:</em> %s\n",
+	downloaded_url);
+
+    if (!no_disk_save && !child_lynx)
     fprintf(fp0, "\
-  <em>Downloaded link:</em> %s\n\
   <em>Suggested file name:</em> %s%s\n",
-       downloaded_url, (lynx_save_space ? lynx_save_space : ""), sug_filename);
+	(lynx_save_space ? lynx_save_space : ""), sug_filename);
 
     fprintf(fp0, "\n%s options:\n",
 	(user_mode == NOVICE_MODE) ? "Standard download" : "Download");
 
-    if(!no_disk_save && !child_lynx) {
+    if (!no_disk_save && !child_lynx) {
 #ifdef DIRED_SUPPORT
 	/*
 	 *  Disable save to disk option for local files.
diff --git a/src/LYHistory.c b/src/LYHistory.c
index fe077e48..20126cc9 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -121,8 +121,8 @@ PUBLIC BOOLEAN LYwouldPush ARGS1(
 	char *,	title)
 {
     return (!strcmp(title, HISTORY_PAGE_TITLE)
-         || !strcmp(title, PRINT_OPTIONS_TITLE)
-         || !strcmp(title, DOWNLOAD_OPTIONS_TITLE)
+	 || !strcmp(title, PRINT_OPTIONS_TITLE)
+	 || !strcmp(title, DOWNLOAD_OPTIONS_TITLE)
 #ifdef DIRED_SUPPORT
 	 || !strcmp(title, DIRED_MENU_TITLE)
 	 || !strcmp(title, UPLOAD_OPTIONS_TITLE)
@@ -322,6 +322,11 @@ PUBLIC void LYpop ARGS1(
 	doc->isHEAD = history[nhist].isHEAD;
 	doc->safe = history[nhist].safe;
 	doc->internal_link = history[nhist].internal_link;
+#ifdef DISP_PARTIAL
+	/* assume we pop the 'doc' to show it soon... */
+	Newline_partial = doc->line;	/* reinitialize */
+	NumOfLines_partial = -1;	/* initialize to -1 */
+#endif /* DISP_PARTIAL */
 	CTRACE(tfp, "LYpop[%d]: address:%s\n     title:%s\n",
 		    nhist, doc->address, doc->title);
     }
@@ -347,6 +352,11 @@ PUBLIC void LYpop_num ARGS2(
 	doc->isHEAD = history[number].isHEAD;
 	doc->safe = history[number].safe;
 	doc->internal_link = history[number].internal_link; /* ?? */
+#ifdef DISP_PARTIAL
+	/* assume we pop the 'doc' to show it soon... */
+	Newline_partial = doc->line;	/* reinitialize */
+	NumOfLines_partial = -1;	/* initialize to -1 */
+#endif /* DISP_PARTIAL */
     }
 }
 
diff --git a/src/LYMain.c b/src/LYMain.c
index 49d6d3e5..e749f638 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -564,13 +564,13 @@ PUBLIC int main ARGS2(
 #endif
 
     /*
-     * To prevent corrupting binary data with _WINDOWS and DJGPP
+     * To prevent corrupting binary data on DOS, MS-WINDOWS or OS/2
      * we open files and stdout in BINARY mode by default.
      * Where necessary we should open and (close!) TEXT mode.
      * (use LYNewTxtFile/LYAppendToTxtFile to open text files for writing)
      */
     SetDefaultMode(O_BINARY);
-    SetOutputMode( O_BINARY );
+    SetOutputMode(O_BINARY);
 
 #ifdef DOSPATH
     if (getenv("TERM")==NULL) putenv("TERM=vt100");
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 51c0fd88..5d062f73 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -505,14 +505,16 @@ try_again:
 				/* and set the flag to 0  */
 		if (display_partial) {
 		    /*
-		     * Disable display_partial if requested URL has #fragment.
+		     * Disable display_partial if requested URL has #fragment
+		     * and we are not popped from the history stack
+		     * so can't calculate correct newline position for fragment.
 		     * Otherwise user got the new document from the first page
 		     * and be moved to #fragment later after download
-		     * completed, but only if user did not mess screen up by
+		     * completed, but only if s/he did not mess screen up by
 		     * scrolling before...  So fall down to old behavior here.
 		     */
 		    if (!LYCursesON ||
-				(strchr(newdoc.address, '#')))
+			       (Newline_partial == 1 && strchr(newdoc.address, '#')))
 			display_partial = FALSE;
 		}
 #endif /* DISP_PARTIAL */
@@ -985,7 +987,8 @@ try_again:
 			 *  Override newdoc.line with a new value if user
 			 *  scrolled the document while downloading.
 			 */
-			if (Newline_partial != newdoc.line)
+			if (Newline_partial != newdoc.line
+			 && NumOfLines_partial > 0)
 			    Newline = Newline_partial;
 
 			/*
@@ -4928,7 +4931,6 @@ check_add_bookmark_to_self:
 		    newdoc.isHEAD = history[number].isHEAD;
 		    newdoc.safe = history[number].safe;
 		    newdoc.internal_link = FALSE;
-		    newdoc.line = curdoc.line;  /* need for display_partial ! */
 		    newdoc.link = 0;
 		    HTOutputFormat = HTAtom_for("www/download");
 		    LYUserSpecifiedURL = TRUE;
@@ -5007,7 +5009,6 @@ check_add_bookmark_to_self:
 			newdoc.safe = FALSE;
 		    }
 		    newdoc.internal_link = FALSE;
-		    newdoc.line = curdoc.line;  /* need for display_partial ! */
 		    newdoc.link = 0;
 		    HTOutputFormat = HTAtom_for("www/download");
 		    /*
diff --git a/src/LYUtils.c b/src/LYUtils.c
index ac66b7f7..7808d659 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -2822,18 +2822,23 @@ PUBLIC BOOLEAN inlocaldomain NOARGS
 #include <sys/ioctl.h>
 #endif
 
-/* For systems that have both, but both can't be included, duh */
-#ifdef TERMIO_AND_TERMIOS
+/* For systems that have both, but both can't be included, duh (or neither) */
+/* FIXME: this whole chunk may be redundant */
+#ifdef TERMIO_AND_CURSES
 # include <termio.h>
-#else
-# ifdef HAVE_TERMIOS_H
-#  include <termios.h>
 # else
-#  ifdef HAVE_TERMIO_H
-#   include <termio.h>
-#  endif /* HAVE_TERMIO_H */
-# endif /* HAVE_TERMIOS_H */
-#endif	/* TERMIO_AND_TERMIOS */
+# ifdef TERMIO_AND_TERMIOS
+#  include <termio.h>
+# else
+#  ifdef HAVE_TERMIOS_H
+#   include <termios.h>
+#  else
+#   ifdef HAVE_TERMIO_H
+#    include <termio.h>
+#   endif /* HAVE_TERMIO_H */
+#  endif /* HAVE_TERMIOS_H */
+# endif	/* TERMIO_AND_TERMIOS */
+#endif /* USE_TERMIO_H */
 
 PUBLIC void size_change ARGS1(
 	int,		sig GCC_UNUSED)
@@ -3010,6 +3015,14 @@ PUBLIC void change_sug_filename ARGS1(
     }
     FREE(temp);
 
+    if (fname[strlen(fname) - 1] == '/')
+    /*
+     *  Hmm... we have a directory name.
+     *  It is annoying to see a scheme+host+path name as a suggested one,
+     *  let's remove the last_slash and go ahead like we have a file name. - LP
+     */
+    fname[strlen(fname) - 1] = '\0';
+
     /*
      *	Remove everything up the the last_slash if there is one.
      */