lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev (long patch) SOURCE_CACHE!=NONE fixes and more


From: Leonid Pauzner
Subject: lynx-dev (long patch) SOURCE_CACHE!=NONE fixes and more
Date: Wed, 21 Apr 1999 22:20:11 +0400 (MSD)

21-Apr-99 06:41 Klaus Weide wrote:
> On Mon, 19 Apr 1999, Leonid Pauzner wrote:

>> Now, when source_cache implemented by someone else I have fixed most
>> mainloop problems in an elegant any clear way (submitted to Tom privately,
>> will be available in dev23 soon).

> I'd prefer if you had sent it to the list, too...

>> This actually *simpify* mainloop

Here this patch _without any changes_ (sorry if directory names are messed):


* Fix reload_read_cfg() to avoid persistent cookies mode changing at run time;
  reload printers list, downloaders list, environments - as expected. - LP
* Fixes for SOURCE_CACHE!=NONE mode, trying to accomodate HTreparse_document()
  for mainloop() events:
  - fix switching to/from source mode when -prettysrc is in effect - VH & dsb.
  - fix case LYK_SOURCE - dsb
  - fix document length update to allow scrolling down - LP
  - add partial display mode for HTreparse_document() operations - LP
  - add/use flag "from_source_cache" for better mainloop maintenance - LP
  - add warning when the reparsed document may lost its forms content - LP
  - fix options menu staff to use HTreparse_document() exit when possible - LP
* fix exit from postoptions() when the reloaded document was in source mode - LP
* fix ifdef'ing for print_local_dir() to build with VMS (reported by
  Tony Bolton address@hidden) - LP
* tweak ifdefs to build with USE_PSRC *and* without USE_COLOR_STYLE - LP
* DJGPP port: add SOURCE_CACHE and USE_PSRC flags for all makefiles - LP


diff -u ./changes ../changes
--- ./changes   Tue Apr 13 03:39:16 1999
+++ ../changes  Tue Apr 13 20:37:18 1999
@@ -16,7 +16,12 @@
   is selectable by a configure option --enable-source-cache and by a lynx.cfg
   option SOURCE_CACHE; I didn't add a command-line argument or an options menu
   entry, as this didn't seem to be the sort of thing one would want to change
-  at runtime.  (Scott Bigham <address@hidden>)
+  at runtime.
+  You had to challenge me, didn't you? ;)  Okay, after some pfutzing
+  around with HTChunks, I think I've got a working version of memory
+  caching of source.  The SOURCE_CACHE option now has settings FILE,
+  MEMORY and NONE, with the obvious meanings, defaulting to NONE.
+  (Scott Bigham <address@hidden>)
 * amend HTConfirmDefault() logic so that a second character will cause the
   default response to be returned, e.g,. so that pressing "qq" will make
   Lynx exit (reported by John Bley) - TD
@@ -26,13 +31,13 @@
   in LYMain.c, add newlines in HTFile.c for readability of html - LP
 * change default STARTFILE to the current directory, "." - PW
 * revised lynx-dev.html - PW
-* lynx.cfg and farther included cfg files can be edited from LYNXCFG:/ page
+* lynx.cfg and further included cfg files can be edited from LYNXCFG:/ page
   with the default editor and changes can be activated for the same lynx
   session.  NOT allowed for restricted users (LYRestricted) and occasionally
   for user mode other than ADVANCED.  This is an *experimental* code
   (reload_read_cfg() in LYMain.c - more work required):  currently command-line
   switches may be lost when overriden by lynx.cfg changes, file paths like
-  lynx_temp_space and LYCookieFile should not be changed (unwanted results) -LP
+  lynx_save_space and LYCookieFile should not be changed (unwanted results) -LP
 * retest PARSE_DEBUG ifdef's (LYMain.c, LYReadCFG.c), minor corrections
   but found no specific reason for LP's problem with tables, except possibly
   different effect from "&(value)" versus "(&value)" - TD
@@ -91,9 +96,9 @@
 * added HTML source syntax highlighting (when option -prettysrc that is added
   is given to lynx). It's available for lynx compiled with and without lss
   support (it can be much more beatiful when compiled with lss support - read
-  lynx.cfg for description). This functionality coexists with old source view
-  and with -preparsed logic (ie different commandline options make source view
-  logic different) VH
+  lynx.cfg for description). The code ifdef'ed with USE_SRC.
+  This functionality coexists with old source view and with -preparsed logic
+  (ie different commandline options make source view logic different) -VH
 * HTChunkPutc was inlined in SGML.c for better performance -VH
 * Keeping of Style_className was omitted in HTML.c to increase performance of
   lynx compiled with lss support. -VH
@@ -129,7 +134,7 @@
   new HText structure that most likely is never displayed but still pushes
   another document out of the.  cache.  Most commonly this occurs when a HTTP
   error response is received and the user presses 'z' while the resulting alert
-  message is shown - LW
+  message is shown - KW
 * Fix of HTUnEscapeSome in HTParse.c for non-ASCII - KW, PG
 * tidy up around ed_offset initialization in GridText.c - KED
   (the patch as given did not compile on a non-ANSI compiler because it used
diff -u ./gridtext.c ../gridtext.c
--- ./gridtext.c        Tue Apr 13 03:39:16 1999
+++ ../gridtext.c       Sat Apr 17 18:46:40 1999
@@ -123,6 +123,7 @@
 PUBLIC char * source_cache_filename = NULL;
 PUBLIC HTChunk * source_cache_chunk = NULL;
 PUBLIC int LYCacheSource = SOURCE_CACHE_NONE;
+PUBLIC BOOLEAN from_source_cache = FALSE;  /* mutable */
 #endif

 #if defined(USE_COLOR_STYLE)
@@ -561,7 +562,7 @@
     self->LastChar = '\0';
     self->IgnoreExcess = FALSE;

-#ifndef PSRC_TEST
+#ifndef USE_PSRC
     if (HTOutputFormat == WWW_SOURCE)
        self->source = YES;
     else
@@ -6186,14 +6187,15 @@

        /*
         * This is more or less copied out of HTLoadFile(), except we don't
-        * get a content encoding.  This may be overkill...
+        * get a content encoding.  This may be overkill.  -dsb
         */
        if (HTMainText->node_anchor->content_type) {
            format = HTAtom_for(HTMainText->node_anchor->content_type);
        } else {
            format = HTFileFormat(HTMainText->source_cache_file, NULL, NULL);
            format = HTCharsetFormat(format, HTMainText->node_anchor,
-                                    UCLYhndl_HTFile_for_unspec);
+                                    UCLYhndl_for_unspec);
+               /* not UCLYhndl_HTFile_for_unspec - we are talking about remote 
documents... */
        }
        CTRACE(tfp, "  Content type is \"%s\"\n", format->name);

