lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev 2.8.1rel.2 patches (long)


From: Klaus Weide
Subject: lynx-dev 2.8.1rel.2 patches (long)
Date: Sat, 14 Nov 1998 20:42:55 -0600 (CST)

Hello all,

 I have just re-subscribed to the list, after some time away..
I see lynx dev is alive and well, and has made progress, in spite of the
somewhat (hmm...) messy code I left behind. (Sorry Leonid and others..
it probably wasn't much fun cleaning up the chartrans stuff.)

 I have downloaded 2.8.1rel.2 and played with it.  I especially like the
partial display stuff.

 There are some problems I found, among them:
- When a longer piece of text is to be highlighted/underlined, like
  
     <P>
     <I>some text that is so
     long that it will occupy
     several lines when
     displayed</I>,</P>

   the underlining is lost after the first or second line. (I am surprised
   nobody noticed this?)
- When long lines are split in SOURCE display, and a search target is
  highlighted on one of the continuation lines, the display is wrong.
- There are many memory leaks.  Not good if you want to keep lynx running
  for days.  Developers and testers should compile with --enable-find-leaks
  once in a while, and check Lynx.leaks after running lynx.
There are patches for these and some other problems below.  (I am sure
there are more leaks.)

   -----

In LYCharUtils.c there is a comment:

    /*
     * FIXME: something's wrong with the limit checks here (clearing the
     * buffer helps).
     */
    memset(replace_buf, 0, sizeof(replace_buf));

Is there any known test case to reproduce the problem?

   -----

 Let me know if there are questions about my past code contributions.
(No, I haven't read all the archives, only some recent messages.)

  Klaus


--------------------------------------------------------------------------
Note: patches are against Lynx Version 2.8.1rel.2

Bugs:
DefaultStyle.c
GridText.c
HTML.c
LYBookmark.c
LYDownload.c
LYMain.c
LYReadCFG.c
LYShowInfo.c
UCdomap.c
* Include LYLeaks.h in UCdomap.c for memory leak detection.
* Fixed various memory leaks (UCdomap.c, LYShowInfo.c, LYReadCFG.c,
  LYMain.c, LYDownload.c, LYBookmark.c, HTML.c, DefaultStyle.c).
* Escape '&' and '<' in HTML generated to display current lynx.cfg
  option values (LYReadCFG.c).
* Revert logic in split_line.  Emphasis highlighting that should
  extend over several lines was being lost at line breaks (GridText.c).
  (IsSpecialAttrChar probably shouldn't return true for LY_SOFT_NEWLINE
  since in most places it tests whether to skip a character position,
  but as long as this special char is only used in SOURCE mode it
  cannot mess up any anchor positions so it should be ok.)
* Correct character counting in SOURCE display continuation lines.
  A highlighted search target would be shown shifted left by one
  character position because the LY_SOFT_NEWLINE special was displayed
  as '+' but not counted (GridText.c).
* Prevent generation of invalid/unparseable comments if
  UCSaveBookmarksInUnicode is in effect, other minor changes in
  LYBookmark.c.
* Correction for color styles in HText_appendCharacter (GridText.c).
  At some point a memmove was replaced by a for loop, but source and
  destination were reversed and the counter was wrong.

Should-have improvements:
GridText.c
HTInit.c
LYBookmark.c
* When adding bookmark entries, don't accept a title string which
  appears to consist only of blank characters (LYBookmark.c).  When
  rendering a bookmark file, use hiddenlinks=merge counting, so that
  numbers after entries with empty titles don't get out of whack
  (GridText.c).  This should prevent 'R' from removing the wrong
  bookmark entry.
* Prevent generation of some unnecessary temp files when constructing
  mailcap file test commands (HTInit.c).

Minimal tweaks:
GridText.c
HTAnchor.c
HTFile.c
* Check for 'z'ap while constructing local directory listings (non-VMS
  only, in HTFile.c).
* Added a couple outofmem checks (HTAnchor.c).
  Minor TRACE message change in GridText.c for -tlog / USE_TRACE_LOG
  disabled.

Minor enhancements:
GridText.c
HTAnchor.c
* Don't trim trailing and leading spaces from unformatted text lines
  in some cases (split_line in GridText.c).  Prevents corruption of
  some uuencoded files when they are displayed and then 'P'rinted
  (although 'D'ownload should be used instead).
* Some changes in HText_appendCharacter (GridText.c).  Splitting of
  long SOURCE lines now works with color styles.
* Workaround for multiple anchors in the same (invalid) HTML document
  with the same NAME and different destinations (HTAnchor.c).

*** lynx2-8-1.orig/src/UCdomap.c        Thu Sep 17 05:43:48 1998
--- lynx2-8-1/src/UCdomap.c     Sat Nov 14 19:34:25 1998
***************
*** 25,30 ****
--- 25,32 ----
  #include <LYCharSets.h>
  #include <LYStrings.h>
  
+ #include <LYLeaks.h>
+ 
  /*
   *  Include tables & parameters.
   */
***************
*** 1512,1532 ****
  {
    int i;
    int LYhndl = -1;
!   char *UC_MIMEcharset = NULL;
  
      if (!value || !(*value)) {
        CTRACE(tfp, "UCGetLYhndl_byMIME: NULL argument instead of MIME 
name.\n");
        return -1;
      }
  
-     StrAllocCopy(UC_MIMEcharset, value);
-     LYLowerCase(UC_MIMEcharset);
- 
      for (i = 0;
         (i < MAXCHARSETS && i < LYNumCharsets &&
          LYchar_set_names[i]); i++) {
        if (LYCharSet_UC[i].MIMEname &&
!           !strcmp(UC_MIMEcharset, LYCharSet_UC[i].MIMEname)) {
            return i;
        }
      }
--- 1514,1531 ----
  {
    int i;
    int LYhndl = -1;
!   CONST char *UC_MIMEcharset = value;
  
      if (!value || !(*value)) {
        CTRACE(tfp, "UCGetLYhndl_byMIME: NULL argument instead of MIME 
name.\n");
        return -1;
      }
  
      for (i = 0;
         (i < MAXCHARSETS && i < LYNumCharsets &&
          LYchar_set_names[i]); i++) {
        if (LYCharSet_UC[i].MIMEname &&
!           !strcasecomp(UC_MIMEcharset, LYCharSet_UC[i].MIMEname)) {
            return i;
        }
      }
***************
*** 1534,1595 ****
        /*
         *  Not yet found, try synonyms. - FM
         */
!       if (!strcmp(UC_MIMEcharset, "unicode-1-1-utf-8") ||
!           !strcmp(UC_MIMEcharset, "utf8")) {
            /*
             *  Treat these as synonyms for the IANA registered name. - FM
             */
            return UCGetLYhndl_byMIME("utf-8");
        }
!       if (!strncmp(UC_MIMEcharset, "iso-2022-jp", 11) ||
!           !strcmp(UC_MIMEcharset, "x-euc-jp")) {
            return UCGetLYhndl_byMIME("euc-jp");
        }
!       if (!strcmp(UC_MIMEcharset, "x-shift-jis")) {
            return UCGetLYhndl_byMIME("shift_jis");
        }
!       if (!strcmp(UC_MIMEcharset, "iso-2022-kr")) {
            return UCGetLYhndl_byMIME("euc-kr");
        }
!       if (!strcmp(UC_MIMEcharset, "gb2312") ||
!           !strncmp(UC_MIMEcharset, "cn-gb", 5) ||
!           !strcmp(UC_MIMEcharset, "iso-2022-cn")) {
            return UCGetLYhndl_byMIME("euc-cn");
        }
!       if (!strcmp(UC_MIMEcharset, "cn-big5")) {
            return UCGetLYhndl_byMIME("big5");
        }
!       if (!strcmp(UC_MIMEcharset, "x-mac-roman") ||
!           !strcmp(UC_MIMEcharset, "mac-roman")) {
            return UCGetLYhndl_byMIME("macintosh");
        }
!       if (!strcmp(UC_MIMEcharset, "x-next") ||
!           !strcmp(UC_MIMEcharset, "nextstep") ||
!           !strcmp(UC_MIMEcharset, "x-nextstep")) {
            return UCGetLYhndl_byMIME("next");
        }
!       if (!strcmp(UC_MIMEcharset, "iso-8859-1-windows-3.1-latin-1") ||
!           !strcmp(UC_MIMEcharset, "cp1252") ||
!           !strcmp(UC_MIMEcharset, "cp-1252") ||
!           !strcmp(UC_MIMEcharset, "ibm1252") ||
!           !strcmp(UC_MIMEcharset, "iso-8859-1-windows-3.0-latin-1")) {
            /*
             *  Treat these as synonyms for windows-1252, which is more
             *  commonly used than the IANA registered name. - FM
             */
            return UCGetLYhndl_byMIME("windows-1252");
        }
!       if (!strcmp(UC_MIMEcharset, "iso-8859-2-windows-latin-2") ||
!           !strcmp(UC_MIMEcharset, "cp1250") ||
!           !strcmp(UC_MIMEcharset, "cp-1250") ||
!           !strcmp(UC_MIMEcharset, "ibm1250")) {
            /*
             *  Treat these as synonyms for windows-1250. - FM
             */
            return UCGetLYhndl_byMIME("windows-1250");
        }
!       if ((!strncmp(UC_MIMEcharset, "ibm", 3) ||
!            !strncmp(UC_MIMEcharset, "cp-", 3)) &&
            isdigit((unsigned char)UC_MIMEcharset[3]) &&
            isdigit((unsigned char)UC_MIMEcharset[4]) &&
            isdigit((unsigned char)UC_MIMEcharset[5])) {
--- 1533,1594 ----
        /*
         *  Not yet found, try synonyms. - FM
         */
!       if (!strcasecomp(UC_MIMEcharset, "unicode-1-1-utf-8") ||
!           !strcasecomp(UC_MIMEcharset, "utf8")) {
            /*
             *  Treat these as synonyms for the IANA registered name. - FM
             */
            return UCGetLYhndl_byMIME("utf-8");
        }
!       if (!strncasecomp(UC_MIMEcharset, "iso-2022-jp", 11) ||
!           !strcasecomp(UC_MIMEcharset, "x-euc-jp")) {
            return UCGetLYhndl_byMIME("euc-jp");
        }
!       if (!strcasecomp(UC_MIMEcharset, "x-shift-jis")) {
            return UCGetLYhndl_byMIME("shift_jis");
        }
!       if (!strcasecomp(UC_MIMEcharset, "iso-2022-kr")) {
            return UCGetLYhndl_byMIME("euc-kr");
        }
!       if (!strcasecomp(UC_MIMEcharset, "gb2312") ||
!           !strncasecomp(UC_MIMEcharset, "cn-gb", 5) ||
!           !strcasecomp(UC_MIMEcharset, "iso-2022-cn")) {
            return UCGetLYhndl_byMIME("euc-cn");
        }
!       if (!strcasecomp(UC_MIMEcharset, "cn-big5")) {
            return UCGetLYhndl_byMIME("big5");
        }
!       if (!strcasecomp(UC_MIMEcharset, "x-mac-roman") ||
!           !strcasecomp(UC_MIMEcharset, "mac-roman")) {
            return UCGetLYhndl_byMIME("macintosh");
        }
!       if (!strcasecomp(UC_MIMEcharset, "x-next") ||
!           !strcasecomp(UC_MIMEcharset, "nextstep") ||
!           !strcasecomp(UC_MIMEcharset, "x-nextstep")) {
            return UCGetLYhndl_byMIME("next");
        }
!       if (!strcasecomp(UC_MIMEcharset, "iso-8859-1-windows-3.1-latin-1") ||
!           !strcasecomp(UC_MIMEcharset, "cp1252") ||
!           !strcasecomp(UC_MIMEcharset, "cp-1252") ||
!           !strcasecomp(UC_MIMEcharset, "ibm1252") ||
!           !strcasecomp(UC_MIMEcharset, "iso-8859-1-windows-3.0-latin-1")) {
            /*
             *  Treat these as synonyms for windows-1252, which is more
             *  commonly used than the IANA registered name. - FM
             */
            return UCGetLYhndl_byMIME("windows-1252");
        }
!       if (!strcasecomp(UC_MIMEcharset, "iso-8859-2-windows-latin-2") ||
!           !strcasecomp(UC_MIMEcharset, "cp1250") ||
!           !strcasecomp(UC_MIMEcharset, "cp-1250") ||
!           !strcasecomp(UC_MIMEcharset, "ibm1250")) {
            /*
             *  Treat these as synonyms for windows-1250. - FM
             */
            return UCGetLYhndl_byMIME("windows-1250");
        }
!       if ((!strncasecomp(UC_MIMEcharset, "ibm", 3) ||
!            !strncasecomp(UC_MIMEcharset, "cp-", 3)) &&
            isdigit((unsigned char)UC_MIMEcharset[3]) &&
            isdigit((unsigned char)UC_MIMEcharset[4]) &&
            isdigit((unsigned char)UC_MIMEcharset[5])) {
***************
*** 1615,1621 ****
            FREE(cptmp);
            return LYhndl;
        }
!       if (!strncmp(UC_MIMEcharset, "windows-", 8) &&
            isdigit((unsigned char)UC_MIMEcharset[8]) &&
            isdigit((unsigned char)UC_MIMEcharset[9]) &&
            isdigit((unsigned char)UC_MIMEcharset[10])) {
--- 1614,1620 ----
            FREE(cptmp);
            return LYhndl;
        }
!       if (!strncasecomp(UC_MIMEcharset, "windows-", 8) &&
            isdigit((unsigned char)UC_MIMEcharset[8]) &&
            isdigit((unsigned char)UC_MIMEcharset[9]) &&
            isdigit((unsigned char)UC_MIMEcharset[10])) {
***************
*** 1631,1637 ****
            FREE(cptmp);
            return LYhndl;
        }
!       if (!strcmp(UC_MIMEcharset, "koi-8")) { /* accentsoft bugosity */
          return UCGetLYhndl_byMIME("koi8-r");
        }
      }
--- 1630,1636 ----
            FREE(cptmp);
            return LYhndl;
        }
!       if (!strcasecomp(UC_MIMEcharset, "koi-8")) { /* accentsoft bugosity */
          return UCGetLYhndl_byMIME("koi8-r");
        }
      }
*** lynx2-8-1.orig/src/HTML.c   Sat Oct 17 16:20:41 1998
--- lynx2-8-1/src/HTML.c        Sat Nov 14 19:34:25 1998
***************
*** 78,91 ****
      /* .... */
  };
  
! PRIVATE HTStyleSheet * styleSheet;    /* Application-wide */
  
  /*    Module-wide style cache
  */
  PRIVATE HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles  */
                                           /* and 3 header alignment styles */
                                           /* and 3 div alignment styles    */
! PRIVATE HTStyle *default_style;
  
  PUBLIC char *LYToolbarName = "LynxPseudoToolbar";
  
--- 78,91 ----
      /* .... */
  };
  
! PRIVATE HTStyleSheet * styleSheet = NULL;     /* Application-wide */
  
  /*    Module-wide style cache
  */
  PRIVATE HTStyle *styles[HTML_ELEMENTS+31]; /* adding 24 nested list styles  */
                                           /* and 3 header alignment styles */
                                           /* and 3 div alignment styles    */
! PRIVATE HTStyle *default_style = NULL;
  
  PUBLIC char *LYToolbarName = "LynxPseudoToolbar";
  
***************
*** 2735,2744 ****
                if (*alt_string == '\0') {
                    if (map_href) {
                        StrAllocCopy(alt_string, (title ? title :
!                                    MakeNewMapValue(value,"USEMAP")));
                    } else if (dest_ismap) {
                        StrAllocCopy(alt_string, (title ? title :
!                                    MakeNewMapValue(value,"ISMAP")));
  
                    } else if (me->inA == TRUE && dest) {
                        StrAllocCopy(alt_string, (title ?
--- 2735,2746 ----
                if (*alt_string == '\0') {
                    if (map_href) {
                        StrAllocCopy(alt_string, (title ? title :
!                                    (temp = MakeNewMapValue(value,"USEMAP"))));
!                       FREE(temp);
                    } else if (dest_ismap) {
                        StrAllocCopy(alt_string, (title ? title :
!                                    (temp = MakeNewMapValue(value,"ISMAP"))));
!                       FREE(temp);
  
                    } else if (me->inA == TRUE && dest) {
                        StrAllocCopy(alt_string, (title ?
***************
*** 2758,2769 ****
  
        } else if (map_href) {
            StrAllocCopy(alt_string, (title ? title :
!                                     MakeNewMapValue(value,"USEMAP")));
  
        } else if ((dest_ismap == TRUE) ||
                   (me->inA && present && present[HTML_IMG_ISMAP])) {
            StrAllocCopy(alt_string, (title ? title :
!                                     MakeNewMapValue(value,"ISMAP")));
  
        } else if (me->inA == TRUE && dest) {
            StrAllocCopy(alt_string, (title ?
--- 2760,2773 ----
  
        } else if (map_href) {
            StrAllocCopy(alt_string, (title ? title :
!                                     (temp = 
MakeNewMapValue(value,"USEMAP"))));
!           FREE(temp);
  
        } else if ((dest_ismap == TRUE) ||
                   (me->inA && present && present[HTML_IMG_ISMAP])) {
            StrAllocCopy(alt_string, (title ? title :
!                                     (temp = MakeNewMapValue(value,"ISMAP"))));
!           FREE(temp);
  
        } else if (me->inA == TRUE && dest) {
            StrAllocCopy(alt_string, (title ?
***************
*** 2782,2788 ****
                                          title : ""));
        }
        if (*alt_string == '\0' && map_href) {
!           StrAllocCopy(alt_string, MakeNewMapValue(value,"USEMAP"));
        }
  
        CTRACE(tfp, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n",
--- 2786,2793 ----
                                          title : ""));
        }
        if (*alt_string == '\0' && map_href) {
!           StrAllocCopy(alt_string, (temp = MakeNewMapValue(value,"USEMAP")));
!           FREE(temp);
        }
  
        CTRACE(tfp, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n",
***************
*** 2844,2850 ****
                    if (dest_ismap) {
                        HTML_put_character(me, ' ');
                        me->in_word = NO;
!                       HTML_put_string(me, MakeNewMapValue(value,"ISMAP"));
                    } else if (dest) {
                        HTML_put_character(me, ' ');
                        me->in_word = NO;
--- 2849,2856 ----
                    if (dest_ismap) {
                        HTML_put_character(me, ' ');
                        me->in_word = NO;
!                       HTML_put_string(me, (temp = 
MakeNewMapValue(value,"ISMAP")));
!                       FREE(temp);
                    } else if (dest) {
                        HTML_put_character(me, ' ');
                        me->in_word = NO;
***************
*** 2900,2905 ****
--- 2906,2912 ----
                HText_endAnchor(me->text, me->CurrentANum);
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
+               FREE(newtitle);
                StrAllocCopy(alt_string,
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
***************
*** 2956,2961 ****
--- 2963,2969 ----
                HText_endAnchor(me->text, me->CurrentANum);
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
+               FREE(newtitle);
                StrAllocCopy(alt_string,
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
***************
*** 3012,3018 ****
                if (dest_ismap) {
                    HTML_put_character(me, ' ');/* space char may be ignored */
                    me->in_word = NO;
!                   HTML_put_string(me, MakeNewMapValue(value,"ISMAP"));
                } else if (dest) {
                    HTML_put_character(me, ' ');/* space char may be ignored */
                    me->in_word = NO;
--- 3020,3027 ----
                if (dest_ismap) {
                    HTML_put_character(me, ' ');/* space char may be ignored */
                    me->in_word = NO;
!                   HTML_put_string(me, (temp = 
MakeNewMapValue(value,"ISMAP")));
!                   FREE(temp);
                } else if (dest) {
                    HTML_put_character(me, ' ');/* space char may be ignored */
                    me->in_word = NO;
***************
*** 4398,4404 ****
                 *  We have a TYPE="image" with a non-zero-length SRC
                 *  attribute and want clickable images.  Make the
                 *  SRC's value a link if it's still not zero-length
!                *  legitiimizing it. - FM
                 */
                url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
                if (*href) {
--- 4407,4413 ----
                 *  We have a TYPE="image" with a non-zero-length SRC
                 *  attribute and want clickable images.  Make the
                 *  SRC's value a link if it's still not zero-length
!                *  legitimizing it. - FM
                 */
                url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
                if (*href) {
***************
*** 4436,4441 ****
--- 4445,4451 ----
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
                    HTML_put_string(me, 
VERBOSE_IMG(value,HTML_INPUT_SRC,"[IMAGE]"));
+                   FREE(newtitle);
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
                    HText_endAnchor(me->text, 0);
***************
*** 4687,4692 ****
--- 4697,4703 ----
                }
            }
            HText_setIgnoreExcess(me->text, FALSE);
+           FREE(ImageSrc);
            FREE(I_value);
            FREE(I_name);
        }
*** lynx2-8-1.orig/src/LYReadCFG.c      Sat Oct 24 11:49:07 1998
--- lynx2-8-1/src/LYReadCFG.c   Sat Nov 14 19:34:25 1998
***************
*** 7,12 ****
--- 7,13 ----
  #include <LYStructs.h>
  #include <LYGlobalDefs.h>
  #include <LYCharSets.h>
+ #include <LYCharUtils.h>
  #include <LYKeymap.h>
  #include <LYJump.h>
  #include <LYGetFile.h>
***************
*** 969,974 ****
--- 970,977 ----
       {0}
  };
  
+ PRIVATE char *local_url = NULL;
+ 
  /*
   * Free memory allocated in 'read_cfg()'
   */
***************
*** 993,998 ****
--- 996,1002 ----
            break;
        }
      }
+     FREE(local_url);
  }
  
  /*
***************
*** 1191,1198 ****
            break;
  #endif
        default:
!           if (fp0 != 0)
!               fprintf(fp0, "%s:%s\n", name, value);
            break;
        }
      }
--- 1195,1211 ----
            break;
  #endif
        default:
!           if (fp0 != 0) {
!               if (strchr(value, '&') || strchr(value, '<')) {
!                   char *cp1 = NULL;
!                   StrAllocCopy(cp1, value);
!                   LYEntify(&cp1, TRUE);
!                   fprintf(fp0, "%s:%s\n", name, cp1);
!                   FREE(cp1);
!               } else {
!                   fprintf(fp0, "%s:%s\n", name, value);
!               }
!           }
            break;
        }
      }
***************
*** 1238,1244 ****
   */
  PUBLIC char *lynx_cfg_infopage NOARGS
  {
-     static char *local_url;
      char tempfile[LY_MAXPATH];
      char *temp = 0;
      FILE *fp0;
--- 1251,1256 ----
*** lynx2-8-1.orig/src/DefaultStyle.c   Thu Aug  6 07:28:22 1998
--- lynx2-8-1/src/DefaultStyle.c        Sat Nov 14 19:34:25 1998
***************
*** 363,371 ****
  PRIVATE HTStyleSheet sheet = { "default.style",
                                &HTStyleHeadingRight }; /* sheet */
  
  PUBLIC HTStyleSheet * DefaultStyle NOARGS
  {
-     static HTStyleSheet *result;
      HTStyle *p, *q;
  
      /*
--- 363,383 ----
  PRIVATE HTStyleSheet sheet = { "default.style",
                                &HTStyleHeadingRight }; /* sheet */
  
+ 
+ PRIVATE HTStyleSheet *result = NULL;
+ 
+ PRIVATE void FreeDefaultStyle NOARGS
+ {
+     HTStyle * style;
+     while((style=result->styles)!=0) {
+       result->styles = style->next;
+       FREE(style);
+     }
+     FREE(result);
+ }
+ 
  PUBLIC HTStyleSheet * DefaultStyle NOARGS
  {
      HTStyle *p, *q;
  
      /*
***************
*** 378,383 ****
--- 390,396 ----
        result = HTStyleSheetNew ();
        *result = sheet;
        result->styles = 0;
+       atexit(FreeDefaultStyle);
        for (p = sheet.styles; p != 0; p = p->next) {
            q = HTStyleNew ();
            *q = *p;
***************
*** 389,397 ****
                p != 0 && q != 0;
                p = p->next, q = q->next) {
            HTStyle *r = p->next;
-           HTStyle temp;
-           temp = *p;
-           temp.next = q->next;
            *p = *q;
            p->next = r;
        }
--- 402,407 ----
*** lynx2-8-1.orig/src/LYMain.c Sat Oct 24 11:49:07 1998
--- lynx2-8-1/src/LYMain.c      Sat Nov 14 19:34:25 1998
***************
*** 75,81 ****
  #endif /* VMS */
  
  #ifndef VMS
! PUBLIC char *lynx_version_putenv_command = NULL;
  PUBLIC char *list_format = NULL;      /* LONG_LIST formatting mask */
  #ifdef SYSLOG_REQUESTED_URLS
  PUBLIC char *syslog_txt = NULL;       /* syslog arb text for session */
--- 75,81 ----
  #endif /* VMS */
  
  #ifndef VMS
! PRIVATE char *lynx_version_putenv_command = NULL;
  PUBLIC char *list_format = NULL;      /* LONG_LIST formatting mask */
  #ifdef SYSLOG_REQUESTED_URLS
  PUBLIC char *syslog_txt = NULL;       /* syslog arb text for session */
***************
*** 486,495 ****
--- 486,503 ----
      FREE(URLDomainSuffixes);
      FREE(XLoadImageCommand);
      FREE(LYTraceLogPath);
+     FREE(lynx_cfg_file);
  #if defined(USE_HASH)
      FREE(lynx_lss_file);
  #endif
      FREE(UCAssume_MIMEcharset);
+     {
+       char *p = LYlist_temp_url();
+       if (p && *p) {
+           *p = '\0';
+           FREE(p);
+       }
+     }
      for (i = 0; i < nlinks; i++) {
        FREE(links[i].lname);
      }
***************
*** 696,701 ****
--- 704,710 ----
      StrAllocCopy(lynx_version_putenv_command, "LYNX_VERSION=");
      StrAllocCat(lynx_version_putenv_command, LYNX_VERSION);
      putenv(lynx_version_putenv_command);
+     FREE(lynx_version_putenv_command);
  #endif /* VMS */
  
      if ((cp = getenv("LYNX_TEMP_SPACE")) != NULL)
*** lynx2-8-1.orig/src/LYShowInfo.c     Sat Oct 17 16:20:41 1998
--- lynx2-8-1/src/LYShowInfo.c  Sat Nov 14 19:34:25 1998
***************
*** 82,88 ****
        char *,         owner_address)
  {
      static char tempfile[LY_MAXPATH];
-     static char *info_url;
      int url_type;
      FILE *fp0;
      char *Address = NULL, *Title = NULL;
--- 82,87 ----
***************
*** 101,112 ****
        return(-1);
      }
  
-     LYLocalFileToURL(&info_url, tempfile);
  
      /*
       *        Point the address pointer at this Url
       */
!     StrAllocCopy(newdoc->address, info_url);
  
      if (nlinks > 0 && links[doc->link].lname != NULL &&
        (url_type = is_url(links[doc->link].lname)) != 0 &&
--- 100,111 ----
        return(-1);
      }
  
  
      /*
       *        Point the address pointer at this Url
       */
!     LYLocalFileToURL(&newdoc->address, tempfile);
!     
  
      if (nlinks > 0 && links[doc->link].lname != NULL &&
        (url_type = is_url(links[doc->link].lname)) != 0 &&
*** lynx2-8-1.orig/src/GridText.c       Wed Oct 14 07:23:56 1998
--- lynx2-8-1/src/GridText.c    Sat Nov 14 19:34:25 1998
***************
*** 464,472 ****
      /*
       *  If we are going to render the List Page, always merge in hidden
       *  links to get the numbering consistent if form fields are numbered
!      *  and show up as hidden links in the list of links. - kw
       */
!     if (anchor->address && !strcmp(anchor->address, LYlist_temp_url()))
        self->hiddenlinkflag = HIDDENLINKS_MERGE;
      else
        self->hiddenlinkflag = LYHiddenLinks;
--- 464,477 ----
      /*
       *  If we are going to render the List Page, always merge in hidden
       *  links to get the numbering consistent if form fields are numbered
!      *  and show up as hidden links in the list of links.
!      *  If we are going to render a bookmark file, also always merge in
!      *        hidden links, to get the link numbers consistent with the 
counting
!      *  in remove_bookmark_link().  Normally a bookmark file shouldn't
!      *        contain any entries with empty titles, but it might happen. - kw
       */
!     if (anchor->bookmark ||
!       (anchor->address && !strcmp(anchor->address, LYlist_temp_url())))
        self->hiddenlinkflag = HIDDENLINKS_MERGE;
      else
        self->hiddenlinkflag = LYHiddenLinks;
***************
*** 1208,1214 ****
                for (;
                     written < len && (tmp[0] = data[itmp]) != '\0';
                     itmp++)  {
!                   if (IsSpecialAttrChar(tmp[0])) {
                        /*
                         *  Ignore special characters.
                         */
--- 1213,1219 ----
                for (;
                     written < len && (tmp[0] = data[itmp]) != '\0';
                     itmp++)  {
!                   if (IsSpecialAttrChar(tmp[0]) && tmp[0] != LY_SOFT_NEWLINE) 
{
                        /*
                         *  Ignore special characters.
                         */
***************
*** 1714,1721 ****
      if (line->numstyles > 0 && line->numstyles < MAX_STYLES_ON_LINE) {
        int n;
        inew ++;
!       for (n = line->numstyles; n >= 0; n--)
!               line->styles[n + inew] = line->styles[n];
      } else
        if (line->numstyles == 0)
        /* FIXME: RJP - shouldn't use 0xffffffff for largest integer */
--- 1719,1726 ----
      if (line->numstyles > 0 && line->numstyles < MAX_STYLES_ON_LINE) {
        int n;
        inew ++;
!       for (n = 0; n < line->numstyles; n++)
!               line->styles[n] = line->styles[n + inew];
      } else
        if (line->numstyles == 0)
        /* FIXME: RJP - shouldn't use 0xffffffff for largest integer */
***************
*** 1754,1760 ****
      if (split > 0) {  /* Delete space at "split" splitting line */
        char *p, *prevdata = previous->data, *linedata = line->data;
        unsigned plen;
!       unsigned i;
  
        /*
         *  Split the line. - FM
--- 1759,1765 ----
      if (split > 0) {  /* Delete space at "split" splitting line */
        char *p, *prevdata = previous->data, *linedata = line->data;
        unsigned plen;
!       int i;
  
        /*
         *  Split the line. - FM
***************
*** 1767,1773 ****
         *  of our new line. - FM
         */
        p = prevdata + split;
!       while (*p == ' ' || *p == LY_SOFT_HYPHEN) {
            p++;
            HeadTrim++;
        }
--- 1772,1784 ----
         *  of our new line. - FM
         */
        p = prevdata + split;
!       while ((*p == ' ' &&
!               (HeadTrim || text->first_anchor ||
!                underline_on || bold_on ||
!                text->style->alignment != HT_LEFT ||
!                text->style->wordWrap || text->style->freeFormat ||
!                text->style->spaceBefore || text->style->spaceAfter)) ||
!              *p == LY_SOFT_HYPHEN) {
            p++;
            HeadTrim++;
        }
***************
*** 1782,1788 ****
             */
            underline_on = NO;
            if (split) {
!               for (i = (split-1); i != 0; i--) {
                    if (prevdata[i] == LY_UNDERLINE_END_CHAR) {
                        break;
                    }
--- 1793,1799 ----
             */
            underline_on = NO;
            if (split) {
!               for (i = (split-1); i >= 0; i--) {
                    if (prevdata[i] == LY_UNDERLINE_END_CHAR) {
                        break;
                    }
***************
*** 1802,1808 ****
                SpecialAttrChars++;
            }
            if (plen) {
!               for (i = (plen - 1); i != 0; i--) {
                    if (p[i] == LY_UNDERLINE_START_CHAR) {
                        underline_on = YES;
                        break;
--- 1813,1819 ----
                SpecialAttrChars++;
            }
            if (plen) {
!               for (i = (plen - 1); i >= 0; i--) {
                    if (p[i] == LY_UNDERLINE_START_CHAR) {
                        underline_on = YES;
                        break;
***************
*** 1812,1818 ****
                        break;
                    }
                }
!               for (i = (plen - 1); i != 0; i--) {
                    if (p[i] == LY_UNDERLINE_START_CHAR ||
                        p[i] == LY_UNDERLINE_END_CHAR) {
                        ctrl_chars_on_this_line++;
--- 1823,1829 ----
                        break;
                    }
                }
!               for (i = (plen - 1); i >= 0; i--) {
                    if (p[i] == LY_UNDERLINE_START_CHAR ||
                        p[i] == LY_UNDERLINE_END_CHAR) {
                        ctrl_chars_on_this_line++;
***************
*** 1827,1833 ****
         */
        bold_on = NO;
        if (split) {
!           for (i = (split - 1); i != 0; i--) {
                if (prevdata[i] == LY_BOLD_END_CHAR) {
                    break;
                }
--- 1838,1844 ----
         */
        bold_on = NO;
        if (split) {
!           for (i = (split - 1); i >= 0; i--) {
                if (prevdata[i] == LY_BOLD_END_CHAR) {
                    break;
                }
***************
*** 1845,1854 ****
            linedata[line->size] = '\0';
            ctrl_chars_on_this_line++;
            SpecialAttrChars++;;
!       } else
!           bold_on = OFF;
        if (plen) {
!           for (i = (plen - 1); i != 0; i--) {
                if (p[i] == LY_BOLD_START_CHAR) {
                    bold_on = YES;
                    break;
--- 1856,1864 ----
            linedata[line->size] = '\0';
            ctrl_chars_on_this_line++;
            SpecialAttrChars++;;
!       }
        if (plen) {
!           for (i = (plen - 1); i >= 0; i--) {
                if (p[i] == LY_BOLD_START_CHAR) {
                    bold_on = YES;
                    break;
***************
*** 1858,1871 ****
                    break;
                }
            }
!           for (i = (plen - 1); i != 0; i--) {
                if (p[i] == LY_BOLD_START_CHAR ||
                    p[i] == LY_BOLD_END_CHAR ||
                    IS_UTF_EXTRA(p[i]) ||
                    p[i] == LY_SOFT_HYPHEN) {
                    ctrl_chars_on_this_line++;
                }
!               if (p[i] == LY_SOFT_HYPHEN && text->permissible_split < i) {
                    text->permissible_split = i + 1;
                }
            }
--- 1868,1881 ----
                    break;
                }
            }
!           for (i = (plen - 1); i >= 0; i--) {
                if (p[i] == LY_BOLD_START_CHAR ||
                    p[i] == LY_BOLD_END_CHAR ||
                    IS_UTF_EXTRA(p[i]) ||
                    p[i] == LY_SOFT_HYPHEN) {
                    ctrl_chars_on_this_line++;
                }
!               if (p[i] == LY_SOFT_HYPHEN && (int)text->permissible_split < i) 
{
                    text->permissible_split = i + 1;
                }
            }
***************
*** 1882,1888 ****
       *  Economize on space.
       */
      while ((previous->size > 0) &&
!       (previous->data[previous->size-1] == ' ')) {
        /*
         *  Strip trailers.
         */
--- 1892,1903 ----
       *  Economize on space.
       */
      while ((previous->size > 0) &&
!          (previous->data[previous->size-1] == ' ') &&
!          (ctrl_chars_on_this_line || HeadTrim || text->first_anchor ||
!           underline_on || bold_on ||
!           text->style->alignment != HT_LEFT ||
!           text->style->wordWrap || text->style->freeFormat ||
!           text->style->spaceBefore || text->style->spaceAfter)) {
        /*
         *  Strip trailers.
         */
***************
*** 1908,1930 ****
      /*
       *  Align left, right or center.
       */
!     for (cp = previous->data; *cp; cp++) {
!       if (*cp == LY_UNDERLINE_START_CHAR ||
!           *cp == LY_UNDERLINE_END_CHAR ||
!           *cp == LY_BOLD_START_CHAR ||
!           *cp == LY_BOLD_END_CHAR ||
!           IS_UTF_EXTRA(*cp) ||
!           *cp == LY_SOFT_HYPHEN)
!           ctrl_chars_on_previous_line++;
!     }
!     /* @@ first line indent */
!     spare =  (LYcols-1) -
!               (int)style->rightIndent - indent +
!               ctrl_chars_on_previous_line - previous->size -
!               ((previous->size > 0) &&
!                (int)(previous->data[previous->size-1] ==
!                                           LY_SOFT_HYPHEN ?
!                                                        1 : 0));
  
      switch (style->alignment) {
        case HT_CENTER :
--- 1923,1950 ----
      /*
       *  Align left, right or center.
       */
!     spare = 0;
!     if (style->alignment == HT_CENTER ||
!       style->alignment == HT_RIGHT) {
!       /* Calculate spare character positions if needed */
!       for (cp = previous->data; *cp; cp++) {
!           if (*cp == LY_UNDERLINE_START_CHAR ||
!               *cp == LY_UNDERLINE_END_CHAR ||
!               *cp == LY_BOLD_START_CHAR ||
!               *cp == LY_BOLD_END_CHAR ||
!               IS_UTF_EXTRA(*cp) ||
!               *cp == LY_SOFT_HYPHEN)
!               ctrl_chars_on_previous_line++;
!       }
!       /* @@ first line indent */
!       spare =  (LYcols-1) -
!           (int)style->rightIndent - indent +
!           ctrl_chars_on_previous_line - previous->size -
!           ((previous->size > 0) &&
!            (int)(previous->data[previous->size-1] ==
!                  LY_SOFT_HYPHEN ?
!                  1 : 0));
!     }
  
      switch (style->alignment) {
        case HT_CENTER :
***************
*** 2280,2286 ****
        return;
      }
  
!     if (IsSpecialAttrChar(ch)) {
  #ifndef USE_COLOR_STYLE
        if (line->size >= (MAX_LINE-1)) return;
        if (ch == LY_UNDERLINE_START_CHAR) {
--- 2300,2306 ----
        return;
      }
  
!     if (IsSpecialAttrChar(ch) && ch != LY_SOFT_NEWLINE) {
  #ifndef USE_COLOR_STYLE
        if (line->size >= (MAX_LINE-1)) return;
        if (ch == LY_UNDERLINE_START_CHAR) {
***************
*** 2309,2319 ****
            bold_on = OFF;
            ctrl_chars_on_this_line++;
            return;
-       } else if (ch == LY_SOFT_NEWLINE) {
-           line->data[line->size++] = LY_SOFT_NEWLINE;
-           line->data[line->size] = '\0';
-           ctrl_chars_on_this_line++;
-           return;
        } else if (ch == LY_SOFT_HYPHEN) {
            int i;
  
--- 2329,2334 ----
***************
*** 2341,2346 ****
--- 2356,2365 ----
  #else
        return;
  #endif
+     } else if (ch == LY_SOFT_NEWLINE) {
+       line->data[line->size++] = LY_SOFT_NEWLINE;
+       line->data[line->size] = '\0';
+       return;
      }
  
      if (IS_UTF_EXTRA(ch)) {
***************
*** 4064,4070 ****
        int,            line_num,
        char *,         target)
  {
!     CTRACE(tfp, "GridText: HText_pageDisplay at line %d started\n", line_num);
  
  #ifdef DISP_PARTIAL
      if (display_partial && detected_forms_input_partial) {
--- 4083,4091 ----
        int,            line_num,
        char *,         target)
  {
!     if (debug_display_partial || (LYTraceLogFP != NULL)) {
!       CTRACE(tfp, "GridText: HText_pageDisplay at line %d started\n", 
line_num);
!     }
  
  #ifdef DISP_PARTIAL
      if (display_partial && detected_forms_input_partial) {
***************
*** 4091,4097 ****
  
      is_www_index = HTAnchor_isIndex(HTMainAnchor);
  
!     CTRACE(tfp, "GridText: HText_pageDisplay finished\n");
  }
  
  /*
--- 4112,4120 ----
  
      is_www_index = HTAnchor_isIndex(HTMainAnchor);
  
!     if (debug_display_partial || (LYTraceLogFP != NULL)) {
!       CTRACE(tfp, "GridText: HText_pageDisplay finished\n");
!     }
  }
  
  /*
*** lynx2-8-1.orig/src/HTInit.c Thu Sep 17 05:43:48 1998
--- lynx2-8-1/src/HTInit.c      Sat Nov 14 19:34:25 1998
***************
*** 532,540 ****
      /*
       *  Build the command and execute it.
       */
!     if (LYOpenTemp(TmpFileName, HTML_SUFFIX, "w") == 0)
!       ExitWithError(CANNOT_OPEN_TEMP);
!     LYCloseTemp(TmpFileName);
      cmd = (char *)malloc(1024);
      if (!cmd)
        ExitWithError("Out of memory");
--- 532,545 ----
      /*
       *  Build the command and execute it.
       */
!     if (strchr(mc->testcommand, '%')) {
!       if (LYOpenTemp(TmpFileName, HTML_SUFFIX, "w") == 0)
!           ExitWithError(CANNOT_OPEN_TEMP);
!       LYCloseTemp(TmpFileName);
!     } else {
!       /* We normally don't need a temp file name - kw */
!       TmpFileName[0] = '\0';
!     }
      cmd = (char *)malloc(1024);
      if (!cmd)
        ExitWithError("Out of memory");
***************
*** 545,551 ****
      CTRACE(tfp, "PassesTest: Executing test command: %s\n", cmd);
      result = LYSystem(cmd);
      FREE(cmd);
!     LYRemoveTemp(TmpFileName);
  
      /*
       *  Free the test command as well since
--- 550,557 ----
      CTRACE(tfp, "PassesTest: Executing test command: %s\n", cmd);
      result = LYSystem(cmd);
      FREE(cmd);
!     if (TmpFileName[0])
!       LYRemoveTemp(TmpFileName);
  
      /*
       *  Free the test command as well since
*** lynx2-8-1.orig/src/LYDownload.c     Wed Oct 14 07:23:56 1998
--- lynx2-8-1/src/LYDownload.c  Sat Nov 14 19:34:25 1998
***************
*** 608,613 ****
--- 608,614 ----
      fprintf(fp0, "\
    <em>Downloaded link:</em> %s\n",
        downloaded_url);
+     FREE(downloaded_url);
  
      fprintf(fp0, "\
    <em>Suggested file name:</em> %s\n",
*** lynx2-8-1.orig/src/LYBookmark.c     Wed Oct 14 07:23:56 1998
--- lynx2-8-1/src/LYBookmark.c  Sat Nov 14 19:34:25 1998
***************
*** 7,12 ****
--- 7,13 ----
  #include <LYSignal.h>
  #include <LYKeymap.h>
  #include <LYCharUtils.h> /* need for META charset */
+ #include <UCAux.h>
  #include <LYCharSets.h>  /* need for LYHaveCJKCharacterSet */
  #include <LYCurses.h>
  #include <GridText.h>
***************
*** 171,178 ****
      return(newfile);
  }
  
! PRIVATE  BOOLEAN have8bit PARAMS((char *Title));
! PRIVATE  char* title_convert8bit PARAMS((char *Title));
  
  /*
   *  Adds a link to a bookmark file, creating the file
--- 172,180 ----
      return(newfile);
  }
  
! PRIVATE  BOOLEAN havevisible PARAMS((CONST char *Title));
! PRIVATE  BOOLEAN have8bit PARAMS((CONST char *Title));
! PRIVATE  char* title_convert8bit PARAMS((CONST char *Title));
  
  /*
   *  Adds a link to a bookmark file, creating the file
***************
*** 260,275 ****
       *        Allow user to change the title. - FM
       */
      string_buffer[255] = '\0';
!     LYstrncpy(string_buffer, title, 255);
!     convert_to_spaces(string_buffer, FALSE);
!     LYMBM_statusline(TITLE_PROMPT);
!     LYgetstr(string_buffer, VISIBLE, sizeof(string_buffer), NORECALL);
!     if (*string_buffer == '\0') {
!       LYMBM_statusline(CANCELLED);
!       sleep(MessageSecs);
!       FREE(bookmark_URL);
!       return;
!     }
  
      /*
       *        Create the Title with any left-angle-brackets
--- 262,279 ----
       *        Allow user to change the title. - FM
       */
      string_buffer[255] = '\0';
!     do {
!       LYstrncpy(string_buffer, title, 255);
!       convert_to_spaces(string_buffer, FALSE);
!       LYMBM_statusline(TITLE_PROMPT);
!       LYgetstr(string_buffer, VISIBLE, sizeof(string_buffer), NORECALL);
!       if (*string_buffer == '\0') {
!           LYMBM_statusline(CANCELLED);
!           sleep(MessageSecs);
!           FREE(bookmark_URL);
!           return;
!       }
!     } while(!havevisible(string_buffer));
  
      /*
       *        Create the Title with any left-angle-brackets
***************
*** 283,290 ****
      StrAllocCopy(Title, string_buffer);
      LYEntify(&Title, TRUE);
      if (UCSaveBookmarksInUnicode &&
!               have8bit(Title) && (!LYHaveCJKCharacterSet))
!       StrAllocCopy(Title, title_convert8bit(Title));
  
      /*
       *        Create the bookmark file, if it doesn't exist already,
--- 287,297 ----
      StrAllocCopy(Title, string_buffer);
      LYEntify(&Title, TRUE);
      if (UCSaveBookmarksInUnicode &&
!       have8bit(Title) && (!LYHaveCJKCharacterSet)) {
!       char *p = title_convert8bit(Title);
!       FREE(Title);
!       Title = p;
!     }
  
      /*
       *        Create the bookmark file, if it doesn't exist already,
***************
*** 877,885 ****
  }
  
  /*
   * Check whether string have 8 bit chars.
   */
! PRIVATE  BOOLEAN have8bit ARGS1(char *, Title)
  {
      CONST char *p = Title;
  
--- 884,921 ----
  }
  
  /*
+  * Check whether we have any visible (non-blank) chars.
+  */
+ PRIVATE  BOOLEAN havevisible ARGS1(CONST char *, Title)
+ {
+     CONST char *p = Title;
+     unsigned char c;
+     long unicode;
+ 
+     for ( ; *p; p++) {
+       c = (unsigned char)(TOASCII(*p));
+       if (c > 32 && c < 127)
+           return(TRUE);
+       if (c <= 32 || c == 127)
+           continue;
+       if (LYHaveCJKCharacterSet || !UCCanUniTranslateFrom(current_char_set))
+           return(TRUE);
+       unicode = UCTransToUni(*p, current_char_set);
+       if (unicode > 32 && unicode < 127)
+           return(TRUE);
+       if (c <= 32 || (c >= 127 && c <= 160) || c == 0xad)
+           continue;
+       if (unicode >= 0x2000 && unicode < 0x200f)
+           continue;
+       return(TRUE);
+     }
+     return(FALSE); /* if we came here */
+ }
+ 
+ /*
   * Check whether string have 8 bit chars.
   */
! PRIVATE  BOOLEAN have8bit ARGS1(CONST char *, Title)
  {
      CONST char *p = Title;
  
***************
*** 909,922 ****
   *  Older versions fail.
   *
   */
! PRIVATE  char* title_convert8bit ARGS1(char *, Title)
  {
      CONST char *p = Title;
      char temp[256];
      char *q = temp;
      char *comment = NULL;
      char *ncr     = NULL;
      char *buf = NULL;
  
      for ( ; *p; p++) {
        LYstrncpy(q, p, 1);
--- 945,961 ----
   *  Older versions fail.
   *
   */
! PRIVATE  char* title_convert8bit ARGS1(CONST char *, Title)
  {
      CONST char *p = Title;
      char temp[256];
+     char *p0;
      char *q = temp;
      char *comment = NULL;
      char *ncr     = NULL;
      char *buf = NULL;
+     int charset_in  = current_char_set;
+     int charset_out = -1;
  
      for ( ; *p; p++) {
        LYstrncpy(q, p, 1);
***************
*** 924,935 ****
            StrAllocCat(comment, q);
            StrAllocCat(ncr, q);
        } else {
!       int charset_in, charset_out, uck;
        long unicode;
        char replace_buf [10], replace_buf2 [10];
  
!       charset_in  = current_char_set;
!       charset_out = UCGetLYhndl_byMIME("us-ascii");
  
        uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q,
                              charset_in, charset_out, YES);
--- 963,974 ----
            StrAllocCat(comment, q);
            StrAllocCat(ncr, q);
        } else {
!       int uck;
        long unicode;
        char replace_buf [10], replace_buf2 [10];
  
!       if (charset_out < 0)
!           charset_out = UCGetLYhndl_byMIME("us-ascii");
  
        uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q,
                              charset_in, charset_out, YES);
***************
*** 946,951 ****
--- 985,1003 ----
      }
  
      /*
+      *  Cleanup comment, collapse multiple dashes into one dash,
+      *  skip '>'.
+      */
+     for (q = p0 = comment; *p0; p0++) {
+       if ((unsigned char)(TOASCII(*p0)) >= 32 &&
+           *p0 != '>' &&
+           (q == comment || *p0 != '-' || *(q-1) != '-')) {
+           *q++ = *p0;
+       }
+     }
+     *q = '\0';
+ 
+     /*
       * valid bookmark should be a single line (no linebreaks!).
       */
      StrAllocCat(buf, "<!-- ");
***************
*** 953,957 ****
--- 1005,1011 ----
      StrAllocCat(buf, " -->");
      StrAllocCat(buf, ncr);
  
+     FREE(comment);
+     FREE(ncr);
      return(buf);
  }
*** lynx2-8-1.orig/WWW/Library/Implementation/HTAnchor.c        Sun Sep 13 
09:35:55 1998
--- lynx2-8-1/WWW/Library/Implementation/HTAnchor.c     Sat Nov 14 19:35:03 1998
***************
*** 68,73 ****
--- 68,75 ----
  {
      HTParentAnchor *newAnchor =
         (HTParentAnchor *)calloc(1, sizeof(HTParentAnchor));  /* zero-filled */
+     if (newAnchor == NULL)
+       outofmem(__FILE__, "HTParentAnchor_new");
      newAnchor->parent = newAnchor;
      newAnchor->bookmark = NULL;       /* Bookmark filename. - FM */
      newAnchor->isISMAPScript = FALSE; /* Lynx appends ?0,0 if TRUE. - FM */
***************
*** 194,199 ****
--- 196,203 ----
      }
  
      child = HTChildAnchor_new();
+     if (child == NULL)
+       outofmem(__FILE__, "HTChildAnchor_new");
      CTRACE(tfp, "new Anchor %p named `%s' is child of %p\n",
                (void *)child,
                tag ? tag : (CONST char *)"",
***************
*** 245,250 ****
--- 249,277 ----
        parsed_doc.safe = FALSE;
        dest = HTAnchor_findAddress(&parsed_doc);
  
+ #define DUPLICATE_ANCHOR_NAME_WORKAROUND
+ 
+ #ifdef DUPLICATE_ANCHOR_NAME_WORKAROUND
+       if (tag && *tag) {
+           HTAnchor *testdest1;
+           int nlinks;
+           testdest1 = child->mainLink.dest;
+           if (testdest1) {
+               nlinks = 1 + HTList_count(child->links);
+               CTRACE(tfp,
+                      "*** Duplicate ChildAnchor %p named `%s' with %d links",
+                      child, tag, nlinks);
+               if (dest == testdest1 && ltype == child->mainLink.type) {
+                   CTRACE(tfp,", same dest %p and type, keeping it\n",
+                          testdest1);
+               } else {
+                   CTRACE(tfp,", different dest %p, creating unnamed child\n",
+                          testdest1);
+                   child = HTAnchor_findChild(parent, 0);
+               }
+           }
+       }
+ #endif
        HTAnchor_link((HTAnchor *)child, dest, ltype);
        FREE(parsed_doc.address);
        FREE(relative_to);
*** lynx2-8-1.orig/WWW/Library/Implementation/HTFile.c  Wed Oct 14 07:23:56 1998
--- lynx2-8-1/WWW/Library/Implementation/HTFile.c       Sat Nov 14 19:35:12 1998
***************
*** 105,110 ****
--- 105,112 ----
  #define MAYBE_END(e) if (HTML_dtd.tags[e].contents != SGML_EMPTY) \
                        (*target->isa->end_element)(target, e, 0)
  #define FREE_TARGET (*target->isa->_free)(target)
+ #define ABORT_TARGET (*targetClass._abort)(target, NULL);
+ 
  struct _HTStructured {
        CONST HTStructuredClass *       isa;
        /* ... */
***************
*** 1985,1990 ****
--- 1987,1993 ----
                {
                    HTBTree * bt = HTBTree_new((HTComparer)strcmp);
  
+                   status = HT_LOADED; /* assume we don't get interrupted */
                    while ((dirbuf = readdir(dp)) != NULL) {
                        /*
                        **  While there are directory entries to be read...
***************
*** 2075,2080 ****
--- 2078,2088 ----
                        while (next_element != NULL) {
                            char *entry, *file_extra;
  
+                           if (HTCheckForInterrupt()) {
+                               _HTProgress ("Data transfer interrupted.");
+                               status = HT_PARTIAL_CONTENT;
+                               break;
+                           }
                            StrAllocCopy(tmpfilename,localname);
                            if (strcmp(localname, "/"))
                                /*
***************
*** 2170,2183 ****
                                /* pick up the next element of the list;
                                 if none, return NULL*/
                        }
!                       if (state == 'I') {
!                           START(HTML_P);
!                           PUTS("Empty Directory");
!                       }
  #ifndef LONG_LIST
!                       else
!                           END(HTML_DIR);
  #endif /* !LONG_LIST */
                    }
                        /* end while directory entries left to read */
                    closedir(dp);
--- 2178,2193 ----
                                /* pick up the next element of the list;
                                 if none, return NULL*/
                        }
!                       if (status == HT_LOADED) {
!                           if (state == 'I') {
!                               START(HTML_P);
!                               PUTS("Empty Directory");
!                           }
  #ifndef LONG_LIST
!                           else
!                               END(HTML_DIR);
  #endif /* !LONG_LIST */
+                       }
                    }
                        /* end while directory entries left to read */
                    closedir(dp);
***************
*** 2186,2197 ****
                    FREE(tail);
                    HTBTreeAndObject_free(bt);
  
!                   if (HTDirReadme == HT_DIR_README_BOTTOM)
!                         do_readme(target, localname);
!                   FREE_TARGET;
                    FREE(localname);
                    FREE(nodename);
!                   return HT_LOADED;   /* document loaded */
                }
  
            } /* end if localname is directory */
--- 2196,2211 ----
                    FREE(tail);
                    HTBTreeAndObject_free(bt);
  
!                   if (status == HT_LOADED) {
!                       if (HTDirReadme == HT_DIR_README_BOTTOM)
!                           do_readme(target, localname);
!                       FREE_TARGET;
!                   } else {
!                       ABORT_TARGET;
!                   }
                    FREE(localname);
                    FREE(nodename);
!                   return status;      /* document loaded, maybe partial */
                }
  
            } /* end if localname is directory */

reply via email to

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