about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-06-04 14:28:00 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-06-04 14:28:00 -0400
commitb5ffa7c020e319cbfceee3c506f5c16764800dc2 (patch)
tree01d4efe0277a37c6bb05dc6599638822aa8a238d /src
parent6e75abc094af51d02563fd5250d1b55e9bb96912 (diff)
downloadlynx-snapshots-b5ffa7c020e319cbfceee3c506f5c16764800dc2.tar.gz
snapshot of project "lynx", label v2-8-1dev_14
Diffstat (limited to 'src')
-rw-r--r--src/HTAlert.c3
-rw-r--r--src/HTAlert.h9
-rw-r--r--src/HTML.c10
-rw-r--r--src/LYCgi.c2
-rw-r--r--src/LYCharUtils.c1
-rw-r--r--src/LYCurses.h4
-rw-r--r--src/LYGlobalDefs.h9
-rw-r--r--src/LYKeymap.c333
-rw-r--r--src/LYKeymap.h29
-rw-r--r--src/LYMain.c5
-rw-r--r--src/LYMainLoop.c61
-rw-r--r--src/LYStrings.c170
-rw-r--r--src/LYStrings.h4
-rw-r--r--src/LYUpload.c6
-rw-r--r--src/LYUtils.c51
-rw-r--r--src/LYUtils.h2
-rw-r--r--src/makefile.dos6
17 files changed, 426 insertions, 279 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c
index a10d79d9..084b550b 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -464,7 +464,7 @@ PUBLIC int HTConfirmPostRedirect ARGS2(
 	return 303;
     }
 
-    if (dump_output_immediately)
+    if (dump_output_immediately) {
         if (server_status == 301) {
 	    /*
 	    **  Treat 301 as historical, i.e., like 303 (GET
@@ -479,6 +479,7 @@ PUBLIC int HTConfirmPostRedirect ARGS2(
 	    */
 	    return 0;
 	}
+    }
 
     StatusInfo[254] = StatusInfo[255] = '\0';
     url[254] = url[(LYcols < 250 ? LYcols-1 : 255)] = '\0';
diff --git a/src/HTAlert.h b/src/HTAlert.h
index b35267b6..be80ee33 100644
--- a/src/HTAlert.h
+++ b/src/HTAlert.h
@@ -1,5 +1,3 @@
-/*  */
-
 /*      Displaying messages and getting input for WWW Library
 **      =====================================================
 **
@@ -7,6 +5,9 @@
 **         Feb 93 Portablized etc TBL
 */
 
+#ifndef HTALERT_H
+#define HTALERT_H 1
+
 #ifndef HTUTILS_H
 #include <HTUtils.h>
 #endif /* HTUTILS_H */
@@ -128,6 +129,4 @@ extern int HTConfirmPostRedirect PARAMS((
 	CONST char *	Redirecting_url,
 	int		server_status));
 
-/*
-
-    */
+#endif /* HTALERT_H */
diff --git a/src/HTML.c b/src/HTML.c
index 07444474..4e99ed2e 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -5204,7 +5204,7 @@ PRIVATE void HTML_start_element ARGS6(
 	}
 
 	CTRACE(tfp,"HTML:begin_element[%d]: adding style to stack - %s\n",
-	    						STACKLEVEL(me),
+	    						(int) STACKLEVEL(me),
 							me->new_style->name);
 	(me->sp)--;
 	me->sp[0].style = me->new_style;	/* Stack new style */