@@ -6210,12 +6212,25 @@
            FREE(source_cache_filename);
            return FALSE;
        }
+#ifdef DISP_PARTIAL
+       display_partial = display_partial_flag;  /* restore */
+       Newline_partial = Newline;  /* initialize */
+#endif
+           if (lynx_mode == FORMS_LYNX_MODE) {
+               /*
+                *  Note that if there are no form links on the current
+                *  page, lynx_mode won't have this setting and we won't
+                *  know that this warning should be issued. - FM
+                */
+               HTAlert(RELOADING_FORM);
+           }
        ret = HTParseFile(format, HTOutputFormat, HTMainText->node_anchor,
                          fp, NULL);
        fclose(fp);
        ok = (ret == HT_LOADED);
-       if (!ok)
+       if (!ok) {
            FREE(source_cache_filename);
+       }
     }

     if (LYCacheSource == SOURCE_CACHE_MEMORY &&
@@ -6233,6 +6248,18 @@
        source_cache_chunk = HTMainText->source_cache_chunk;
        HTMainText->source_cache_chunk = NULL;

+#ifdef DISP_PARTIAL
+       display_partial = display_partial_flag;  /* restore */
+       Newline_partial = Newline;  /* initialize */
+#endif
+           if (lynx_mode == FORMS_LYNX_MODE) {
+               /*
+                *  Note that if there are no form links on the current
+                *  page, lynx_mode won't have this setting and we won't
+                *  know that this warning should be issued. - FM
+                */
+               HTAlert(RELOADING_FORM);
+           }
        ret = HTParseMem(format, HTOutputFormat, HTMainText->node_anchor,
                         source_cache_chunk, NULL);
        ok = (ret == HT_LOADED);
@@ -6242,7 +6269,16 @@
        }
     }

+    /*
+     * I have no idea what this does, but it seems to be necessary... -dsb
+     */
+    LYUCPopAssumed();
+
     CTRACE(tfp, "Reparse %s\n", (ok ? "succeeded" : "failed"));
+
+    if (ok)
+       from_source_cache = TRUE;  /* flag for mainloop events */
+
     return ok;
 }

diff -u ./htaccess.c ../htaccess.c
--- ./htaccess.c        Tue Apr 13 03:39:16 1999
+++ ../htaccess.c       Tue Apr 13 23:30:44 1999
@@ -580,6 +580,11 @@
            UCAssume_MIMEcharset = NULL;
            StrAllocCopy(UCAssume_MIMEcharset, anchor_UCI->MIMEname);
            pushed_assume_LYhndl = anchor_LYhndl;
+                 /* some diagnostics */
+                 if (UCLYhndl_for_unspec != anchor_LYhndl)
+                 CTRACE(tfp, "LYUCPushAssumed: UCLYhndl_for_unspec changed %d 
-> %d\n",
+                        UCLYhndl_for_unspec,
+                        anchor_LYhndl);
            UCLYhndl_for_unspec = anchor_LYhndl;
            return;
        }
@@ -592,9 +597,15 @@
  *  UCLYhndl_for_unspec used for charset "assuming" from the values
  *  saved by LYUCPushAssumed, if any. - kw
  */
-PRIVATE int LYUCPopAssumed NOARGS
+PUBLIC int LYUCPopAssumed NOARGS
 {
+
     if (pushed_assume_LYhndl >= 0) {
+                 /* some diagnostics */
+                 if (UCLYhndl_for_unspec != pushed_assume_LYhndl)
+                 CTRACE(tfp, "LYUCPopAssumed: UCLYhndl_for_unspec changed %d 
-> %d\n",
+                        UCLYhndl_for_unspec,
+                        pushed_assume_LYhndl);
        UCLYhndl_for_unspec = pushed_assume_LYhndl;
        pushed_assume_LYhndl = -1;
        FREE(UCAssume_MIMEcharset);
diff -u ./htaccess.h ../htaccess.h
--- ./htaccess.h        Wed Mar 17 20:17:12 1999
+++ ../htaccess.h       Tue Apr 13 23:11:32 1999
@@ -305,6 +305,7 @@

 extern void LYUCPushAssumed PARAMS((
     HTParentAnchor *   anchor));
+extern int LYUCPopAssumed NOPARAMS;

 #endif /* HTACCESS_H */
 /*
diff -u ./htfile.c ../htfile.c
--- ./htfile.c  Tue Apr 13 02:39:16 1999
+++ ../htfile.c Sat Apr 17 19:38:12 1999
@@ -521,62 +521,6 @@
 }
 #endif /* LY_FIND_LEAKS */

-extern void HTDisplayPartial NOARGS;
-
-/*     Send README file.
-**     -----------------
-**
-**  If a README file exists, then it is inserted into the document here.
-*/
-#ifdef HAVE_READDIR
-PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname)
-{
-    FILE * fp;
-    char * readme_file_name =
-       malloc(strlen(localname)+ 1 + strlen(HT_DIR_README_FILE) + 1);
-    if (readme_file_name == NULL)
-       outofmem(__FILE__, "do_readme");
-    strcpy(readme_file_name, localname);
-    strcat(readme_file_name, "/");
-    strcat(readme_file_name, HT_DIR_README_FILE);
-
-    fp = fopen(readme_file_name,  "r");
-
-    if (fp) {
-       HTStructuredClass targetClass;
-
-       targetClass =  *target->isa;    /* (Can't init agregate in K&R) */
-       START(HTML_PRE);
-       for (;;){
-           char c = fgetc(fp);
-           if (c == (char)EOF) break;
-#ifdef NOTDEFINED
-           switch (c) {
-               case '&':
-               case '<':
-               case '>':
-                       PUTC('&');
-                       PUTC('#');
-                       PUTC((char)(c / 10));
-                       PUTC((char) (c % 10));
-                       PUTC(';');
-                       break;
-/*             case '\n':
-                       PUTC('\r');
-Bug removed thanks to address@hidden */
-               default:
-                       PUTC(c);
-           }
-#else
-           PUTC(c);
-#endif /* NOTDEFINED */
-       }
-       END(HTML_PRE);
-       HTDisplayPartial();
-       fclose(fp);
-    }
-}
-#endif /* HAVE_READDIR */

 /*     Make the cache file name for a W3 document.
 **     -------------------------------------------
@@ -1472,6 +1416,65 @@
     return(need_parent_link);
 }

+
+#ifdef HAVE_READDIR
+extern void HTDisplayPartial NOARGS;
+extern void HTFinishDisplayPartial NOARGS;
+
+/*     Send README file.
+**     -----------------
+**
+**  If a README file exists, then it is inserted into the document here.
+*/
+PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname)
+{
+    FILE * fp;
+    char * readme_file_name =
+       malloc(strlen(localname)+ 1 + strlen(HT_DIR_README_FILE) + 1);
+    if (readme_file_name == NULL)
+       outofmem(__FILE__, "do_readme");
+    strcpy(readme_file_name, localname);
+    strcat(readme_file_name, "/");
+    strcat(readme_file_name, HT_DIR_README_FILE);
+
+    fp = fopen(readme_file_name,  "r");
+
+    if (fp) {
+       HTStructuredClass targetClass;
+
+       targetClass =  *target->isa;    /* (Can't init agregate in K&R) */
+       START(HTML_PRE);
+       for (;;){
+           char c = fgetc(fp);
+           if (c == (char)EOF) break;
+#ifdef NOTDEFINED
+           switch (c) {
+               case '&':
+               case '<':
+               case '>':
+                       PUTC('&');
+                       PUTC('#');
+                       PUTC((char)(c / 10));
+                       PUTC((char) (c % 10));
+                       PUTC(';');
+                       break;
+/*             case '\n':
+                       PUTC('\r');
+Bug removed thanks to address@hidden */
+               default:
+                       PUTC(c);
+           }
+#else
+           PUTC(c);
+#endif /* NOTDEFINED */
+       }
+       END(HTML_PRE);
+       HTDisplayPartial();
+       fclose(fp);
+    }
+}
+
+
 PRIVATE int print_local_dir ARGS5(
        DIR  *,                 dp,
        char *,                 localname,
@@ -1822,9 +1825,10 @@
            ABORT_TARGET;
        }
     }
+    HTFinishDisplayPartial();
     return status;  /* document loaded, maybe partial */
 }
-
+#endif /* HAVE_READDIR */


 /*     Load a document.
diff -u ./htformat.c ../htformat.c
--- ./htformat.c        Tue Apr 13 03:39:16 1999
+++ ../htformat.c       Thu Apr 15 16:23:02 1999
@@ -528,6 +528,30 @@
 #endif  /* DISP_PARTIAL */
 }

+/* Put this as early as possible, OK just after HTDisplayPartial() */
+PUBLIC void HTFinishDisplayPartial NOARGS
+{
+#ifdef DISP_PARTIAL
+                   if (display_partial) {
+                       /*
+                        *  Override Newline with a new value if user
+                        *  scrolled the document while downloading.
+                        */
+                       if (Newline_partial != Newline
+                        && NumOfLines_partial > 0)
+                           Newline = Newline_partial;
+                   }
+
+                   /*
+                    *  End of incremental rendering stage here.
+                    */
+                   display_partial = FALSE;
+                   NumOfLines_partial = -1;       /* initialize to -1 */
+                               /* -1 restrict HTDisplayPartial()   */
+                               /* until HText_new() start next HTMainText */
+                               /* and set the flag to 0  */
+#endif /* DISP_PARTIAL */
+}

 /*     Push data from a socket down a stream
 **     -------------------------------------
@@ -697,6 +721,7 @@
     rv = HT_LOADED;

 finished:
+    HTFinishDisplayPartial();
     return(rv);
 }

@@ -768,6 +793,7 @@
        }
     } /* next bufferload */

+    HTFinishDisplayPartial();
     return rv;
 }

@@ -783,6 +809,7 @@
 **
 **  Return values:
 **     HT_LOADED       All data sent.
+**     HT_INTERRUPTED  Interruption after some data read.
 **
 **  State of memory and target stream on return:
 **     always          chunk unchanged, target stream still valid.
@@ -794,6 +821,7 @@
     HTStreamClass targetClass = *(sink->isa);
     int bytes = 0;
     CONST char *data = chunk->data;
+    int rv = HT_OK;

     HTReadProgress(0, 0);
     for (;;) {
@@ -810,8 +838,20 @@
        data += n;
        HTReadProgress(bytes, 0);
        HTDisplayPartial();
+
+       if (HTCheckForInterrupt()) {
+           _HTProgress (TRANSFER_INTERRUPTED);
+           if (bytes) {
+               rv = HT_INTERRUPTED;
+           } else {
+               rv = -1;
+           }
+           break;
+       }
     }
-    return HT_LOADED;
+
+    HTFinishDisplayPartial();
+    return rv;
 }
 #endif

@@ -891,6 +931,7 @@
        }
     } /* next bufferload */

+    HTFinishDisplayPartial();
     return rv;
 }
 #endif /* USE_ZLIB */