@@ -5370,7 +5370,7 @@ PRIVATE void HTML_end_element ARGS3(
 	} else if (me->sp < (me->stack + MAX_NESTING - 1)) {
 	    (me->sp)++;
 	    CTRACE(tfp, "HTML:end_element[%d]: Popped style off stack - %s\n",
-	    		STACKLEVEL(me),
+	    		(int) STACKLEVEL(me),
 			me->sp->style->name);
 	} else {
 	    CTRACE(tfp,
@@ -5403,7 +5403,7 @@ PRIVATE void HTML_end_element ARGS3(
     switch(element_number) {
 
     case HTML_HTML:
-	if (me->inA || me->inSELECT || me->inTEXTAREA)
+	if (me->inA || me->inSELECT || me->inTEXTAREA) {
 	    if (TRACE) {
 		fprintf(tfp,
 			"Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n",
@@ -5417,6 +5417,7 @@ PRIVATE void HTML_end_element ARGS3(
 		me->inBadHTML = TRUE;
 		sleep(MessageSecs);
 	    }
+	}
 	break;
 
     case HTML_HEAD:
@@ -5505,7 +5506,7 @@ PRIVATE void HTML_end_element ARGS3(
 	break;
 
     case HTML_BODY:
-	if (me->inA || me->inSELECT || me->inTEXTAREA)
+	if (me->inA || me->inSELECT || me->inTEXTAREA) {
 	    if (TRACE) {
 		fprintf(tfp,
 			"Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n",
@@ -5519,6 +5520,7 @@ PRIVATE void HTML_end_element ARGS3(
 		me->inBadHTML = TRUE;
 		sleep(MessageSecs);
 	    }
+	}
 	break;
 
     case HTML_FRAMESET:
diff --git a/src/LYCgi.c b/src/LYCgi.c
index efd29007..41d1ac33 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -48,8 +48,6 @@
 
 #include <LYLeaks.h>
 
-#define FREE(x) if (x) {free(x); x = NULL;}
-
 struct _HTStream 
 {
   HTStreamClass * isa;
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 35afffc1..f380ce0a 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -3730,7 +3730,6 @@ PUBLIC BOOLEAN LYoverride_default_alignment ARGS1(
 	case HTML_ADDRESS:
 	    me->sp->style->alignment = HT_LEFT;
 	    return YES;
-	    break;
 
 	default:
 	    break;
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 9f51e031..8e6443de 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -188,9 +188,9 @@ extern unsigned int Lynx_Color_Flags;
 #define USE_SLANG_MOUSE		1
 #endif /* USE_SLANG */
 
-#if SLANG_VERSION >= 10000
+#if ((SLANG_VERSION >= 10000) && !defined(__DJGPP__))
 #define USE_SLANG_KEYMAPS	1
-#endif
+#endif /* SLANG_VERSION >= 10000 */
 
 #define SL_LYNX_USE_COLOR	1
 #define SL_LYNX_USE_BLINK	2
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 2507f81e..722f6d6b 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -112,7 +112,7 @@ extern int LYChosenShowColor;	/* extended color/monochrome choice */
 extern int LYrcShowColor;	/* ... as read or last written	    */
 
 extern BOOLEAN LYShowCursor;	/* Show the cursor or hide it?	    */
-extern BOOLEAN verbose_img;	/* display filenames of images?     */	 
+extern BOOLEAN verbose_img;	/* display filenames of images?     */
 extern BOOLEAN LYUseDefShoCur;	/* Command line -show_cursor toggle */
 extern BOOLEAN LYCursesON;  /* start_curses()->TRUE, stop_curses()->FALSE */
 extern BOOLEAN LYUserSpecifiedURL;  /* URL from a goto or document? */
@@ -121,7 +121,6 @@ extern BOOLEAN jump_buffer;     /* TRUE if offering default shortcut */
 extern BOOLEAN goto_buffer;     /* TRUE if offering default goto URL */
 extern char *LYRequestTitle;    /* newdoc.title in calls to getfile() */
 extern char *jumpprompt;        /* The default jump statusline prompt */
-extern int Newline;		/* HText_pageDisplay() requires it */
 extern int more;  /* is there more document to display? */
 extern int display_lines; /* number of lines in the display */
 extern int www_search_result;
@@ -177,7 +176,7 @@ extern BOOLEAN case_sensitive;    /* TRUE to turn on case sensitive search */
 extern BOOLEAN no_inside_telnet;  /* this and following are restrictions */
 extern BOOLEAN no_outside_telnet;
 extern BOOLEAN no_telnet_port;
-extern BOOLEAN no_inside_news;  
+extern BOOLEAN no_inside_news;
 extern BOOLEAN no_outside_news;
 extern BOOLEAN no_inside_ftp;
 extern BOOLEAN no_outside_ftp;
@@ -253,6 +252,8 @@ extern BOOLEAN keep_mime_headers; /* Include mime headers and *
 				   * force source dump	      */
 extern BOOLEAN no_url_redirection;   /* Don't follow URL redirections */
 extern BOOLEAN display_partial;      /* Display document during download */
+extern int Newline_partial;          /* -//- "current" newline position */
+extern int NumOfLines_partial;       /* -//- "current" number of lines */
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
 extern char *http_error_file;        /* Place HTTP status code in this file */
@@ -307,7 +308,7 @@ extern BOOLEAN no_externals; /* don't allow the use of externals */
 extern BOOLEAN LYNoISMAPifUSEMAP;	/* Omit ISMAP link if MAP present? */
 extern int LYHiddenLinks;
 
-extern BOOL New_DTD; 
+extern BOOL New_DTD;
 
 #define BOOKMARK_TITLE "Bookmark file"
 #define MOSAIC_BOOKMARK_TITLE "Converted Mosaic Hotlist"
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 1ae0e763..3213f6c4 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -9,9 +9,11 @@
 
 #include <LYLeaks.h>
 
+#define TABLESIZE(v) (sizeof(v)/sizeof(v[0]))
+
 PRIVATE CONST DocAddress keymap_anchor = {"LYNXKEYMAP", NULL, NULL};
 
-struct _HTStream 
+struct _HTStream
 {
   HTStreamClass * isa;
 };
@@ -19,7 +21,7 @@ struct _HTStream
 /* the character gets 1 added to it before lookup,
  * so that EOF maps to 0
  */
-char keymap[] = {
+unsigned short keymap[] = {
 
 0,
 /* EOF */
@@ -39,10 +41,6 @@ LYK_REFRESH,      LYK_ACTIVATE,     LYK_DOWN_TWO,      0,
 LYK_UP_TWO,             0,          LYK_RELOAD,        0,
 /* ^P */            /* XON */       /* ^R */       /* XOFF */
 
-#ifdef NOT_USED
-LYK_TRACE_TOGGLE,       0,          LYK_VERSION,   LYK_REFRESH,
-/* ^T */            /* ^U */        /* ^V */       /* ^W */
-#endif /* NOT_USED */
 LYK_TRACE_TOGGLE,       0,        LYK_SWITCH_DTD,  LYK_REFRESH,
 /* ^T */            /* ^U */        /* ^V */       /* ^W */
 
@@ -84,15 +82,15 @@ LYK_UP_LINK,         LYK_INFO,     LYK_DOWN_LINK,   LYK_HELP,
 LYK_RAW_TOGGLE,  LYK_ADD_BOOKMARK, LYK_PREV_PAGE,   LYK_COMMENT,
 /* @ */              /* A */         /* B */        /* C */
 
-LYK_DOWNLOAD,        LYK_ELGOTO,             
-/* D */              /* E */         
+LYK_DOWNLOAD,        LYK_ELGOTO,
+/* D */              /* E */
 
 #if defined(DIRED_SUPPORT) || defined(VMS)
 LYK_DIRED_MENU,
 #else
-0,          
+0,
 #endif /* DIRED_SUPPORT || VMS */
-/* F */        
+/* F */
 
 LYK_ECGOTO,
 /* G */
@@ -106,20 +104,9 @@ LYK_LIST,          LYK_MAIN_MENU,    LYK_NEXT,      LYK_OPTIONS,
 LYK_PRINT,          LYK_ABORT,    LYK_DEL_BOOKMARK, LYK_INDEX_SEARCH,
 /* P */              /* Q */         /* R */        /* S */
 
-#ifdef DIRED_SUPPORT
-LYK_TAG_LINK,     
-#else
-0,
-#endif /* DIRED_SUPPORT */
-/* T */
-
- 	          LYK_PREV_DOC,    LYK_VLINKS,         0,
-                     /* U */         /* V */        /* W */
+LYK_TAG_LINK,      LYK_PREV_DOC,    LYK_VLINKS,         0,
+/* T */              /* U */         /* V */        /* W */
 
-#ifdef NOT_USED
-LYK_FORM_UP,            0,        LYK_FORM_DOWN,    LYK_INLINE_TOGGLE,
-/* X */              /* Y */         /* Z */        /* [ */
-#endif /* NOT_USED */
 LYK_NOCACHE,            0,        LYK_INTERRUPT,    LYK_INLINE_TOGGLE,
 /* X */              /* Y */         /* Z */        /* [ */
 
@@ -129,15 +116,15 @@ LYK_SOURCE,          LYK_HEAD,          0,          LYK_CLEAR_AUTH,
 LYK_MINIMAL,   LYK_ADD_BOOKMARK,  LYK_PREV_PAGE,    LYK_COMMENT,
 /* ` */              /* a */         /* b */        /* c */
 
-LYK_DOWNLOAD,        LYK_EDIT,             
-/* d */              /* e */         
+LYK_DOWNLOAD,        LYK_EDIT,
+/* d */              /* e */
 
 #if defined(DIRED_SUPPORT) || defined(VMS)
 LYK_DIRED_MENU,
 #else
-0,          
+0,
 #endif /* DIRED_SUPPORT || VMS */
-/* f */        
+/* f */
 
 LYK_GOTO,
 /* g */
@@ -151,20 +138,9 @@ LYK_LIST,         LYK_MAIN_MENU,     LYK_NEXT,      LYK_OPTIONS,
 LYK_PRINT,           LYK_QUIT,    LYK_DEL_BOOKMARK, LYK_INDEX_SEARCH,
 /* p */              /* q */         /* r */        /* s */
 
-#ifdef DIRED_SUPPORT
-LYK_TAG_LINK,     
-#else
-0,
-#endif /* DIRED_SUPPORT */
-/* t */
-
-                    LYK_PREV_DOC,   LYK_VIEW_BOOKMARK,   0,
-                     /* u */         /* v */         /* w */
+LYK_TAG_LINK,     LYK_PREV_DOC,   LYK_VIEW_BOOKMARK,   0,
+/* t */              /* u */         /* v */        /* w */
 
-#ifdef NOT_USED
-LYK_FORM_UP,            0,          LYK_FORM_DOWN,     0,
-/* x */              /* y */          /* z */       /* { */
-#endif /* NOT_USED */
 LYK_NOCACHE,            0,          LYK_INTERRUPT,     0,
 /* x */              /* y */          /* z */       /* { */
 
@@ -208,12 +184,37 @@ LYK_PIPE,               0,              0,          LYK_HISTORY,
    0,                  0,              0,             0,
 
 /* 100..10E function key definitions in LYStrings.h */
+#if defined(__DJGPP__) && defined(USE_SLANG) && !defined(DJGPP_KEYHANDLER)
+   0,             LYK_PREV_LINK,    LYK_NEXT_LINK,  LYK_PREV_DOC,
+                  /* UPARROW */     /* DNARROW */   /* LTARROW */
+
+LYK_ACTIVATE,    LYK_PREV_PAGE,    LYK_NEXT_PAGE,     LYK_HOME,
+/* RTARROW */    /* PGUP */        /* PGDOWN */       /* HOME */
+
+#else
 LYK_PREV_LINK,    LYK_NEXT_LINK,    LYK_ACTIVATE,   LYK_PREV_DOC,
 /* UPARROW */     /* DNARROW */     /* RTARROW */   /* LTARROW */
 
 LYK_NEXT_PAGE,    LYK_PREV_PAGE,    LYK_HOME,       LYK_END,
 /* PGDOWN */      /* PGUP */        /* HOME */      /* END */
 
+#endif /* __DJGPP__ && USE_SLANG && !DJGPP_KEYHANDLER */
+#ifdef __DJGPP__
+#ifdef USE_SLANG
+LYK_END,          LYK_HOME,         LYK_PREV_PAGE,     0,
+/* END */ 	  /* HOME */          /* PGUP */       /* B2 Key */
+
+LYK_END,          LYK_NEXT_PAGE,       0,
+/* END */         /* PGDOWN */
+
+#else
+   0,             LYK_HELP,            0,              0,
+/* F0 */ 	  /* F1 */          /* F2 */        /* F3 */
+
+   0,                  0,              0,
+
+#endif /* USE_SLANG */
+#else
 LYK_HELP,         LYK_ACTIVATE,     LYK_HOME,       LYK_END,
 /* F1*/ 	  /* Do key */      /* Find key */  /* Select key */
 
@@ -222,6 +223,157 @@ LYK_UP_TWO,       LYK_DOWN_TWO,
 
 LYK_DO_NOTHING,
 /* DO_NOTHING*/
+#endif /* __DJGPP__ */
+/* 10F..18F */
+
+   0,
+#if defined(USE_SLANG) && !defined(DJGPP_KEYHANDLER)
+   LYK_HISTORY,        LYK_ACTIVATE,   0,             0,
+   /* Backspace */     /* Enter */
+#else
+   0,                  0,              0,             0,
+#endif /* USE_SLANG */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#ifdef DJGPP_KEYHANDLER
+   0,                  LYK_ABORT,      0,             0,
+                       /* ALT_X */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             LYK_HELP,
+                                                      /* F1 */
+#else
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#endif /* DJGPP_KEYHANDLER */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#ifdef DJGPP_KEYHANDLER
+   0,                  0,              0,             LYK_HOME,
+                                                      /* HOME */
+LYK_PREV_LINK,         LYK_PREV_PAGE,  0,             LYK_PREV_DOC,
+/* UPARROW */          /* Page Up */                  /* LEFTARROW */
+   0,                  LYK_ACTIVATE,   0,             LYK_END,
+                       /* RTARROW */                  /* END */
+LYK_NEXT_LINK,         LYK_NEXT_PAGE,  0,             0,
+/* DNARROW */          /* Page Down */
+#else
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#endif /* DJGPP_KEYHANDLER */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+/* 190..20F */
+
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   LYK_ABORT,          0,              0,             0,
+   /* ALT_X */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,           LYK_ACTIVATE,
+                                                    /* KP_ENTER */
+   0,                  0,              0,           LYK_IMAGE_TOGGLE,
+                                                    /* KP_* */
+   LYK_PREV_PAGE,      LYK_NEXT_PAGE,  0,             0,
+   /* KP_- */          /* KP_+ */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#if defined(USE_SLANG) && !defined(DJGPP_KEYHANDLER)
+   0,                  LYK_HELP,       0,             0,
+                       /* F1 */
+#else
+   0,                  0,              0,             0,
+#endif /* USE_SLANG */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+/* 210..28F */
+
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#ifdef DJGPP_KEYHANDLER
+   0,                  0,              0,             LYK_HOME,
+                                                      /* HOME */
+LYK_PREV_LINK,         LYK_PREV_PAGE,  0,             LYK_PREV_DOC,
+/* UPARROW */          /* Page Up */                  /* LEFTARROW */
+   0,                  LYK_ACTIVATE,   0,             LYK_END,
+                       /* RTARROW */                  /* END */
+LYK_NEXT_LINK,         LYK_NEXT_PAGE,  0,             0,
+/* DNARROW */          /* Page Down */
+#else
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+#endif /* DJGPP_KEYHANDLER */
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   0,                  0,              0,             0,
+   /* 290...293 */
+   0,                  0,              0,             0,
 };
 
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
@@ -231,7 +383,7 @@ LYK_DO_NOTHING,
  * allowed at compile time.
  */
 
-char override[] = {
+unsigned short key_override[TABLESIZE(keymap)] = {
 
     0,
 /* EOF */
@@ -481,11 +633,6 @@ PRIVATE struct rmap revmap[] = {
 { "INSTALL",		"install file or tagged files into a system area" },
 #endif /* DIRED_SUPPORT */
 #endif /* VMS */
-#ifdef NOT_USED
-{ "VERSION",		"report version of lynx"},
-{ "FORM_UP",		"toggle a checkbox" },
-{ "FORM_DOWN",		"toggle a checkbox" },
-#endif /* NOT_USED */
 { NULL,			"" }
 };
 
@@ -526,27 +673,44 @@ PRIVATE char *pretty ARGS1 (int, c)
 		sprintf(buf, "%c", c);
 	else if (c < ' ')
 		sprintf(buf, "^%c", c|0100);
-	else
+	else if (c >= 0400 && (c - 0400) < (int) TABLESIZE(funckey))
 		sprintf(buf, "%s", funckey[c-0400]);
-	
+	else
+		return 0;
+
 	return buf;
 }
 
+PRIVATE BOOL format_binding ARGS3(
+	char *,			buf,
+	unsigned short *,	table,
+	int,			i)
+{
+    unsigned the_key = table[i];
+    char *formatted;
+
+    if (the_key != 0
+     && the_key < TABLESIZE(revmap)
+     && revmap[the_key].name != 0
+     && revmap[the_key].doc != 0
+     && (formatted = pretty(i-1)) != 0) {
+	sprintf(buf, "%-12s%-14s%s\n", formatted,
+		revmap[the_key].name,
+		revmap[the_key].doc);
+	return TRUE;
+    }
+    return FALSE;
+}
+
 PRIVATE void print_binding ARGS3(HTStream *, target, char *, buf, int, i)
 {
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
     if (prev_lynx_edit_mode && !no_dired_support &&
-        override[i] && revmap[(unsigned char)override[i]].doc) {
-	sprintf(buf, "%-12s%-14s%s\n", pretty(i-1),
-		revmap[(unsigned char)override[i]].name,
-		revmap[(unsigned char)override[i]].doc);
+        format_binding(buf, key_override, i)) {
 	(*target->isa->put_block)(target, buf, strlen(buf));
     } else
 #endif /* DIRED_SUPPORT && OK_OVERRIDE */
-    if (keymap[i] && revmap[(unsigned char)keymap[i]].doc) {
-	sprintf(buf, "%-12s%-14s%s\n", pretty(i-1),
-		revmap[(unsigned char)keymap[i]].name,
-		revmap[(unsigned char)keymap[i]].doc);
+    if (format_binding(buf, keymap, i)) {
 	(*target->isa->put_block)(target, buf, strlen(buf));
     }
 }
@@ -577,7 +741,7 @@ PRIVATE int LYLoadKeymap ARGS4 (
     sprintf(buf, "<head>\n<title>%s</title>\n</head>\n<body>\n",
     		  CURRENT_KEYMAP_TITLE);
     (*target->isa->put_block)(target, buf, strlen(buf));
-	
+
     sprintf(buf, "<h1>%s (%s Version %s)</h1>\n<pre>",
 		 CURRENT_KEYMAP_TITLE, LYNX_NAME, LYNX_VERSION);
     (*target->isa->put_block)(target, buf, strlen(buf));
@@ -589,12 +753,12 @@ PRIVATE int LYLoadKeymap ARGS4 (
 			  i-' ');  /* uppercase mapping is different */
 	}
     }
-    for (i = 1; i < (int) sizeof(keymap); i++) {
+    for (i = 1; i < (int) TABLESIZE(keymap); i++) {
 	/*
 	 *  LYK_PIPE not implemented yet.
 	 */
-	if ((i > 127 || i <= ' ' || !isalpha(i-1)) &&
-	    strcmp(revmap[(unsigned char)keymap[i]].name, "PIPE")) {
+	if ((i > (int) TABLESIZE(keymap) || i <= ' ' || !isalpha(i-1)) &&
+	    strcmp(revmap[keymap[i]].name, "PIPE")) {
 	    print_binding(target, buf, i);
 	}
     }
@@ -646,8 +810,8 @@ PUBLIC int remap ARGS2(char *,key, char *,func)
 PUBLIC void set_vms_keys NOARGS
 {
       keymap[26+1] = LYK_ABORT;  /* control-Z */
-      keymap['$'+1] = LYK_SHELL;  
-} 
+      keymap['$'+1] = LYK_SHELL;
+}
 
 static char saved_vi_keys[4];
 static BOOLEAN did_vi_keys;
@@ -763,27 +927,40 @@ PUBLIC void reset_numbers_as_arrows NOARGS
     did_number_keys = FALSE;
 }
 
-PUBLIC char *key_for_func ARGS1 (
+PUBLIC int lookup_keymap ARGS1(
 	int,		func)
 {
-	static char buf[512];
-	size_t i;
-
-	buf[0] = '\0';
-	for (i = 1; i < sizeof(keymap); i++) {
-		if (keymap[i] == func) {
-			if (*buf)
-				strcat(buf, " or ");
-			strcat(buf, pretty(i-1));
-		}
+    size_t i;
+
+    for (i = 1; i < TABLESIZE(keymap); i++) {
+	if (LYisNonAlnumKeyname(i, func)) {
+	    return i;
 	}
-	return buf;
+    }
+    return -1;
+}
+
+PUBLIC char *key_for_func ARGS1 (
+	int,		func)
+{
+    static char buf[512];
+    int i;
+    char *formatted;
+
+    buf[0] = '\0';
+    if ((i = LYReverseKeymap(func)) >= 0) {
+	if (*buf)
+	    strcat(buf, " or ");
+	formatted = pretty(i);
+	strcat(buf, formatted != 0 ? formatted : "?");
+    }
+    return buf;
 }
 
 /*
  *  This function returns TRUE if the ch is non-alphanumeric
  *  and maps to key_name (LYK_foo in the keymap[] array). - FM
- */ 
+ */
 PUBLIC BOOL LYisNonAlnumKeyname ARGS2(
 	int,	ch,
 	int,	key_name)
@@ -796,7 +973,6 @@ PUBLIC BOOL LYisNonAlnumKeyname ARGS2(
     return(keymap[ch+1] == key_name);
 }
 
-#ifdef NOTUSED_FOTEMODS
 /*
  *  This function returns the (int)ch mapped to the
  *  LYK_foo value passed to it as an argument. - FM
@@ -806,12 +982,11 @@ PUBLIC int LYReverseKeymap ARGS1(
 {
     int i;
 
-    for (i = 1; i < sizeof(keymap); i++) {
+    for (i = 1; i < (int) TABLESIZE(keymap); i++) {
 	if (keymap[i] == key_name) {
 	    return(i - 1);
 	}
     }
 
-    return(0);
+    return(-1);
 }
-#endif
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index 77feb48f..406d3660 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -1,23 +1,24 @@
 #ifndef LYKEYMAP_H
 #define LYKEYMAP_H
 
+extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name));
+extern char *key_for_func PARAMS((int func));
+extern int LYReverseKeymap PARAMS((int key_name));
+extern int lookup_keymap PARAMS((int code));
 extern int remap PARAMS((char *key, char *func));
-extern void set_vms_keys NOPARAMS;
-extern void set_vi_keys NOPARAMS;
+extern void print_keymap PARAMS((char **newfile));
+extern void reset_emacs_keys NOPARAMS;
+extern void reset_numbers_as_arrows NOPARAMS;
 extern void reset_vi_keys NOPARAMS;
 extern void set_emacs_keys NOPARAMS;
-extern void reset_emacs_keys NOPARAMS;
 extern void set_numbers_as_arrows NOPARAMS;
-extern void reset_numbers_as_arrows NOPARAMS;
-extern void print_keymap PARAMS((char **newfile));
-extern char *key_for_func PARAMS((int func));
-extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int key_name));
-extern int LYReverseKeymap PARAMS((int key_name));
+extern void set_vi_keys NOPARAMS;
+extern void set_vms_keys NOPARAMS;
 
-extern char keymap[]; /* main keymap matrix */
+extern unsigned short keymap[]; /* main keymap matrix */
 
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
-extern char override[];
+extern unsigned short key_override[];
 #endif
 
 #define CURRENT_KEYMAP_TITLE "Current Key Map"
@@ -116,6 +117,14 @@ extern char override[];
 #define       LYK_INSTALL       (LYK_DIRED_MENU+6)
 #endif /* DIRED_SUPPORT */
 
+#ifndef LYK_DIRED_MENU
+#define       LYK_DIRED_MENU    0
+#endif
+
+#ifndef LYK_TAG_LINK
+#define       LYK_TAG_LINK      0
+#endif
+
 #ifdef NOT_USED
 #define       LYK_VERSION       81
 #define       LYK_FORM_UP       82
diff --git a/src/LYMain.c b/src/LYMain.c
index 6d1ebd79..d836e568 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -307,7 +307,6 @@ PUBLIC BOOLEAN LYCancelledFetch = FALSE; /* TRUE if cancelled binary fetch */
 	       /* Include mime headers with source dump */
 PUBLIC BOOLEAN keep_mime_headers = FALSE;
 PUBLIC BOOLEAN no_url_redirection = FALSE; /* Don't follow URL redirections */
-PUBLIC BOOLEAN display_partial = FALSE; /* Display document during download */
 PUBLIC char *form_post_data = NULL;  /* User data for post form */
 PUBLIC char *form_get_data = NULL;   /* User data for get form */
 PUBLIC char *http_error_file = NULL; /* Place HTTP status code in this file */
@@ -374,6 +373,10 @@ PUBLIC BOOLEAN LYPrependBaseToSource = TRUE;
 PUBLIC BOOLEAN LYPrependCharsetToSource = FALSE;
 PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;
 
+#ifdef DISP_PARTIAL
+PUBLIC BOOLEAN display_partial = FALSE; /* Display document during download */
+#endif
+
 /* These are declared in cutil.h for current freeWAIS libraries. - FM */
 #ifdef DECLARE_WAIS_LOGFILES
 PUBLIC char *log_file_name = NULL; /* for WAIS log file name	in libWWW */
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 52e501ac..2c621748 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -90,7 +90,10 @@ PUBLIC	HTList * Goto_URLs = NULL;  /* List of Goto URLs */
 
 PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */
 
-PUBLIC int Newline = 0; /* HText_pageDisplay() requires it */
+#ifdef DISP_PARTIAL
+PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
+PUBLIC int NumOfLines_partial = 0;  /* required for display_partial mode */
+#endif
 
 PRIVATE document newdoc;
 PRIVATE document curdoc;
@@ -187,6 +190,7 @@ int mainloop NOARGS
     int getresult;
     int arrowup = FALSE, show_help = FALSE;
     int lines_in_file = -1;
+    int Newline = 0;
     char prev_target[512];
     char user_input_buffer[1024];
     char *owner_address = NULL;  /* Holds the responsible owner's address     */
@@ -212,6 +216,9 @@ int mainloop NOARGS
     BOOLEAN LYSelectPopups_flag = LYSelectPopups;
     BOOLEAN trace_mode_flag = FALSE;
     BOOLEAN forced_HTML_mode = LYforce_HTML_mode;
+#ifdef DISP_PARTIAL
+    BOOLEAN display_partial_flag = display_partial;
+#endif
     char cfile[128];
     FILE *cfp;
     char *cp, *toolbar;
@@ -492,6 +499,27 @@ try_again:
 		    LYPermitURL = TRUE;
 		}
 
+#ifdef DISP_PARTIAL
+		display_partial = display_partial_flag; /* reset */
+		Newline_partial = 0;     /* initialize */
+		NumOfLines_partial = 0;  /* initialize */
+		/*
+		 *  Disable display_partial if requested URL has #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 scrolling before... 
+		 *  So fall down to old behavior here.
+		 *  Also we should avoid displaying 'd'ownloaded files
+		 *  since they are not supposed to be shown on the screen.
+		 *  (actually we may get 'curdoc' displayed from the first page...)
+		 */
+		if (display_partial && (strchr(newdoc.address, '#')==NULL) &&
+			    (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)==0))
+			display_partial = TRUE;
+		else
+			display_partial = FALSE;
+#endif /* DISP_PARTIAL */
+
 #ifndef DONT_TRACK_INTERNAL_LINKS
 		if (try_internal) {
 		    if (newdoc.address &&
@@ -783,10 +811,9 @@ try_again:
 		       }
 		       cmd = LYK_PREV_DOC;
 		       goto new_cmd;
-		       }
+		    }
 		    override_LYresubmit_posts = TRUE;
 		    goto try_again;
-		    break;
 
 		case NORMAL:
 		    /*
@@ -963,6 +990,14 @@ try_again:
 		     *	before, or it is 1 if this is a new file.
 		     */
 		    Newline = newdoc.line;
+#ifdef DISP_PARTIAL
+		    /*
+		     *	Override newdoc.line value with a new one if user
+		     *	scrolled the document while downloading.
+		     */
+		    if (display_partial && (Newline_partial != 0))
+			Newline = Newline_partial;
+#endif /* DISP_PARTIAL */
 
 		    /*
 		     *	If we are going to a target line or
@@ -1322,7 +1357,7 @@ try_again:
 			 (links[curdoc.link].type & WWW_LINK_TYPE))) {
 #endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */
 #endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */
-		if (links[curdoc.link].type == WWW_FORM_LINK_TYPE)
+		if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) {
 		    switch(links[curdoc.link].form->type) {
 		    case F_PASSWORD_TYPE:
 			if (links[curdoc.link].form->disabled == YES)
@@ -1395,8 +1430,9 @@ try_again:
 			    statusline(FORM_LINK_TEXT_MESSAGE);
 			break;
 		    }
-		else
+		} else {
 		    statusline(NORMAL_LINK_MESSAGE);
+		}
 
 		/*
 		 *  Let them know if it's an index -- very rare.
@@ -1419,17 +1455,18 @@ try_again:
 		}
 		if (!cp)
 		    cp = links[curdoc.link].lname;
-		if (more)
+		if (more) {
 		    if (is_www_index)
 			_user_message("-more- -index- %s",
 						 cp);
 		    else
 			_user_message("-more- %s",cp);
-		else
+		} else {
 		    if (is_www_index)
 			_user_message("-index- %s",cp);
 		    else
 			statusline(cp);
+		}
 	    } else if (is_www_index && more) {
 		char buf[128];
 
@@ -1678,8 +1715,8 @@ new_keyboard_input:
 	cmd = keymap[c+1];  /* add 1 to map EOF to 0 */
 
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
-	if (lynx_edit_mode && override[c+1] && !no_dired_support)
-	  cmd = override[c+1];
+	if (lynx_edit_mode && key_override[c+1] && !no_dired_support)
+	  cmd = key_override[c+1];
 #endif /* DIRED_SUPPORT && OK_OVERRIDE */
 
 	real_cmd = cmd;
@@ -2184,7 +2221,6 @@ new_cmd:  /*
 
 	case LYK_ABORT: 	/* don't ask the user about quitting */
 	    return(0);
-	    break;
 
 	case LYK_NEXT_PAGE:	/* next page */
 	    if (more) {
@@ -2303,7 +2339,7 @@ new_cmd:  /*
 
 	case LYK_END:
 	    if (more) {
-	       Newline = MAXINT; /* go to end of file */
+	       Newline = lines_in_file - display_lines + 3;  /* go to end of file */
 	       arrowup = TRUE;	 /* position on last link */
 	    } else {
 		cmd = LYK_NEXT_PAGE;
@@ -5197,7 +5233,6 @@ check_add_bookmark_to_self:
 	    sleep(MessageSecs);
 	    cmd = LYK_RELOAD;
 	    goto new_cmd;
-	    break;
 
 	case LYK_INLINE_TOGGLE:
 	    if (pseudo_inline_alts)
@@ -5210,7 +5245,6 @@ check_add_bookmark_to_self:
 	    sleep(MessageSecs);
 	    cmd = LYK_RELOAD;
 	    goto new_cmd;
-	    break;
 
 	case LYK_RAW_TOGGLE:
 	    if (LYUseDefaultRawMode)
@@ -5223,7 +5257,6 @@ check_add_bookmark_to_self:
 	    sleep(MessageSecs);
 	    cmd = LYK_RELOAD;
 	    goto new_cmd;
-	    break;
 
 	case LYK_HEAD:
 	    if (nlinks > 0 &&
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 1f4253ec..e5548165 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -82,15 +82,11 @@ PRIVATE int set_clicked_link ARGS2(int,x,int,y)
   if (mouse_link == -1) return -1;
 
   /* If a link was hit, we must look for a key which will activate LYK_ACTIVATE
-  ** XXX The 127 in the following line will depend on the size of the keymap[]
-  ** array.  However, usually we'll find LYK_ACTIVATE somewhere in the first
-  ** 127 keys (it's usually mapped to the Enter key)
+  ** We expect to find LYK_ACTIVATE (it's usually mapped to the Enter key).
   **/
-  for (i=0; i<127; i++) {
-    if (LYisNonAlnumKeyname(i, LYK_ACTIVATE)) {
+  if ((i = lookup_keymap(LYK_ACTIVATE)) >= 0)
       return i;
-    }
-  }
+
     /* Whoops!	Nothing's defined as LYK_ACTIVATE!
        Well, who are we to argue with the user?
        Forget about the mouse click */
@@ -311,23 +307,6 @@ PRIVATE int sl_parse_mouse_event ARGS3(int *, x, int *, y, int *, button)
 }
 #endif
 
-#if defined(USE_SLANG_MOUSE) || defined(NCURSES_MOUSE_VERSION)
-PRIVATE int map_function_to_key ARGS1(char, keysym)
-{
-   int i;
-
-   /* I would prefer to use sizeof keymap but its size is not available.
-    * A better method would be to declare it as some fixed size.
-    */
-   for (i = 1; i < 256; i++)
-     {
-	if (keymap[i] == keysym)
-	  return i - 1;
-     }
-   return -1;
-}
-#endif
-
 #if defined(USE_SLANG_MOUSE)
 PRIVATE int sl_read_mouse_event NOARGS
 {
@@ -345,7 +324,7 @@ PRIVATE int sl_read_mouse_event NOARGS
 	      * The problem is that we need to determine
 	      * what to return to achieve this.
 	      */
-	     return map_function_to_key (LYK_PREV_DOC);
+	     return LYReverseKeymap (LYK_PREV_DOC);
 	  }
      }
    return -1;
@@ -392,7 +371,7 @@ static Keysym_String_List Keysym_Strings [] =
    {NULL, -1}
 };
 
-static int map_string_to_keysym (char *str, int *keysym)
+PRIVATE int map_string_to_keysym (char *str, int *keysym)
 {
    Keysym_String_List *k;
 
@@ -413,7 +392,7 @@ static int map_string_to_keysym (char *str, int *keysym)
 
 
 /* The second argument may either be a string or and integer */
-static int setkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
+PRIVATE int setkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
 {
    char *keyseq;
    int keysym;
@@ -426,7 +405,7 @@ static int setkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
 	break;
 
       case SLANG_STRING_TYPE:
-        if (-1 == map_string_to_keysym (table->string_args[2], &keysym))
+	if (-1 == map_string_to_keysym (table->string_args[2], &keysym))
 	  return -1;
 	break;
 
@@ -437,7 +416,7 @@ static int setkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
    return SLkm_define_keysym (keyseq, keysym, Keymap_List);
 }
 
-static int unsetkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
+PRIVATE int unsetkey_cmd (int argc GCC_UNUSED, SLcmd_Cmd_Table_Type *table)
 {
    SLang_undefine_key (table->string_args[1], Keymap_List);
    if (SLang_Error) return -1;
@@ -451,7 +430,7 @@ static SLcmd_Cmd_Type Keymap_Cmd_Table [] =
    {NULL}
 };
 
-static int read_keymap_file NOARGS
+PRIVATE int read_keymap_file NOARGS
 {
    char line[1024];
    FILE *fp;
@@ -466,7 +445,11 @@ static int read_keymap_file NOARGS
    keymap_file = "lynx.keymaps";
    home = "SYS$LOGIN:";
 #else
+#ifdef FNAMES_8_3
+   keymap_file = "/_lynxkey.map";
+#else
    keymap_file = "/.lynx-keymaps";
+#endif /* FNAMES_8_3 */
    home = getenv ("HOME");
    if (home == NULL) home = "";
 #endif
@@ -504,7 +487,7 @@ static int read_keymap_file NOARGS
    return ret;
 }
 
-int lynx_initialize_keymaps NOARGS
+PUBLIC int lynx_initialize_keymaps NOARGS
 {
    int i;
    char keybuf[2];
@@ -547,12 +530,18 @@ int lynx_initialize_keymaps NOARGS
    return 0;
 }
 
-int LYgetch (void)
+/* We cannot guarantee the type for 'GetChar', and should not use a cast. */
+PRIVATE int myGetChar NOARGS
+{
+   return GetChar();
+}
+
+PUBLIC int LYgetch NOARGS
 {
    SLang_Key_Type *key;
    int keysym;
 
-   key = SLang_do_key (Keymap_List, (int (*)(void)) GetChar);
+   key = SLang_do_key (Keymap_List, myGetChar);
    if ((key == NULL) || (key->type != SLKEY_F_KEYSYM))
      return DO_NOTHING;
 
@@ -602,28 +591,6 @@ re_read:
    }
 #endif /* !USE_SLANG || VMS */
 
-/* The RAWDOSKEYHACK takes key definitions from curses.h (when using
- * PDCURSES) or from the DJGPP file keys.h (when using SLANG) and maps
- * them to the values used by the lynx file LYKeymap.c. */
-
-#ifdef RAWDOSKEYHACK
-    if (raw_dos_key_hack) {
-	if (c == 0) c = '/';
-	if (c > 255) {	    /* handle raw dos keys */
-	    switch (c)
-	    {
-		case 464: c = '-';	break;	/* keypad minus*/
-		case 465: c = '+';	break;	/* keypad plus*/
-		case 459: c = 13;	break;	/* keypad enter*/
-		case 463: c = '*';	break;	/* keypad * */
-		case 440: c = 'Q';	break;	/* alt x */
-		case 265: c = 'H';	break;	/* F1 */
-		default: break;
-	    }
-	}
-    }
-#endif /* RAWDOSKEYHACK */
-
 #ifdef USE_GETCHAR
     if (c == EOF && errno == EINTR)	/* Ctrl-Z causes EINTR in getchar() */
 	goto re_read;
@@ -791,74 +758,6 @@ re_read:
 	if (isdigit(a) && (b == '[' || c == 155) && d != -1 && d != '~')
 	    d = GetChar();
     }
-#if defined(__DJGPP__) && defined(USE_SLANG)
-#ifdef DJGPP_KEYHANDLER
-    else { /* DJGPP keypad interface (see file "keys.h" for definitions) */
-	switch (c) {
-	    case K_Up:		c = UPARROW;	break; /* up arrow */
-	    case K_EUp: 	c = UPARROW;	break; /* up arrow */
-	    case K_Down:	c = DNARROW;	break; /* down arrow */
-	    case K_EDown:	c = DNARROW;	break; /* down arrow */
-	    case K_Right:	c = RTARROW;	break; /* right arrow */
-	    case K_ERight:	c = RTARROW;	break; /* right arrow */
-	    case K_Left:	c = LTARROW;	break; /* left arrow */
-	    case K_ELeft:	c = LTARROW;	break; /* left arrow */
-	    case K_PageDown:	c = PGDOWN;	break; /* page down */
-	    case K_EPageDown:	c = PGDOWN;	break; /* page down */
-	    case K_PageUp:	c = PGUP;	break; /* page up */
-	    case K_EPageUp:	c = PGUP;	break; /* page up */
-	    case K_Home:	c = HOME;	break; /* HOME */
-	    case K_EHome:	c = HOME;	break; /* HOME */
-	    case K_End: 	c = END_KEY;	break; /* END */
-	    case K_EEnd:	c = END_KEY;	break; /* END */
-	    case K_F1:		c = F1; 	break; /* F1 */
-	    case K_Alt_X:	c = 4;		break; /* alt x */
-	}
-    }
-#else
-    else { /* SLang keypad interface (see file "slang.h" for definitions) */
-	switch (c) {
-	case SL_KEY_UP:
-	    c = UPARROW;
-	    break;
-	case SL_KEY_DOWN:
-	    c = DNARROW;
-	    break;
-	case SL_KEY_RIGHT:
-	    c = RTARROW;
-	    break;
-	case SL_KEY_B2:
-	    c = DO_NOTHING;
-	    break;
-	case SL_KEY_LEFT:
-	    c = LTARROW;
-	    break;
-	case SL_KEY_PPAGE:
-	case SL_KEY_A3:
-	    c = PGUP;
-	    break;
-	case SL_KEY_NPAGE:
-	case SL_KEY_C3:
-	    c = PGDOWN;
-	    break;
-	case SL_KEY_HOME:
-	case SL_KEY_A1:
-	    c = HOME;
-	    break;
-	case SL_KEY_END:
-	case SL_KEY_C1:
-	    c = END_KEY;
-	    break;
-	case SL_KEY_F(1):
-	    c = F1;
-	    break;
-	case SL_KEY_BACKSPACE:
-	    c = 127;
-	    break;
-	}
-    }
-#endif /* DJGPP_KEYHANDLER */
-#endif /* __DJGPP__ && USE_SLANG */
 #if HAVE_KEYPAD
     else {
 	/*
@@ -926,7 +825,7 @@ re_read:
 	   c = 127;		   /* backspace key (delete, not Ctrl-H) */
 	   break;
 #endif /* KEY_BACKSPACE */
-#ifdef KEY_F
+#if defined(KEY_F) && !defined(__DJGPP__)
 	case KEY_F(1):
 	   c = F1;		   /* VTxxx Help */
 	   break;
@@ -972,7 +871,7 @@ re_read:
 	   if (event.bstate & BUTTON1_CLICKED) {
 	     c = set_clicked_link(event.x, event.y);
 	   } else if (event.bstate & BUTTON3_CLICKED) {
-	     c = map_function_to_key (LYK_PREV_DOC);
+	     c = LYReverseKeymap (LYK_PREV_DOC);
 	   }
 #else /* pdcurses version */
 	      int left,right;
@@ -983,15 +882,17 @@ re_read:
 	      mouse_link = -1;
 	      request_mouse_pos();
 	      if (Mouse_status.button[0] & BUTTON_CLICKED) {
-		if (Mouse_status.y == (LYlines-1))
+		if (Mouse_status.y == (LYlines-1)) {
 		       if (Mouse_status.x < left) c=LTARROW;
 		       else if (Mouse_status.x > right) c='\b';
-		       else c=PGDOWN;
-		else if (Mouse_status.y == 0)
+		       else c = PGDOWN;
+		} else if (Mouse_status.y == 0) {
 		       if (Mouse_status.x < left) c=LTARROW;
 		       else if (Mouse_status.x > right) c='\b';
-		       else c=PGUP;
-		else c = set_clicked_link(Mouse_status.x, Mouse_status.y);
+		       else c = PGUP;
+		} else {
+		    c = set_clicked_link(Mouse_status.x, Mouse_status.y);
+		}
 	      }
 #endif /* _WINDOWS */
 	  }
@@ -1001,7 +902,12 @@ re_read:
     }
 #endif /* HAVE_KEYPAD */
 
-    if (c > DO_NOTHING) {
+#ifdef __DJGPP__
+    if (c > 659)
+#else
+    if (c > DO_NOTHING)
+#endif /* __DJGPP__ */
+    {
 	/*
 	 *  Don't return raw values for KEYPAD symbols which we may have
 	 *  missed in the switch above if they are obviously invalid when
@@ -1523,7 +1429,6 @@ again:
 	     */
 	    strcpy(inputline, MyEdit.buffer);
 	    return(ch);
-	    break;
 
 	case LYE_ABORT:
 	    /*
@@ -1531,7 +1436,6 @@ again:
 	     */
 	    inputline[0] = '\0';
 	    return(-1);
-	    break;
 
 	case LYE_LKCMD:
 	    /*
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 11eba6c1..48c5a478 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -142,6 +142,10 @@ typedef struct _EditFieldData {
 
 #define LYE_AIX   (LYE_LKCMD +1)  /* Hex 97		   */
 
+#if defined(USE_SLANG_KEYMAPS)
+extern int lynx_initialize_keymaps NOPARAMS;
+#endif
+
 extern void LYLowerCase PARAMS((
 	char *		buffer));
 extern void LYUpperCase PARAMS((
diff --git a/src/LYUpload.c b/src/LYUpload.c
index cfbca0e6..f453751c 100644
--- a/src/LYUpload.c
+++ b/src/LYUpload.c
@@ -258,11 +258,11 @@ PUBLIC int LYUpload_options ARGS2(
     fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n",
 		 UPLOAD_OPTIONS_TITLE);
 
-    fprintf(fp0, "<h1>Upload Options (%s Version %s)</h1>\n",
+    fprintf(fp0, "<h1>Upload Options (%s Version %s)</h1><pre>\n",
 				      LYNX_NAME, LYNX_VERSION);
 
-    fputs("You have the following upload choices.<br>\n", fp0);
-    fputs("Please select one:<br>\n<pre>\n", fp0);
+    fputs("   You have the following upload choices.<br>\n", fp0);
+    fputs("   Please select one:<br>\n\n", fp0);
 
     if (uploaders != NULL) {
 	for (count = 0, cur_upload = uploaders;
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 69fbbe83..bb30a96e 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -16,6 +16,9 @@
 #ifdef DOSPATH
 #include <HTDOS.h>
 #endif
+#ifdef DJGPP_KEYHANDLER
+#include <bios.h>
+#endif /* DJGPP_KEYHANDLER */
 #ifdef DISP_PARTIAL
 #include <LYKeymap.h>
 #endif /* DISP_PARTIAL */
@@ -2059,7 +2062,11 @@ PUBLIC int HTCheckForInterrupt NOARGS
 	Note that this isn't taking possible SOCKSification
 	and the socks_flag into account, and may fail on the
 	slang library's select() when SOCKSified. - FM **/
+#ifdef DJGPP_KEYHANDLER
+    if (0 == _bios_keybrd(_NKEYBRD_READY))
+#else
     if (0 == SLang_input_pending(0))
+#endif /* DJGPP_KEYHANDLER */
 	return(FALSE);
 
 #else /* Unix curses: */
@@ -2102,35 +2109,45 @@ PUBLIC int HTCheckForInterrupt NOARGS
 	switch (keymap[c+1])
 	{
 	case LYK_PREV_PAGE :
-	    if (Newline > 1)
-		Newline -= display_lines ;
+	    if (Newline_partial > 1)
+		Newline_partial -= display_lines ;
 	    break ;
 	case LYK_NEXT_PAGE :
 	    if (HText_canScrollDown())
-		Newline += display_lines ;
+		Newline_partial += display_lines ;
+	    break ;
+	case LYK_UP_HALF :
+	    if (Newline_partial > 1)
+		Newline_partial -= (display_lines/2) ;
+	    break ;
+	case LYK_DOWN_HALF :
+	    if (HText_canScrollDown())
+		Newline_partial += (display_lines/2) ;
 	    break ;
 	case LYK_UP_TWO :
-	    if (Newline > 1)
-		Newline -= 2 ;
+	    if (Newline_partial > 1)
+		Newline_partial -= 2 ;
 	    break ;
 	case LYK_DOWN_TWO :
 	    if (HText_canScrollDown())
-		Newline += 2 ;
+		Newline_partial += 2 ;
 	    break ;
 	case LYK_HOME:
-	    if (Newline > 1)
-		Newline = 1;
+	    if (Newline_partial > 1)
+		Newline_partial = 1;
 	    break;
 	case LYK_END:
 	    if (HText_canScrollDown())
-		Newline = MAXINT;
+		Newline_partial = HText_getNumOfLines() - display_lines + 2;
+		/* set "current" value */
 	    break;
 	case LYK_REFRESH :
 	    break ;
 	default :
 	    return ((int)FALSE) ;
 	}
-	HText_pageDisplay(Newline, "");
+	NumOfLines_partial = HText_getNumOfLines();
+	HText_pageDisplay(Newline_partial, "");
     }
 #endif /* DISP_PARTIAL */
 
@@ -3226,12 +3243,15 @@ PUBLIC void change_sug_filename ARGS1(
  */
 PRIVATE char *fmt_tempname ARGS3(
 	char *, 	result,
-	unsigned,	counter,
+	CONST char *, 	prefix,
 	CONST char *,	suffix)
 {
+    static unsigned counter;
     char *leaf;
-    strcpy(result, lynx_temp_space);
+
+    strcpy(result, prefix);
     leaf = result + strlen(result);
+    counter++;
 #ifdef FNAMES_8_3
     /*
      * The 'lynx_temp_space' string ends with a '/' or '\\', so we only have to
@@ -5487,7 +5507,6 @@ PUBLIC FILE *LYOpenTemp ARGS3(
     BOOL txt = TRUE;
     BOOL wrt = 'r';
     LY_TEMP *p;
-    static unsigned counter;
 
     CTRACE(tfp, "LYOpenTemp(,%s,%s)\n", suffix, mode);
     while (*mode != '\0') {
@@ -5502,7 +5521,7 @@ PUBLIC FILE *LYOpenTemp ARGS3(
     }
 
     do {
-	(void) fmt_tempname(result, counter++, suffix);
+	(void) fmt_tempname(result, lynx_temp_space, suffix);
 	if (txt) {
 	    switch (wrt) {
 	    case 'w':
@@ -5535,7 +5554,7 @@ PUBLIC FILE *LYReopenTemp ARGS1(
 	char *, 	name)
 {
     LY_TEMP *p;
-    FILE *fp;
+    FILE *fp = 0;
 
     LYCloseTemp(name);
     for (p = ly_temp; p != 0; p = p->next) {
@@ -5558,7 +5577,7 @@ PUBLIC FILE *LYOpenScratch ARGS2(
     FILE *fp;
     LY_TEMP *p;
 
-    sprintf(result, "%s-%u.%s", prefix, getpid(), HTML_SUFFIX);
+    (void) fmt_tempname(result, prefix, HTML_SUFFIX);
     if ((fp = LYNewTxtFile (result)) != 0) {
 	if ((p = (LY_TEMP *)calloc(1, sizeof(LY_TEMP))) != 0) {
 	    p->next = ly_temp;
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 61baf346..876e35f8 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -11,7 +11,7 @@
 extern void highlight PARAMS((int flag, int cur, char *target));
 extern void free_and_clear PARAMS((char **obj));
 extern void convert_to_spaces PARAMS((char *string, BOOL condense));
-extern char * strip_trailing_slash PARAMS((char * dirname));
+extern char * strip_trailing_slash PARAMS((char * my_dirname));
 extern void statusline PARAMS((CONST char *text));
 extern void toggle_novice_line NOPARAMS;
 extern void noviceline PARAMS((int more_flag));
diff --git a/src/makefile.dos b/src/makefile.dos
index 91ace376..452b6aeb 100644
--- a/src/makefile.dos
+++ b/src/makefile.dos
@@ -12,7 +12,7 @@ LYStyle.o LYHash.o
 CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC)

 

 CC = gcc

-MCFLAGS = -O3 -DRAWDOSKEYHACK -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses  -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp

+MCFLAGS = -O3 -DUSE_ZLIB -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -Ichrtrans -I../WWW/library/implementation -I../curses  -I../djgpp/tcplib/include -I../djgpp/tcplib/include/tcp

 WWWLIB = ../WWW/library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/tcplib/obj/libtcp.a

 LIBS=-lz

 

@@ -20,7 +20,7 @@ all: lynx
 

 lynx:   message $(OBJS) $(WWWLIB)

 	@echo "Linking and creating Lynx executable"

-	$(CC) $(CFLAGS) -o lynx  $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)

+	$(CC) $(CFLAGS) -o lynx.exe  $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS)

 	@echo "Welcome to Lynx!"

 

 message:

@@ -34,7 +34,7 @@ lint:
 	lint *.c  > ../lint.out

 

 clean:

-	rm -f lynx core *.[ob]

+	rm -f lynx.exe core *.[ob]

 

 LYMain.o: ../userdefs.h

 LYMainLoop.o: LYMainLoop.c ../userdefs.h