diff -u ./htformat.h ../htformat.h
--- ./htformat.h        Tue Apr 13 03:39:16 1999
+++ ../htformat.h       Thu Apr 15 12:08:32 1999
@@ -325,10 +325,10 @@
 #include <HTChunk.h>
 /*

-HTFileCopy:  Copy a file to a stream
+HTMemCopy:  Copy a memory chunk to a stream

    This is used by the protocol engines to send data down a stream, typically 
one which
-   has been generated by HTStreamStack.  It is currently called by HTParseFile
+   has been generated by HTStreamStack.  It is currently called by HTParseMem

  */
 extern int HTMemCopy PARAMS((
diff -u ./html.c ../html.c
--- ./html.c    Tue Apr 13 03:39:16 1999
+++ ../html.c   Tue Apr 13 23:16:42 1999
@@ -49,12 +49,15 @@
 #include <LYCurses.h>
 #endif /* VMS */

+#ifdef USE_PSRC
+#include <LYPrettySrc.h>
+#endif
+
 #ifdef USE_COLOR_STYLE
 #include <SGML.h>
 #include <AttrList.h>
 #include <LYHash.h>
 #include <LYStyle.h>
-#include <LYPrettySrc.h>
 #undef SELECTED_STYLES
 #define pHText_changeStyle(X,Y,Z) {}

@@ -7703,12 +7706,12 @@
      */
     if (LYCacheSource == SOURCE_CACHE_NONE)
        return target;
-
+/*
     if (strcmp(p->name, "http") != 0) {
        CTRACE(tfp, "Protocol is \"%s\"; not caching\n", p->name);
        return target;
     }
-
+*/
     stream = (HTStream *) malloc(sizeof(*stream));
     if (!stream)
        outofmem(__FILE__, "CacheThru_new");
diff -u ./installa ../installa
--- ./installa  Tue Apr 13 03:39:16 1999
+++ ../installa Tue Apr 13 18:02:00 1999
@@ -366,7 +366,7 @@

   --enable-source-cache                        (define SOURCE_CACHE)
        Use this option to compile-in support for caching HTML pages locally,
-       in files.
+       in files or in memory.  Configurable from lynx.cfg

   --enable-syslog                      (define SYSLOG_REQUESTED_URLS)
        Use this option to log NSL requests via syslog().
diff -u ./lycharse.c ../lycharse.c
--- ./lycharse.c        Tue Apr 13 03:39:16 1999
+++ ../lycharse.c       Tue Apr 13 23:11:32 1999
@@ -396,6 +396,8 @@
 PUBLIC void HTMLSetCharacterHandling ARGS1(int,i)
 {
     int chndl = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);
+    BOOLEAN LYRawMode_flag = LYRawMode;
+    int UCLYhndl_for_unspec_flag = UCLYhndl_for_unspec;

     if (LYCharSet_UC[i].enc != UCT_ENC_CJK) {
        HTCJK = NOCJK;
@@ -483,6 +485,19 @@

     ena_csi((LYlowest_eightbit[current_char_set] > 155));

+
+    /* some diagnostics */
+    if (TRACE) {
+       if (LYRawMode_flag != LYRawMode)
+         CTRACE(tfp, "HTMLSetCharacterHandling: LYRawMode changed %s -> %s\n",
+                       (LYRawMode_flag ? "ON" : "OFF"),
+                       (LYRawMode      ? "ON" : "OFF"));
+       if (UCLYhndl_for_unspec_flag != UCLYhndl_for_unspec)
+         CTRACE(tfp, "HTMLSetCharacterHandling: UCLYhndl_for_unspec changed %d 
-> %d\n",
+                       UCLYhndl_for_unspec_flag,
+                       UCLYhndl_for_unspec);
+    }
+
     return;
 }

diff -u ./lycurses.c ../lycurses.c
--- ./lycurses.c        Tue Apr 13 03:39:16 1999
+++ ../lycurses.c       Tue Apr 13 22:35:48 1999
@@ -622,6 +622,7 @@
 }
 #endif /* USE_COLOR_TABLE */

+#ifdef NOTUSED
 #if defined (DJGPP) && !defined (USE_SLANG)
 /*
  * Sorry about making a completely new function,
@@ -660,6 +661,10 @@
     noecho();
 }
 #else
+#endif /* defined (DJGPP) && !defined (USE_SLANG) */
+#endif /* NOTUSED */
+
+
 PUBLIC void start_curses NOARGS
 {
 #ifdef USE_SLANG
@@ -758,13 +763,15 @@

 #else /* Using curses: */

+
 #ifdef VMS
     /*
      * If we are VMS then do initscr() everytime start_curses()
      * is called!
      */
     initscr(); /* start curses */
-#else /* Unix: */
+#else  /* Unix: */
+
     static BOOLEAN first_time = TRUE;

     if (first_time) {
@@ -827,7 +834,10 @@
        lynx_called_initscr = TRUE;
 #endif /* USE_COLOR_TABLE */
     }
-#endif /* VMS */
+#ifdef __DJGPP__
+    else sock_init();
+#endif /* __DJGPP__ */
+#endif /* not VMS */

     /* nonl();  */ /* seems to slow things down */

@@ -862,7 +872,7 @@

     LYCursesON = TRUE;
 }
-#endif /* defined (DJGPP) && !defined (USE_SLANG) */
+

 PUBLIC void lynx_enable_mouse ARGS1(int,state)
 {
diff -u ./lyglobal.h ../lyglobal.h
--- ./lyglobal.h        Tue Apr 13 03:39:16 1999
+++ ../lyglobal.h       Fri Apr 16 02:03:14 1999
@@ -252,6 +252,7 @@
 #ifdef SOURCE_CACHE
 extern char * source_cache_filename;
 extern HTChunk * source_cache_chunk;
+extern BOOLEAN from_source_cache; /* mutable */
 extern int LYCacheSource;
 #define SOURCE_CACHE_NONE      0
 #define SOURCE_CACHE_FILE      1
@@ -271,6 +272,8 @@
 extern int NumOfLines_partial;       /* -//- "current" number of lines */
 extern int partial_threshold;
 extern BOOLEAN debug_display_partial;  /* show with MessageSecs delay */
+extern BOOLEAN display_partial_flag; /* permanent flag, not mutable */
+extern int Newline; /* original newline position, from mainloop() */
 #endif
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
diff -u ./lyhistor.c ../lyhistor.c
--- ./lyhistor.c        Tue Apr 13 03:39:16 1999
+++ ../lyhistor.c       Thu Apr 15 15:43:46 1999
@@ -335,7 +335,6 @@
 #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);
@@ -365,7 +364,6 @@
 #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 */
     }
 }
@@ -458,6 +456,12 @@

     if ((number = atoi(newdoc->address+9)) > nhist || number < 0)
        return(FALSE);
+
+    /*
+     * Optimization: assume we came from the History Page,
+     * so never return back - always a new version next time.
+     */
+    HTuncache_current_document();  /* don't waste the cache */

     LYpop_num(number, newdoc);
     if (((newdoc->internal_link &&
diff -u ./lymain.c ../lymain.c
--- ./lymain.c  Tue Apr 13 03:39:16 1999
+++ ../lymain.c Fri Apr 16 15:20:00 1999
@@ -384,7 +384,7 @@
 PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;

 #ifdef DISP_PARTIAL
-PUBLIC BOOLEAN display_partial = TRUE; /* Display document during download */
+PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during 
download */
 PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */
 PUBLIC int partial_threshold = -1;  /* # of lines to be d/l'ed until we 
repaint */
 #endif
@@ -1257,6 +1257,14 @@
     StrAllocCopy(UCAssume_MIMEcharset,
                        LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);

+    /*
+     * Make sure we have the edit map declared. - FM
+     */
+    if (!LYEditmapDeclared()) {
+       fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
+       exit(-1);
+    }
+
 #if defined(USE_HASH)
     /*
      * If no alternate lynx-style file was specified on
@@ -1304,15 +1312,7 @@
        fclose(fp);
        style_readFromFile(lynx_lss_file);
     }
-#endif
-
-    /*
-     * Make sure we have the edit map declared. - FM
-     */
-    if (!LYEditmapDeclared()) {
-       fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
-       exit(-1);
-    }
+#endif /* USE_HASH */

 #if USE_COLOR_TABLE
     /*
@@ -1584,6 +1584,13 @@
     if (dump_output_immediately)
        LYCacheSource = SOURCE_CACHE_NONE;
 #endif
+#ifdef DISP_PARTIAL
+    /*
+     * Disable partial mode if not interactive.
+     */
+    if (dump_output_immediately)
+       display_partial_flag = FALSE;
+#endif

 #ifdef VMS
     set_vms_keys();
@@ -1782,7 +1789,8 @@
         *  mode.  Instead of calling cleanup() here, let's only call
         *  this one. - BJP
         */
-       LYStoreCookies(LYCookieFile);
+       if (persistent_cookies)
+           LYStoreCookies(LYCookieFile);
 #endif /* EXP_PERSISTENT_COOKIES */
        exit_immediately(status);
     } else {
@@ -1832,6 +1840,7 @@
     HTRegisterProtocol(&LYLynxCookies);
 }

+#ifndef NO_CONFIG_INFO
 /*
  *  Some staff to reload lynx.cfg without restarting new lynx session,
  *  also load options menu items and command-line options
@@ -1842,11 +1851,19 @@
  */
 PUBLIC void reload_read_cfg NOARGS
 {
-    if (!LYRestricted) {
+    if (LYRestricted) return;  /* for sure */
+
+    /* save .lynxrc file in case we change something from Options Menu */
+    if (!save_rc()) return;    /* can not write the very own file :( */

-       /* save .lynxrc file in case we change something from Options Menu */
-       if (!save_rc()) return;
+    {
+       /* set few safe flags: */
+#ifdef PERSISTENT_COOKIES
+       BOOLEAN persistent_cookies_flag = persistent_cookies;
+       char * LYCookieFile_flag = LYCookieFile;
+#endif

+       free_lynx_cfg(); /* free downloaders, printers, not always environments 
*/
        /*
         *  Process the configuration file.
         */
@@ -1862,13 +1879,13 @@
        /* but other things may be lost: */

        /*
-        *  Process any command line arguments not already handled. - FM
+        *  Process any command line arguments not already handled.
         */
                /* Not implemented yet here */

        /*
         *  Process any stdin-derived arguments for a lone "-"  which we've
-        *  loaded into LYStdinArgs. - FM
+        *  loaded into LYStdinArgs.
         */
                /* Not implemented yet here */

@@ -1877,11 +1894,23 @@
         */
                /* Not implemented yet here,
                 * a major problem: file paths
-                * like lynx_temp_space, LYCookieFile etc.
+                * like lynx_save_space, LYCookieFile etc.
                 */
+#ifdef PERSISTENT_COOKIES
+       /* restore old settings */
+        if (persistent_cookies != persistent_cookies_flag) {
+            persistent_cookies = persistent_cookies_flag;
+            HTAlert(gettext("persistent cookies state will be changed in next 
session only."));
+        }
+        if (strcmp(LYCookieFile, LYCookieFile_flag)) {
+            StrAllocCopy(LYCookieFile, LYCookieFile_flag);
+            CTRACE(tfp, "cookies file can be changed in next session only, 
restored.\n")
+        }
+#endif

     }
 }
+#endif /* !NO_CONFIG_INFO */


 /* There are different ways of setting arguments on the command line, and
@@ -1913,13 +1942,13 @@
 #ifdef  PARSE_DEBUG
 #define ParseData BOOLEAN *set_value; int *int_value; char **str_value; 
ParseFunc fun_value
 #define PARSE_SET(n,t,v,h) {n,t,    v,  0,  0,  0,    h}
-#define PARSE_INT(n,t,v,h) {n,t,    0, &v,  0,  0,    h}
+#define PARSE_INT(n,t,v,h) {n,t,    0,  v,  0,  0,    h}
 #define PARSE_STR(n,t,v,h) {n,t,    0,  0,  v,  0,    h}
 #define PARSE_FUN(n,t,v,h) {n,t,    0,  0,  0,  v,    h}
 #else
 #define ParseData long value
 #define PARSE_SET(n,t,v,h) {n,t,   (long) (v),        h}
-#define PARSE_INT(n,t,v,h) {n,t,   (long)&(v),        h}
+#define PARSE_INT(n,t,v,h) {n,t,   (long) (v),        h}
 #define PARSE_STR(n,t,v,h) {n,t,   (long) (v),        h}
 #define PARSE_FUN(n,t,v,h) {n,t,   (long) (v),        h}
 #endif
@@ -2751,7 +2780,7 @@
       "toggles inclusion of ISMAP links when client-side\nMAPs are present"
    ),
    PARSE_INT(
-      "link",          NEED_INT_ARG,           ccount,
+      "link",          NEED_INT_ARG,           &ccount,
       "=NUMBER\nstarting count for lnk#.dat files produced by -crawl"
    ),
    PARSE_SET(
@@ -2838,11 +2867,11 @@
    ),
 #ifdef DISP_PARTIAL
    PARSE_SET(
-      "partial",       TOGGLE_ARG,             &display_partial,
+      "partial",       TOGGLE_ARG,             &display_partial_flag,
       "toggles display partial pages while downloading"
    ),
    PARSE_INT(
-      "partial_thres",  IGNORE_ARG|INT_ARG,     partial_threshold,
+      "partial_thres",  NEED_INT_ARG,          &partial_threshold,
       "[=NUMBER]\nnumber of lines to render before repainting display\n\
 with partial-display logic"
    ),
@@ -2862,7 +2891,7 @@
    PARSE_SET(
       "preparsed",     SET_ARG,                &LYPreparsedSource,
       "show parsed text/html with -source and in source view\n\
-       to visualize how lynx behaves with invalid HTML"
+to visualize how lynx behaves with invalid HTML"
    ),
 #ifdef USE_PSRC
    PARSE_SET(
diff -u ./lymainlo.c ../lymainlo.c
--- ./lymainlo.c        Tue Apr 13 03:39:16 1999
+++ ../lymainlo.c       Sat Apr 17 20:39:48 1999
@@ -85,16 +85,17 @@

 #ifdef DISP_PARTIAL
 PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
-PUBLIC int NumOfLines_partial = -1; /* required for display_partial mode */
+PUBLIC int NumOfLines_partial = -1; /* initialize to -1 the very first time */
+PUBLIC BOOLEAN display_partial = FALSE;
+PUBLIC int Newline = 0;
+#else
+PRIVATE int Newline = 0;
 #endif

 PRIVATE document newdoc;
 PRIVATE document curdoc;
 PRIVATE char *traversal_host = NULL;
 PRIVATE char *traversal_link_to_add = NULL;
-PRIVATE char *CurrentUserAgent = NULL;
-PRIVATE char *CurrentNegoLanguage = NULL;
-PRIVATE char *CurrentNegoCharset = NULL;

 #ifdef LY_FIND_LEAKS
 /*
@@ -118,9 +119,6 @@
 #endif
     FREE(traversal_host);
     FREE(traversal_link_to_add);
-    FREE(CurrentUserAgent);
-    FREE(CurrentNegoLanguage);
-    FREE(CurrentNegoCharset);
 #ifdef DIRED_SUPPORT
     clear_tags();
 #endif /* DIRED_SUPPORT */
@@ -234,8 +232,6 @@
     int cmd = LYK_DO_NOTHING, real_cmd = LYK_DO_NOTHING;
     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     
*/
@@ -250,22 +246,8 @@
     BOOLEAN rlink_allowed;
     BOOLEAN vi_keys_flag = vi_keys;
     BOOLEAN emacs_keys_flag = emacs_keys;
-    BOOLEAN LYRawMode_flag = LYRawMode;
-#ifndef NO_OPTION_MENU
-    BOOLEAN LYSelectPopups_flag = LYSelectPopups;
-    BOOLEAN verbose_img_flag = verbose_img;
-    BOOLEAN keypad_mode_flag = keypad_mode;
-    BOOLEAN show_dotfiles_flag = show_dotfiles;
-    BOOLEAN user_mode_flag = user_mode;
-    int CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
-    int CurrentCharSet_flag = current_char_set;
-    int HTfileSortMethod_flag = HTfileSortMethod;
-#endif
     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;
@@ -312,12 +294,6 @@
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
     *prev_target = '\0';
     *user_input_buffer = '\0';
-    StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
-                                   LYUserAgent : ""));
-    StrAllocCopy(CurrentNegoLanguage, (language ?
-                                      language : ""));
-    StrAllocCopy(CurrentNegoCharset, (pref_charset ?
-                                     pref_charset : ""));
 #ifdef LY_FIND_LEAKS
     atexit(free_mainloop_variables);
 #endif
@@ -544,14 +520,10 @@
                    LYPermitURL = TRUE;
                }

+               Newline = newdoc.line; /* bypass for partial mode */
 #ifdef DISP_PARTIAL
-               display_partial = display_partial_flag; /* restore */
-               Newline_partial = newdoc.line; /* initialize */
-               NumOfLines_partial = -1;       /* initialize to -1 */
-                               /* -1 restrict HTDisplayPartial()   */
-                               /* until HText_new() start new HTMainText */
-                               /* and set the flag to 0  */
-               if (display_partial) {
+                   display_partial = display_partial_flag;  /* restore */
+                   Newline_partial = Newline;  /* initialize */
                    /*
                     * Disable display_partial if requested URL has #fragment
                     * and we are not popped from the history stack
@@ -561,10 +533,8 @@
                     * completed, but only if s/he did not mess screen up by
                     * scrolling before...  So fall down to old behavior here.
                     */
-                   if (!LYCursesON ||
-                              (Newline_partial == 1 && strchr(newdoc.address, 
'#')))
+                   if (Newline_partial == 1 && strchr(newdoc.address, '#'))
                        display_partial = FALSE;
-               }
 #endif /* DISP_PARTIAL */
 #ifdef USE_PSRC
                psrc_first_tag = TRUE;
@@ -990,6 +960,7 @@
                        newdoc.line = curdoc.line;
                        newdoc.link = curdoc.link;
                        newdoc.internal_link = FALSE; /* can't be true. - kw */
+                       Newline = newdoc.line; /* now here, no partial mode */
                    }

                    /*
@@ -997,23 +968,9 @@
                     *  line the user was on if s/he has been in the file
                     *  before, or it is 1 if this is a new file.
                     */
-                   Newline = newdoc.line;
-#ifdef DISP_PARTIAL
-                   if (display_partial) {
-                       /*
-                        *  Override newdoc.line with a new value if user
-                        *  scrolled the document while downloading.
-                        */
-                       if (Newline_partial != newdoc.line
-                        && NumOfLines_partial > 0)
-                           Newline = Newline_partial;
-
-                       /*
-                        *  End of incremental rendering stage here.
-                        */
-                       display_partial = FALSE;
-                   }
-#endif /* DISP_PARTIAL */
+                   /* Newline = newdoc.line; */
+                   /* - alreary set and probably updated in partial mode */
+                   /*  End of incremental rendering stage here. */

                    /*
                     *  If we are going to a target line or
@@ -1144,7 +1101,6 @@
              */
             Newline = www_search_result;
             www_search_result = -1;  /* reset */
-            more = HText_canScrollDown();
        }

        if (first_file == TRUE) {
@@ -1260,23 +1216,47 @@
 #ifdef SOURCE_CACHE
        /*
         * If the parse settings have changed since this HText was
-        * generated, we need to reparse and redraw it.
+        * generated, we need to reparse and redraw it.  -dsb
         */
        if (HTdocument_settings_changed()) {
            HTUserMsg(gettext("Reparsing document under current settings..."));
-           if (HTreparse_document())
-               refresh_screen = TRUE;
+           if (HTreparse_document()) {}
            else {
                /*
                 * Urk.  I have no idea how to recover from a failure here.
-                * At a guess, I'll try reloading.
+                * At a guess, I'll try reloading.  -dsb
                 */
                cmd = LYK_RELOAD;
                goto new_cmd;
            }
        }
+
+       /*
+        *  Trying to accomodate HTreparse_document() logic
+        *  with mainloop events. Set all the necessaty flags here...
+        */
+       if (from_source_cache) {
+               from_source_cache = FALSE; /* reset */
+
+                   /*
+                    *  Make sure curdoc.line will not be equal
+                    *  to Newline, so we get a redraw.
+                    */
+                   curdoc.line = -1;
+
+           /*
+            * This information can get clobbered if we go to an internal
+            * page while viewing source.  Normally it would be recreated
+            * by reloading the file; we have to do it ourselves.  -dsb
+            */
+           if (curdoc.link < 0 && nlinks > 0)
+               curdoc.link = 0;
+
+               refresh_screen = TRUE; /* ? */
+       }
 #endif

+
        /*
         *  If the curdoc.line is different than Newline then there must
         *  have been a change since last update.  Run HText_pageDisplay()
@@ -1292,13 +1272,12 @@
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
              showtags(tagged);
 #endif /* DIRED_SUPPORT */
+
            /*
-            *  If more equals TRUE, then there is more
-            *  info below this page .
+            *  If more equals TRUE, then there is more info below this page.
             */
            more = HText_canScrollDown();
            curdoc.line = Newline = HText_getTopOfScreen()+1;
-           lines_in_file = HText_getNumOfLines();

            if (curdoc.title == NULL) {
                /*
@@ -1358,6 +1337,12 @@
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
                showtags(tagged);
 #endif /* DIRED_SUPPORT */
+
+           /*
+            *  If more equals TRUE, then there is more info below this page.
+            */
+           more = HText_canScrollDown();
+
            if (user_mode == NOVICE_MODE)
                noviceline(more);  /* print help message */
            refresh_screen = FALSE;
@@ -1671,7 +1656,6 @@
                                      links[curdoc.link+1].form->name) != 
0)))))) {

                        HText_ExpandTextarea (&links[curdoc.link], 1);
-                       lines_in_file = HText_getNumOfLines();

                        if (links[curdoc.link].ly < display_lines) {
                            refresh_screen = TRUE;
@@ -2109,7 +2093,25 @@
 #endif
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
+               /*
+                * These normally get cleaned up after getfile() returns;
+                * since we're not calling getfile(), we have to clean them
+                * up ourselves.  -dsb
+                */
+               HTOutputFormat = WWW_PRESENT;
+#ifdef USE_PSRC
+               if (psrc_view)
+                   HTMark_asSource();
+               psrc_view = FALSE;
+#endif
+               /*
+                * Set the remaining document elements.
+                */
+               if (ownerS_address != NULL) {
+                   if (!HText_getOwner())
+                       HText_setMainTextOwner(ownerS_address);
+                   FREE(ownerS_address);
+               }
                break;
            }
 #endif
@@ -2219,7 +2221,6 @@
            }
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
            HTuncache_current_document();
@@ -2265,7 +2266,6 @@
            }
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
            HTuncache_current_document();
@@ -2304,7 +2304,6 @@
                      SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF);
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
            HTuncache_current_document();
@@ -2364,7 +2363,6 @@
            HTUserMsg(Old_DTD ? USING_DTD_0 : USING_DTD_1);
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
            HTuncache_current_document();
@@ -2512,7 +2510,7 @@

        case LYK_END:
            if (more) {
-              Newline = lines_in_file - display_lines + 3;  /* go to end of 
file */
+              Newline = HText_getNumOfLines() - display_lines + 3;  /* go to 
end of file */
               arrowup = TRUE;   /* position on last link */
            } else {
                cmd = LYK_NEXT_PAGE;
@@ -4020,8 +4018,26 @@
 #endif /* DIRED_SUPPORT */
 #ifndef NO_OPTION_MENU
 if (!LYUseFormsOptions) {
+           BOOLEAN LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
+           BOOLEAN LYSelectPopups_flag = LYSelectPopups;
+           BOOLEAN verbose_img_flag = verbose_img;
+           BOOLEAN keypad_mode_flag = keypad_mode;
+           BOOLEAN show_dotfiles_flag = show_dotfiles;
+           BOOLEAN user_mode_flag = user_mode;
+           int CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
+           int CurrentCharSet_flag = current_char_set;
+           int HTfileSortMethod_flag = HTfileSortMethod;
+           char *CurrentUserAgent = NULL;
+           char *CurrentNegoLanguage = NULL;
+           char *CurrentNegoCharset = NULL;
+           StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
+                                           LYUserAgent : ""));
+           StrAllocCopy(CurrentNegoLanguage, (language ?
+                                              language : ""));
+           StrAllocCopy(CurrentNegoCharset, (pref_charset ?
+                                             pref_charset : ""));

-           LYoptions(); /* do the old-style options stuff */
+           LYoptions(); /** do the old-style options stuff **/

            if (keypad_mode_flag != keypad_mode ||
                (user_mode_flag != user_mode &&
@@ -4037,7 +4053,7 @@
                CurrentCharSet_flag != current_char_set ||
                CurrentAssumeCharSet_flag != UCLYhndl_for_unspec ||
                verbose_img_flag != verbose_img ||
-               LYRawMode_flag != LYRawMode ||
+               LYUseDefaultRawMode_flag != LYUseDefaultRawMode ||
                LYSelectPopups_flag != LYSelectPopups ||
                ((strcmp(CurrentUserAgent, (LYUserAgent ?
                                            LYUserAgent : "")) ||
@@ -4080,11 +4096,8 @@
                         */
                        reloading = TRUE;
                    }
-                   if (lynx_mode == FORMS_LYNX_MODE) {
-                       HTAlert(RELOADING_FORM);
-                   }
                    if (HTisDocumentSource()) {
-#ifndef PSRC_VIEW
+#ifndef USE_PSRC
                        HTOutputFormat = WWW_SOURCE;
 #else
                        if (LYpsrc)
@@ -4093,6 +4106,25 @@
                            HTOutputFormat = WWW_SOURCE;
 #endif
                    }
+#ifdef SOURCE_CACHE
+                   if (reloading == FALSE) {
+                       /* one more attempt to be smart enough: */
+                       if (HTreparse_document()) {
+                           FREE(CurrentUserAgent);
+                           FREE(CurrentNegoLanguage);
+                           FREE(CurrentNegoCharset);
+                           break;
+                       }
+                   }
+#endif
+                   if (lynx_mode == FORMS_LYNX_MODE) {
+                       /*
+                        *  Note that if there are no form links on the current
+                        *  page, lynx_mode won't have this setting and we won't
+                        *  know that this warning should be issued. - FM
+                        */
+                       HTAlert(RELOADING_FORM);
+                   }
                    HEAD_request = HTLoadedDocumentIsHEAD();
                    HTuncache_current_document();
 #ifdef NO_ASSUME_SAME_DOC
@@ -4106,21 +4138,9 @@
                    FREE(curdoc.address); /* So it doesn't get pushed. */
                }
            }
-           keypad_mode_flag = keypad_mode;
-           user_mode_flag = user_mode;
-           HTfileSortMethod_flag = HTfileSortMethod;
-           CurrentCharSet_flag = current_char_set;
-           CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
-           show_dotfiles_flag = show_dotfiles;
-           verbose_img_flag = verbose_img;
-           LYRawMode_flag = LYRawMode;
-           LYSelectPopups_flag = LYSelectPopups;
-           StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
-                                           LYUserAgent : ""));
-           StrAllocCopy(CurrentNegoLanguage, (language ?
-                                              language : ""));
-           StrAllocCopy(CurrentNegoCharset, (pref_charset ?
-                                             pref_charset : ""));
+           FREE(CurrentUserAgent);
+           FREE(CurrentNegoLanguage);
+           FREE(CurrentNegoCharset);
            refresh_screen = TRUE; /* to repaint screen */
            break;
 } /* end if !LYUseFormsOptions */
@@ -4145,7 +4165,6 @@
                newdoc.safe = FALSE;
                if (check_realm)
                    LYPermitURL = TRUE;
-               refresh_screen = TRUE;  /* redisplay */

                /*
                 * FIXME:  this was a temporary solution until we find the
@@ -4153,7 +4172,7 @@
                 * before the 'options menu' only when (few) important options
                 * were changed.
                 */
-/*            HTuncache_current_document(); */
+               /* HTuncache_current_document(); */
            }
 #endif /* !NO_OPTION_FORMS */
            break;
@@ -4656,7 +4675,7 @@
             */
            if (strcmp((curdoc.title ? curdoc.title : ""),
                       SHOWINFO_TITLE)) {
-               if (showinfo(&curdoc, lines_in_file,
+               if (showinfo(&curdoc, HText_getNumOfLines(),
                              &newdoc, owner_address) < 0)
                    break;
                StrAllocCopy(newdoc.title, SHOWINFO_TITLE);
@@ -4698,8 +4717,6 @@

                n = HText_ExtEditForm (&links[curdoc.link]);

-               lines_in_file = HText_getNumOfLines();
-
                /*
                 *  TODO: Move cursor "n" lines from the current line to
                 *        position it on the 1st trailing blank line in
@@ -4731,7 +4748,6 @@

                HText_ExpandTextarea (&links[curdoc.link], 
TEXTAREA_EXPAND_SIZE);

-               lines_in_file  = HText_getNumOfLines();
                refresh_screen = TRUE;

            } else {
@@ -4749,8 +4765,6 @@

                n = HText_InsertFile (&links[curdoc.link]);

-               lines_in_file = HText_getNumOfLines();
-
                /*
                 *  TODO: Move cursor "n" lines from the current line to
                 *        position it on the 1st line following the text
@@ -4788,7 +4802,7 @@
                       PRINT_OPTIONS_TITLE)) {

                if (print_options(&newdoc.address,
-                               &curdoc.address, lines_in_file) < 0)
+                               &curdoc.address, HText_getNumOfLines()) < 0)
                    break;
                StrAllocCopy(newdoc.title, PRINT_OPTIONS_TITLE);
                FREE(newdoc.post_data);
@@ -5594,7 +5608,6 @@
                     CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF);
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
 #endif
@@ -5611,7 +5624,6 @@
                      PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF);
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
-               refresh_screen = TRUE;
                break;
            }
 #endif
@@ -5626,10 +5638,8 @@
                LYUseDefaultRawMode = !LYUseDefaultRawMode;
                HTUserMsg(LYRawMode ? RAWMODE_OFF : RAWMODE_ON);
                HTMLSetCharacterHandling(current_char_set);
-               LYRawMode_flag = LYRawMode;
 #ifdef SOURCE_CACHE
                if (HTreparse_document()) {
-                   refresh_screen = TRUE;
                    break;
                }
 #endif
diff -u ./lyoption.c ../lyoption.c
--- ./lyoption.c        Tue Mar 30 10:10:38 1999
+++ ../lyoption.c       Sat Apr 17 18:38:48 1999
@@ -21,6 +21,7 @@
 #include <GridText.h>
 #include <LYGetFile.h>
 #include <LYReadCFG.h>
+#include <LYPrettySrc.h>

 #include <LYLeaks.h>

@@ -3911,6 +3912,7 @@

     /*
      *  Exit: working around the previous document.
+     *  Being out of mainloop()/getfile() cycle, do things manually.
      */
     CTRACE(tfp, "\nLYOptions.c/postoptions(): exiting...\n");

@@ -3935,6 +3937,7 @@
     if (!HTLoadAbsolute(&WWWDoc))
        return(NOT_FOUND);

+    HTuncache_current_document(); /* will never used again */

     /*
      *  Return to previous doc, not to options menu!
@@ -3982,16 +3985,49 @@
        need_reload = TRUE;
     }

-    if (need_reload == TRUE) {
+    if (need_reload == FALSE) {
+       /*  no uncache, already loaded */
+       CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
+       return(NORMAL);
+    } else {
        /*  update HText cache */
+
+       /*
+        *  Check to see if should reload source, or load html
+        *  (from LYK_RELOAD & LYK_OPTIONS)
+        */
+       if (HTisDocumentSource()) {
+#ifndef USE_PSRC
+           HTOutputFormat = WWW_SOURCE;
+#else
+           if (LYpsrc)
+               psrc_view = TRUE;
+           else
+               HTOutputFormat = WWW_SOURCE;
+#endif
+       }
+       if (lynx_mode == FORMS_LYNX_MODE) {
+           /* Sorry! lynx_mode set according the last display_page() state,
+            * it always in form mode since we came from form-based option menu
+            * so the information from mainloop() apperently lost.
+            * reset here until we learn how to do it properly.
+            */
+           lynx_mode = NORMAL_LYNX_MODE;
+       }
+#ifdef SOURCE_CACHE
+       if (reloading == FALSE) {
+           /* one more attempt to be smart enough: */
+           if (HTreparse_document()) {
+               CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
+               return(NORMAL);
+           }
+       }
+#endif
+       HEAD_request = HTLoadedDocumentIsHEAD();
        HTuncache_current_document();
        LYpush(newdoc, FALSE);
        CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
        return(NULLFILE);
-    } else {
-       /*  no uncache, already loaded */
-       CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n");
-       return(NORMAL);
     }
 }

diff -u ./lyreadcf.c ../lyreadcf.c
--- ./lyreadcf.c        Tue Apr 13 03:39:16 1999
+++ ../lyreadcf.c       Fri Apr 16 15:43:08 1999
@@ -76,7 +76,6 @@
     return NULL;
 }

-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the DOWNLOADER and UPLOADER menus list. - FM
  */
@@ -121,7 +120,6 @@

     return;
 }
-#endif /* LY_FIND_LEAKS */

 /*
  *  Process string buffer fields for DOWNLOADER or UPLOADER menus.
@@ -201,7 +199,6 @@
 }


-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the PRINTER menus list. - FM
  */
@@ -221,7 +218,6 @@

     return;
 }
-#endif /* LY_FIND_LEAKS */

 /*
  *  Process string buffer fields for PRINTER menus.
@@ -1121,7 +1117,7 @@
      PARSE_SET("no_referer_header", CONF_BOOL, &LYNoRefererHeader),
      PARSE_FUN("outgoing_mail_charset", CONF_FUN, outgoing_mail_charset_fun),
 #ifdef DISP_PARTIAL
-     PARSE_SET("partial", CONF_BOOL, &display_partial),
+     PARSE_SET("partial", CONF_BOOL, &display_partial_flag),
      PARSE_INT("partial_thres", CONF_INT, &partial_threshold),
 #endif
 #ifdef EXP_PERSISTENT_COOKIES
@@ -1206,12 +1202,17 @@
            if (q->str_value != 0) {
                FREE(*(q->str_value));
                FREE(q->str_value);
+               /* is it enough for reload_read_cfg() to clean up
+                * the result of putenv()?  No for certain platforms.
+                */
            }
            break;
        default:
            break;
        }
     }
+    free_item_list();
+    free_printer_item_list();
 }

 /*
@@ -1541,7 +1542,7 @@
        /*
         *  Some staff to reload read_cfg(),
         *  but also load options menu items and command-line options
-        *  to made things consistent.  Not implemented yet. Dummy.
+        *  to made things consistent.  Implemented in LYMain.c
         */
        reload_read_cfg();

@@ -1572,6 +1573,7 @@
        if (!HTLoadAbsolute(&WWWDoc))
            return(NOT_FOUND);

+       HTuncache_current_document();  /* will never used again */

        /*  now set up the flag and fall down to create a new LYNXCFG:/ page */
        local_url = 0;  /* see below */
diff -u ./sgml.c ../sgml.c
--- ./sgml.c    Tue Apr 13 03:39:16 1999
+++ ../sgml.c   Tue Apr 13 18:49:50 1999
@@ -34,6 +34,8 @@

 #ifdef USE_COLOR_STYLE
 # include <LYStyle.h>
+#endif
+#ifdef USE_PSRC
 # include <LYPrettySrc.h>
 #endif

@@ -187,7 +189,7 @@
 static BOOL seen_letter_in_junk_tag;

 PRIVATE void HTMLSRC_apply_markup ARGS3(
-           HTStream*,        context,
+           HTStream *,       context,
            HTlexem,          lexem,
            BOOL,             start)
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]