From d4a8ec3c8922a91d418bb9bc130c256c4e00d030 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 21 Nov 1998 16:40:42 -0500 Subject: snapshot of project "lynx", label v2-8-2dev_5 --- src/DefaultStyle.c | 160 +++++++++++++++++++++++--------------------- src/GridText.c | 114 +++++++++++++++++++------------ src/HTFWriter.c | 12 ++-- src/HTInit.c | 11 ++- src/HTML.c | 46 ++++++++----- src/LYBookmark.c | 94 ++++++++++++++++++++------ src/LYCharSets.c | 52 +++++++------- src/LYClean.c | 2 +- src/LYCookie.c | 8 +++ src/LYCurses.c | 13 +--- src/LYDownload.c | 1 + src/LYEditmap.c | 124 ++++++++++++++++++++++++++++++++-- src/LYGlobalDefs.h | 7 +- src/LYHistory.c | 2 +- src/LYKeymap.c | 52 ++++++++++++-- src/LYKeymap.h | 7 ++ src/LYMail.c | 21 ++---- src/LYMain.c | 14 +++- src/LYPrint.c | 2 +- src/LYReadCFG.c | 18 ++++- src/LYShowInfo.c | 7 +- src/LYStrings.c | 2 +- src/LYStrings.h | 2 +- src/LYUtils.c | 35 ++++++++-- src/UCdomap.c | 16 ++--- src/chrtrans/README.format | 7 +- src/chrtrans/cp1250_uni.tbl | 2 +- src/chrtrans/cp1251_uni.tbl | 2 +- src/chrtrans/cp1252_uni.tbl | 2 +- src/chrtrans/cp1253_uni.tbl | 2 +- src/chrtrans/cp1255_uni.tbl | 2 +- src/chrtrans/cp1256_uni.tbl | 2 +- src/chrtrans/cp1257_uni.tbl | 2 +- 33 files changed, 580 insertions(+), 263 deletions(-) (limited to 'src') diff --git a/src/DefaultStyle.c b/src/DefaultStyle.c index 2e00ba62..c77f0b8f 100644 --- a/src/DefaultStyle.c +++ b/src/DefaultStyle.c @@ -35,95 +35,95 @@ PRIVATE HTTabStop tabs_16[] = { ** word wrap, free format, space: before, after, flags. */ -PRIVATE HTStyle HTStyleNormal = { +PRIVATE HTStyle HTStyleNormal = { 0, "Normal", "P", HT_FONT, 1, HT_BLACK, 0, 0, 3, 3, 6, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleDivCenter = { +PRIVATE HTStyle HTStyleDivCenter = { &HTStyleNormal, "DivCenter", "DCENTER", HT_FONT, 1, HT_BLACK, 0, 0, 3, 3, 6, HT_CENTER, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleDivLeft = { +PRIVATE HTStyle HTStyleDivLeft = { &HTStyleDivCenter, "DivLeft", "DLEFT", HT_FONT, 1, HT_BLACK, 0, 0, 3, 3, 6, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleDivRight = { +PRIVATE HTStyle HTStyleDivRight = { &HTStyleDivLeft, "DivRight", "DRIGHT", HT_FONT, 1, HT_BLACK, 0, 0, 3, 3, 6, HT_RIGHT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleBanner = { +PRIVATE HTStyle HTStyleBanner = { &HTStyleDivRight, "Banner", "BANNER", HT_FONT, 1, HT_BLACK, 0, 0, 3, 3, 6, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleBlockquote = { +PRIVATE HTStyle HTStyleBlockquote = { &HTStyleBanner, "Blockquote", "BLOCKQUOTE", HT_FONT, 1, HT_BLACK, 0, 0, 5, 5, 7, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; PRIVATE HTStyle HTStyleBq = { /* HTML 3.0 BLOCKQUOTE - FM */ &HTStyleBlockquote, "Bq", "BQ", HT_FONT, 1, HT_BLACK, 0, 0, 5, 5, 7, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; PRIVATE HTStyle HTStyleFootnote = { /* HTML 3.0 FN - FM */ &HTStyleBq, "Footnote", "FN", HT_FONT, 1, HT_BLACK, 0, 0, 5, 5, 7, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleList = { +PRIVATE HTStyle HTStyleList = { &HTStyleFootnote, "List", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 3, 7, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList1 = { +PRIVATE HTStyle HTStyleList1 = { &HTStyleList, "List1", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 8, 12, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList2 = { +PRIVATE HTStyle HTStyleList2 = { &HTStyleList1, "List2", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 13, 17, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList3 = { +PRIVATE HTStyle HTStyleList3 = { &HTStyleList2, "List3", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 18, 22, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList4 = { +PRIVATE HTStyle HTStyleList4 = { &HTStyleList3, "List4", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 23, 27, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList5 = { +PRIVATE HTStyle HTStyleList5 = { &HTStyleList4, "List5", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 28, 32, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; -PRIVATE HTStyle HTStyleList6 = { +PRIVATE HTStyle HTStyleList6 = { &HTStyleList5, "List6", "UL", HT_FONT, 1, HT_BLACK, 0, 0, 33, 37, 6, HT_LEFT, 1, 0, 0, - YES, YES, 0, 0, 0 }; + YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleMenu = { &HTStyleList6, "Menu", "MENU", @@ -177,98 +177,98 @@ PRIVATE HTStyle HTStyleMenu6= { PRIVATE HTStyle HTStyleGlossary = { &HTStyleMenu6, "Glossary", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 3, 10, 6, HT_LEFT, 1, 0, 0, + 3, 10, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary1 = { &HTStyleGlossary, "Glossary1", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 8, 16, 6, HT_LEFT, 1, 0, 0, + 8, 16, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary2 = { &HTStyleGlossary1, "Glossary2", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 14, 22, 6, HT_LEFT, 1, 0, 0, + 14, 22, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary3 = { &HTStyleGlossary2, "Glossary3", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 20, 28, 6, HT_LEFT, 1, 0, 0, + 20, 28, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary4 = { &HTStyleGlossary3, "Glossary4", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 26, 34, 6, HT_LEFT, 1, 0, 0, + 26, 34, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary5 = { &HTStyleGlossary4, "Glossary5", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 32, 40, 6, HT_LEFT, 1, 0, 0, + 32, 40, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossary6 = { &HTStyleGlossary5, "Glossary6", "DL", HT_FONT, 1, HT_BLACK, 0, 0, - 38, 46, 6, HT_LEFT, 1, 0, 0, + 38, 46, 6, HT_LEFT, 1, 0, 0, YES, YES, 1, 1, 0 -}; +}; PRIVATE HTStyle HTStyleGlossaryCompact = { &HTStyleGlossary6, "GlossaryCompact", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 3, 10, 6, HT_LEFT, 1, 0, 0, + 3, 10, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact1 = { &HTStyleGlossaryCompact, "GlossaryCompact1", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 8, 15, 6, HT_LEFT, 1, 0, 0, + 8, 15, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact2 = { &HTStyleGlossaryCompact1, "GlossaryCompact2", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 13, 20, 6, HT_LEFT, 1, 0, 0, + 13, 20, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact3 = { &HTStyleGlossaryCompact2, "GlossaryCompact3", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 18, 25, 6, HT_LEFT, 1, 0, 0, + 18, 25, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact4 = { &HTStyleGlossaryCompact3, "GlossaryCompact4", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 23, 30, 6, HT_LEFT, 1, 0, 0, + 23, 30, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact5 = { &HTStyleGlossaryCompact4, "GlossaryCompact5", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 28, 35, 6, HT_LEFT, 1, 0, 0, + 28, 35, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; PRIVATE HTStyle HTStyleGlossaryCompact6 = { &HTStyleGlossaryCompact5, "GlossaryCompact6", "DLC", HT_FONT, 1, HT_BLACK, 0, 0, - 33, 40, 6, HT_LEFT, 1, 0, 0, + 33, 40, 6, HT_LEFT, 1, 0, 0, YES, YES, 0, 0, 0 }; @@ -277,95 +277,107 @@ PRIVATE HTStyle HTStyleExample = { HT_FONT, 1, HT_BLACK, 0, 0, 0, 0, 0, HT_LEFT, 1, 0, tabs_8, NO, NO, 0, 0, 0 -}; +}; PRIVATE HTStyle HTStylePreformatted = { &HTStyleExample, "Preformatted", "PRE", HT_FONT, 1, HT_BLACK, 0, 0, 0, 0, 0, HT_LEFT, 1, 0, tabs_8, NO, NO, 0, 0, 0 -}; +}; PRIVATE HTStyle HTStyleListing = { &HTStylePreformatted, "Listing", "LISTING", HT_FONT, 1, HT_BLACK, 0, 0, 0, 0, 0, HT_LEFT, 1, 0, tabs_8, - NO, NO, 0, 0, 0 }; + NO, NO, 0, 0, 0 }; PRIVATE HTStyle HTStyleAddress = { &HTStyleListing, "Address", "ADDRESS", HT_FONT, 1, HT_BLACK, 0, 0, 4, 4, 7, HT_LEFT, 1, 0, tabs_8, - YES, YES, 2, 0, 0 }; + YES, YES, 2, 0, 0 }; PRIVATE HTStyle HTStyleNote = { /* HTML 3.0 NOTE - FM */ &HTStyleAddress, "Note", "NOTE", HT_FONT, 1, HT_BLACK, 0, 0, 5, 5, 7, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; PRIVATE HTStyle HTStyleHeading1 = { &HTStyleNote, "Heading1", "H1", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 0, 0, 0, HT_CENTER, 1, 0, 0, - YES, YES, 1, 1, 0 }; + YES, YES, 1, 1, 0 }; PRIVATE HTStyle HTStyleHeading2 = { &HTStyleHeading1, "Heading2", "H2", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 0, 0, 0, HT_LEFT, 1, 0, 0, - YES, YES, 1, 1, 0 }; + YES, YES, 1, 1, 0 }; -PRIVATE HTStyle HTStyleHeading3 = { +PRIVATE HTStyle HTStyleHeading3 = { &HTStyleHeading2, "Heading3", "H3", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, - 2, 2, 0, HT_LEFT, 1, 0, 0, - YES, YES, 1, 0, 0 }; + 2, 2, 0, HT_LEFT, 1, 0, 0, + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeading4 = { +PRIVATE HTStyle HTStyleHeading4 = { &HTStyleHeading3, "Heading4", "H4", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 4, 4, 0, HT_LEFT, 1, 0, 0, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeading5 = { +PRIVATE HTStyle HTStyleHeading5 = { &HTStyleHeading4, "Heading5", "H5", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 6, 6, 0, HT_LEFT, 1, 0, 0, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeading6 = { +PRIVATE HTStyle HTStyleHeading6 = { &HTStyleHeading5, "Heading6", "H6", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 8, 8, 0, HT_LEFT, 1, 0, 0, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeadingCenter = { +PRIVATE HTStyle HTStyleHeadingCenter = { &HTStyleHeading6, "HeadingCenter", "HCENTER", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 0, 0, 3, HT_CENTER, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeadingLeft = { +PRIVATE HTStyle HTStyleHeadingLeft = { &HTStyleHeadingCenter, "HeadingLeft", "HLEFT", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 0, 0, 3, HT_LEFT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; -PRIVATE HTStyle HTStyleHeadingRight = { +PRIVATE HTStyle HTStyleHeadingRight = { &HTStyleHeadingLeft, "HeadingRight", "HRIGHT", HT_FONT+HT_BOLD, 1, HT_BLACK, 0, 0, 0, 0, 3, HT_RIGHT, 1, 0, tabs_8, - YES, YES, 1, 0, 0 }; + YES, YES, 1, 0, 0 }; /* Style sheet points to the last in the list: */ 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 { - static HTStyleSheet *result; HTStyle *p, *q; /* @@ -378,6 +390,7 @@ PUBLIC HTStyleSheet * DefaultStyle NOARGS result = HTStyleSheetNew (); *result = sheet; result->styles = 0; + atexit(FreeDefaultStyle); for (p = sheet.styles; p != 0; p = p->next) { q = HTStyleNew (); *q = *p; @@ -389,9 +402,6 @@ PUBLIC HTStyleSheet * DefaultStyle NOARGS 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; } diff --git a/src/GridText.c b/src/GridText.c index ebca529f..e43e1ec5 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -464,9 +464,14 @@ PUBLIC HText * HText_new ARGS1( /* * 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 + * 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->address && !strcmp(anchor->address, LYlist_temp_url())) + if (anchor->bookmark || + (anchor->address && !strcmp(anchor->address, LYlist_temp_url()))) self->hiddenlinkflag = HIDDENLINKS_MERGE; else self->hiddenlinkflag = LYHiddenLinks; @@ -1036,7 +1041,10 @@ PRIVATE void display_page ARGS3( { HTLine * line = NULL; int i; - char *cp, tmp[7]; +#if defined(FANCY_CURSES) || defined(USE_SLANG) + char *cp; +#endif + char tmp[7]; int last_screen; TextAnchor *Anchor_ptr = NULL; FormInfo *FormInfo_ptr; @@ -1143,8 +1151,10 @@ PRIVATE void display_page ARGS3( * Output the page. */ if (line) { +#if defined(FANCY_CURSES) || defined(USE_SLANG) char *data; int offset, HitOffset, LenNeeded; +#endif for (i = 0; i < (display_lines); i++) { /* * Verify and display each line. @@ -1208,7 +1218,7 @@ PRIVATE void display_page ARGS3( for (; written < len && (tmp[0] = data[itmp]) != '\0'; itmp++) { - if (IsSpecialAttrChar(tmp[0])) { + if (IsSpecialAttrChar(tmp[0]) && tmp[0] != LY_SOFT_NEWLINE) { /* * Ignore special characters. */ @@ -1714,8 +1724,8 @@ PRIVATE void split_line ARGS2( 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]; + 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,7 +1764,7 @@ PRIVATE void split_line ARGS2( if (split > 0) { /* Delete space at "split" splitting line */ char *p, *prevdata = previous->data, *linedata = line->data; unsigned plen; - unsigned i; + int i; /* * Split the line. - FM @@ -1767,7 +1777,13 @@ PRIVATE void split_line ARGS2( * of our new line. - FM */ p = prevdata + split; - while (*p == ' ' || *p == LY_SOFT_HYPHEN) { + 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,7 +1798,7 @@ PRIVATE void split_line ARGS2( */ underline_on = NO; if (split) { - for (i = (split-1); i != 0; i--) { + for (i = (split-1); i >= 0; i--) { if (prevdata[i] == LY_UNDERLINE_END_CHAR) { break; } @@ -1802,7 +1818,7 @@ PRIVATE void split_line ARGS2( SpecialAttrChars++; } if (plen) { - for (i = (plen - 1); i != 0; i--) { + for (i = (plen - 1); i >= 0; i--) { if (p[i] == LY_UNDERLINE_START_CHAR) { underline_on = YES; break; @@ -1812,7 +1828,7 @@ PRIVATE void split_line ARGS2( break; } } - for (i = (plen - 1); i != 0; i--) { + 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,7 +1843,7 @@ PRIVATE void split_line ARGS2( */ bold_on = NO; if (split) { - for (i = (split - 1); i != 0; i--) { + for (i = (split - 1); i >= 0; i--) { if (prevdata[i] == LY_BOLD_END_CHAR) { break; } @@ -1845,10 +1861,9 @@ PRIVATE void split_line ARGS2( linedata[line->size] = '\0'; ctrl_chars_on_this_line++; SpecialAttrChars++;; - } else - bold_on = OFF; + } if (plen) { - for (i = (plen - 1); i != 0; i--) { + for (i = (plen - 1); i >= 0; i--) { if (p[i] == LY_BOLD_START_CHAR) { bold_on = YES; break; @@ -1858,14 +1873,14 @@ PRIVATE void split_line ARGS2( break; } } - for (i = (plen - 1); i != 0; i--) { + 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) { + if (p[i] == LY_SOFT_HYPHEN && (int)text->permissible_split < i) { text->permissible_split = i + 1; } } @@ -1882,7 +1897,12 @@ PRIVATE void split_line ARGS2( * Economize on space. */ while ((previous->size > 0) && - (previous->data[previous->size-1] == ' ')) { + (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,23 +1928,28 @@ PRIVATE void split_line ARGS2( /* * 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)); + 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 : @@ -2282,7 +2307,7 @@ PUBLIC void HText_appendCharacter ARGS2( return; } - if (IsSpecialAttrChar(ch)) { + if (IsSpecialAttrChar(ch) && ch != LY_SOFT_NEWLINE) { #ifndef USE_COLOR_STYLE if (line->size >= (MAX_LINE-1)) return; if (ch == LY_UNDERLINE_START_CHAR) { @@ -2311,11 +2336,6 @@ PUBLIC void HText_appendCharacter ARGS2( 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; @@ -2343,6 +2363,10 @@ PUBLIC void HText_appendCharacter ARGS2( #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)) { @@ -4066,7 +4090,9 @@ PUBLIC void HText_pageDisplay ARGS2( int, line_num, char *, target) { - CTRACE(tfp, "GridText: HText_pageDisplay at line %d started\n", line_num); + 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) { @@ -4093,7 +4119,9 @@ PUBLIC void HText_pageDisplay ARGS2( is_www_index = HTAnchor_isIndex(HTMainAnchor); - CTRACE(tfp, "GridText: HText_pageDisplay finished\n"); + if (debug_display_partial || (LYTraceLogFP != NULL)) { + CTRACE(tfp, "GridText: HText_pageDisplay finished\n"); + } } /* diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 667c8480..8b1e8805 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -157,7 +157,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) */ StrAllocCopy(path, me->anchor->FileCache); if ((len = strlen(path)) > 2) { - if (!strcasecomp((char *)&path[len-2], "gz")) { + if (!strcasecomp(&path[len-2], "gz")) { #ifdef USE_ZLIB if (!skip_loadfile) { use_gzread = YES; @@ -167,7 +167,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) path[len-3] = '\0'; remove(path); } - } else if (!strcasecomp((char *)&path[len-1], "Z")) { + } else if (!strcasecomp(&path[len-1], "Z")) { path[len-2] = '\0'; remove(path); } @@ -626,11 +626,11 @@ PUBLIC HTStream* HTSaveToFile ARGS3( return(NULL); } - if (((cp=strchr((char *)pres->rep->name, ';')) != NULL) && + if (((cp=strchr(pres->rep->name, ';')) != NULL) && strstr((cp+1), "charset") != NULL) { - _user_message(WRONG_CHARSET_D_OR_C, (char *)pres->rep->name); - } else if (*((char *)pres->rep->name) != '\0') { - _user_message(UNMAPPED_TYPE_D_OR_C, (char *)pres->rep->name); + _user_message(WRONG_CHARSET_D_OR_C, pres->rep->name); + } else if (*(pres->rep->name) != '\0') { + _user_message(UNMAPPED_TYPE_D_OR_C, pres->rep->name); } else { _statusline(CANNOT_DISPLAY_FILE_D_OR_C); } diff --git a/src/HTInit.c b/src/HTInit.c index 44c915b6..21a0dc4e 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -532,9 +532,14 @@ PRIVATE int PassesTest ARGS1( /* * Build the command and execute it. */ - if (LYOpenTemp(TmpFileName, HTML_SUFFIX, "w") == 0) - ExitWithError(CANNOT_OPEN_TEMP); - LYCloseTemp(TmpFileName); + 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(MEMORY_EXHAUSTED_ABORT); diff --git a/src/HTML.c b/src/HTML.c index 0e1bf5bf..24e5acf2 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -78,14 +78,14 @@ struct _HTStream { /* .... */ }; -PRIVATE HTStyleSheet * styleSheet; /* Application-wide */ +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; +PRIVATE HTStyle *default_style = NULL; PUBLIC char *LYToolbarName = "LynxPseudoToolbar"; @@ -108,7 +108,7 @@ PRIVATE void HTML_end_element PARAMS((HTStructured *me, PRIVATE char* MakeNewTitle PARAMS((CONST char ** value, int src_type)); PRIVATE char* MakeNewImageValue PARAMS((CONST char ** value)); -PRIVATE char* MakeNewMapValue PARAMS((const char ** value, const char* mapstr)); +PRIVATE char* MakeNewMapValue PARAMS((CONST char ** value, CONST char* mapstr)); /* Set an internal flag that the next call to a stack-affecting method ** is only internal and the stack manipulation should be skipped. - kw @@ -655,13 +655,13 @@ PRIVATE void HTML_start_element ARGS6( UPDATE_STYLE; } - CTRACE(tfp, "me->tag_charset: %d -> ", me->tag_charset); + CTRACE(tfp, "me->tag_charset: %d -> ", me->tag_charset); if (tag_charset < 0) me->tag_charset = me->UCLYhndl; else me->tag_charset = tag_charset; - CTRACE(tfp, "%d (me->UCLYhndl: %d, tag_charset: %d)\n", - me->tag_charset, me->UCLYhndl, tag_charset); + CTRACE(tfp, "%d (me->UCLYhndl: %d, tag_charset: %d)\n", + me->tag_charset, me->UCLYhndl, tag_charset); /* this should be done differently */ #if defined(USE_COLOR_STYLE) @@ -2737,10 +2737,12 @@ PRIVATE void HTML_start_element ARGS6( if (*alt_string == '\0') { if (map_href) { StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"USEMAP"))); + (temp = MakeNewMapValue(value,"USEMAP")))); + FREE(temp); } else if (dest_ismap) { StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"ISMAP"))); + (temp = MakeNewMapValue(value,"ISMAP")))); + FREE(temp); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? @@ -2760,12 +2762,14 @@ PRIVATE void HTML_start_element ARGS6( } else if (map_href) { StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"USEMAP"))); + (temp = MakeNewMapValue(value,"USEMAP")))); + FREE(temp); } else if ((dest_ismap == TRUE) || (me->inA && present && present[HTML_IMG_ISMAP])) { StrAllocCopy(alt_string, (title ? title : - MakeNewMapValue(value,"ISMAP"))); + (temp = MakeNewMapValue(value,"ISMAP")))); + FREE(temp); } else if (me->inA == TRUE && dest) { StrAllocCopy(alt_string, (title ? @@ -2784,7 +2788,8 @@ PRIVATE void HTML_start_element ARGS6( title : "")); } if (*alt_string == '\0' && map_href) { - StrAllocCopy(alt_string, MakeNewMapValue(value,"USEMAP")); + StrAllocCopy(alt_string, (temp = MakeNewMapValue(value,"USEMAP"))); + FREE(temp); } CTRACE(tfp, "HTML IMG: USEMAP=%d ISMAP=%d ANCHOR=%d PARA=%d\n", @@ -2846,7 +2851,8 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' '); me->in_word = NO; - HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); + HTML_put_string(me, (temp = MakeNewMapValue(value,"ISMAP"))); + FREE(temp); } else if (dest) { HTML_put_character(me, ' '); me->in_word = NO; @@ -2902,6 +2908,7 @@ PRIVATE void HTML_start_element ARGS6( HText_endAnchor(me->text, me->CurrentANum); me->CurrentANum = 0; HTML_put_character(me, '-'); + FREE(newtitle); StrAllocCopy(alt_string, ((present && present[HTML_IMG_ISOBJECT]) ? @@ -2958,6 +2965,7 @@ PRIVATE void HTML_start_element ARGS6( HText_endAnchor(me->text, me->CurrentANum); me->CurrentANum = 0; HTML_put_character(me, '-'); + FREE(newtitle); StrAllocCopy(alt_string, ((present && present[HTML_IMG_ISOBJECT]) ? @@ -3014,7 +3022,8 @@ PRIVATE void HTML_start_element ARGS6( if (dest_ismap) { HTML_put_character(me, ' ');/* space char may be ignored */ me->in_word = NO; - HTML_put_string(me, MakeNewMapValue(value,"ISMAP")); + 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; @@ -4400,7 +4409,7 @@ PRIVATE void HTML_start_element ARGS6( * 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 + * legitimizing it. - FM */ url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { @@ -4438,6 +4447,7 @@ PRIVATE void HTML_start_element ARGS6( 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); @@ -4689,6 +4699,7 @@ PRIVATE void HTML_start_element ARGS6( } } HText_setIgnoreExcess(me->text, FALSE); + FREE(ImageSrc); FREE(I_value); FREE(I_name); } @@ -7460,7 +7471,10 @@ PRIVATE char * MakeNewTitle ARGS2(CONST char **, value, int, src_type) char *newtitle = NULL; StrAllocCopy(newtitle, "["); - ptr = strrchr(value[src_type], '/'); + if (value != 0 && value[src_type] != 0) + ptr = strrchr(value[src_type], '/'); + else + ptr = 0; if (!ptr) { StrAllocCat(newtitle, value[src_type]); } else { @@ -7486,7 +7500,7 @@ PRIVATE char * MakeNewImageValue ARGS1(CONST char **, value) return newtitle; } -PRIVATE char * MakeNewMapValue ARGS2(const char **, value, const char*, mapstr) +PRIVATE char * MakeNewMapValue ARGS2(CONST char **, value, CONST char*, mapstr) { char *ptr; char *newtitle = NULL; diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 9c116890..7f103f11 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -7,6 +7,7 @@ #include #include #include /* need for META charset */ +#include #include /* need for LYHaveCJKCharacterSet */ #include #include @@ -171,8 +172,9 @@ PRIVATE char * convert_mosaic_bookmark_file ARGS1( return(newfile); } -PRIVATE BOOLEAN have8bit PARAMS((char *Title)); -PRIVATE char* title_convert8bit PARAMS((char *Title)); +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 @@ -259,17 +261,19 @@ PUBLIC void save_bookmark_link ARGS2( /* * 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; - } + string_buffer[sizeof(string_buffer)-1] = '\0'; + do { + LYstrncpy(string_buffer, title, sizeof(string_buffer)-1); + 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,8 +287,11 @@ PUBLIC void save_bookmark_link ARGS2( StrAllocCopy(Title, string_buffer); LYEntify(&Title, TRUE); if (UCSaveBookmarksInUnicode && - have8bit(Title) && (!LYHaveCJKCharacterSet)) - StrAllocCopy(Title, title_convert8bit(Title)); + have8bit(Title) && (!LYHaveCJKCharacterSet)) { + char *p = title_convert8bit(Title); + FREE(Title); + Title = p; + } /* * Create the bookmark file, if it doesn't exist already, @@ -876,10 +883,39 @@ PUBLIC void LYMBM_statusline ARGS1( } } +/* + * 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(char *, Title) +PRIVATE BOOLEAN have8bit ARGS1(CONST char *, Title) { CONST char *p = Title; @@ -909,14 +945,17 @@ PRIVATE BOOLEAN have8bit ARGS1(char *, Title) * Older versions fail. * */ -PRIVATE char* title_convert8bit ARGS1(char *, Title) +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,12 +963,12 @@ PRIVATE char* title_convert8bit ARGS1(char *, Title) StrAllocCat(comment, q); StrAllocCat(ncr, q); } else { - int charset_in, charset_out, uck; + int uck; long unicode; char replace_buf [10], replace_buf2 [10]; - charset_in = current_char_set; - charset_out = UCGetLYhndl_byMIME("us-ascii"); + if (charset_out < 0) + charset_out = UCGetLYhndl_byMIME("us-ascii"); uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q, charset_in, charset_out, YES); @@ -945,6 +984,19 @@ PRIVATE char* title_convert8bit ARGS1(char *, Title) } } + /* + * 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!). */ @@ -953,5 +1005,7 @@ PRIVATE char* title_convert8bit ARGS1(char *, Title) StrAllocCat(buf, " -->"); StrAllocCat(buf, ncr); + FREE(comment); + FREE(ncr); return(buf); } diff --git a/src/LYCharSets.c b/src/LYCharSets.c index 03f9f74e..dafda5b8 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -373,59 +373,59 @@ PUBLIC CONST char * LYchar_set_names[MAXCHARSETS + 1]={ * Will be automatically modified (and extended) by charset translations * which are loaded using the chartrans mechanism. * Most important piece of info to put here is a MIME charset name. - * Used for chartrans. + * Used for chartrans (see UCDefs.h). * The order of LYCharSets and LYCharSet_UC MUST be the same. * * Note that most of the charsets added by the new mechanism in src/chrtrans - * don't show up here at all. They don't have to. + * don't show up here at all. They don't have to. */ PUBLIC LYUCcharset LYCharSet_UC[MAXCHARSETS]= { /* * Zero position placeholder and HTMLGetEntityUCValue() reference. - FM */ - {-1,"iso-8859-1", UCT_ENC_8BIT, - UCT_REP_IS_LAT1, - UCT_CP_IS_LAT1, UCT_R_LAT1,UCT_R_LAT1}, + {-1,"iso-8859-1", UCT_ENC_8BIT,0, + UCT_REP_IS_LAT1, + UCT_CP_IS_LAT1, UCT_R_LAT1,UCT_R_LAT1}, /* * Placeholders for Unicode tables. - FM */ - {-1,"cp850", UCT_ENC_8BIT, - UCT_REP_SUPERSETOF_LAT1, - 0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"windows-1252", UCT_ENC_8BIT, - UCT_REP_SUPERSETOF_LAT1, - 0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"cp437", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"dec-mcs", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"macintosh", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"next", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"cp850", UCT_ENC_8BIT,0, + UCT_REP_SUPERSETOF_LAT1, + 0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"windows-1252", UCT_ENC_8BIT,0, + UCT_REP_SUPERSETOF_LAT1, + 0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"cp437", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"dec-mcs", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"macintosh", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"next", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, /* * There is no strict correlation for the next five, since the transfer * charset gets decoded into Display Char Set by the CJK code (separate - * from Unicode mechanism). For now we use the MIME name that describes + * from Unicode mechanism). For now we use the MIME name that describes * what is output to the terminal. - KW */ - {-1,"euc-cn", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"euc-jp", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"shift_jis", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"euc-kr", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"big5", UCT_ENC_CJK,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"euc-cn", UCT_ENC_CJK,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"euc-jp", UCT_ENC_CJK,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"shift_jis", UCT_ENC_CJK,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"euc-kr", UCT_ENC_CJK,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"big5", UCT_ENC_CJK,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, /* * Placeholders for Unicode tables. - FM */ - {-1,"viscii", UCT_ENC_8BIT_C0,0,0, UCT_R_8BIT,UCT_R_ASCII}, - {-1,"us-ascii", UCT_ENC_7BIT, - UCT_REP_SUBSETOF_LAT1, - UCT_CP_SUBSETOF_LAT1, UCT_R_ASCII,UCT_R_ASCII}, + {-1,"viscii", UCT_ENC_8BIT_C0,0,0,0, UCT_R_8BIT,UCT_R_ASCII}, + {-1,"us-ascii", UCT_ENC_7BIT,0, + UCT_REP_SUBSETOF_LAT1, + UCT_CP_SUBSETOF_LAT1, UCT_R_ASCII,UCT_R_ASCII}, /* * Placeholder for non-translation mode. - FM */ - {-1,"x-transparent", UCT_ENC_8BIT,0,0, UCT_R_8BIT,UCT_R_ASCII} + {-1,"x-transparent", UCT_ENC_8BIT,0,0,0, UCT_R_8BIT,UCT_R_ASCII} }; diff --git a/src/LYClean.c b/src/LYClean.c index cc134e8c..78e5a67e 100644 --- a/src/LYClean.c +++ b/src/LYClean.c @@ -106,7 +106,7 @@ PUBLIC void cleanup_sig ARGS1( } if (sig != 0) { printf("\n\n%s %d\n\n", - gettext("\n\nExiting via interrupt: %d\n\n"), + gettext("Exiting via interrupt:"), sig); fflush(stdout); } diff --git a/src/LYCookie.c b/src/LYCookie.c index 9bcb6f0c..0ef68296 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -494,6 +494,14 @@ PRIVATE void store_cookie ARGS3( freeCookie(co); co = NULL; + /* + * Don't add the cookie if the value is NULL. - BJP + */ + } else if (co->value[0] == '\0') { + CTRACE(tfp, "store_cookie: Value is NULL! Not storing cookie.\n"); + freeCookie(co); + co = NULL; + /* * If it's a replacement for a cookie that had not expired, * and never allow has not been set, add it again without diff --git a/src/LYCurses.c b/src/LYCurses.c index ff8e22a1..42b10477 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -344,7 +344,7 @@ PUBLIC void curses_w_style ARGS3( CTRACE(tfp,"........... %s (0x%x) %s\r\n", "attribute cache FULL, dropping last", last_styles[last_ptr], - "in LynxChangStyle(curses_w_style)"); + "in LynxChangeStyle(curses_w_style)"); last_ptr--; } last_styles[last_ptr++] = getattrs(stdscr); @@ -750,16 +750,7 @@ PUBLIC void start_curses NOARGS if (initscr() == NULL) { /* start curses */ fprintf(tfp, "%s\n", gettext("Terminal initialisation failed - unknown terminal type?")); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* !NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); - (void) signal(SIGINT, SIG_DFL); -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ - exit (-1); + exit_immediately (-1); } #if defined(SIGWINCH) && defined(NCURSES_VERSION) size_change(0); diff --git a/src/LYDownload.c b/src/LYDownload.c index 2382e750..e0215020 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -658,6 +658,7 @@ PUBLIC int LYdownload_options ARGS2( * Free off temp copy. */ FREE(sug_filename); + FREE(downloaded_url); return(0); } diff --git a/src/LYEditmap.c b/src/LYEditmap.c index cf8cc312..1a1dcebd 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -15,7 +15,7 @@ PRIVATE char DefaultEditBinding[]={ LYE_NOP, LYE_BOL, LYE_DELPW, LYE_ABORT, /* nul ^A ^B ^C */ -LYE_DELC, LYE_EOL, LYE_DELNW, LYE_ABORT, +LYE_DELN, LYE_EOL, LYE_DELNW, LYE_ABORT, /* ^D ^E ^F ^G */ LYE_DELP, LYE_ENTER, LYE_ENTER, LYE_LOWER, @@ -33,7 +33,7 @@ LYE_UPPER, LYE_ERASE, LYE_LKCMD, LYE_NOP, LYE_ERASE, LYE_NOP, LYE_NOP, LYE_NOP, /* ^X ^Y ^Z ESC */ -LYE_NOP, LYE_NOP, LYE_NOP, LYE_NOP, +LYE_NOP, LYE_NOP, LYE_SWMAP, LYE_NOP, /* ^\ ^] ^^ ^_ */ /* sp .. RUBOUT */ @@ -114,9 +114,117 @@ LYE_NOP, LYE_DELP, LYE_NOP, LYE_NOP, }; /* - * Add your favorite key binding HERE + * Add your favorite key bindings HERE */ +/* 01 */ /* Default except that ^F=cursor-forward and ^B=cursor-backward */ +/* */ + +#ifdef EXP_ALT_BINDINGS +PRIVATE char BetterEditBinding[]={ + +LYE_NOP, LYE_BOL, LYE_BACK, LYE_ABORT, +/* nul ^A ^B ^C */ + +LYE_DELN, LYE_EOL, LYE_FORW, LYE_ABORT, +/* ^D ^E ^F ^G */ + +LYE_DELP, LYE_ENTER, LYE_ENTER, LYE_DELEL, +/* bs tab nl ^K */ + +LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT, +/* ^L cr ^N ^O */ + +LYE_BACKW, LYE_NOP, LYE_DELPW, LYE_NOP, +/* ^P XON ^R XOFF */ + +LYE_DELNW, LYE_ERASE, LYE_LKCMD, LYE_NOP, +/* ^T ^U ^V ^W */ + +LYE_ERASE, LYE_NOP, LYE_NOP, LYE_NOP, +/* ^X ^Y ^Z ESC */ + +LYE_NOP, LYE_NOP, LYE_UPPER, LYE_LOWER, +/* ^\ ^] ^^ ^_ */ + +/* sp .. RUBOUT */ +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_DELP, + +/* 80..9F ISO-8859-1 8-bit escape characters. */ +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_AIX, +/* 97 AIX */ +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, + +/* A0..FF (permissible ISO-8859-1) 8-bit characters. */ +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, +LYE_CHAR, LYE_CHAR, LYE_CHAR, LYE_CHAR, + +/* 100..10E function key definitions in LYStrings.h */ +LYE_NOP, LYE_NOP, LYE_FORW, LYE_BACK, +/* UPARROW DNARROW RTARROW LTARROW */ + +LYE_NOP, LYE_NOP, LYE_BOL, LYE_EOL, +/* PGDOWN PGUP HOME END */ + +LYE_NOP, LYE_TAB, LYE_BOL, LYE_EOL, +/* F1 Do key Find key Select key */ + +LYE_NOP, LYE_DELP, LYE_NOP, LYE_NOP, +/* Insert key Remove key DO_NOTHING ... */ +}; +#endif + /* * Add the array name to LYLineEditors @@ -124,6 +232,9 @@ LYE_NOP, LYE_DELP, LYE_NOP, LYE_NOP, PUBLIC char * LYLineEditors[]={ DefaultEditBinding, /* You can't please everyone, so you ... DW */ +#ifdef EXP_ALT_BINDINGS + BetterEditBinding, /* No, you certainly can't ... /ked 10/27/98*/ +#endif }; /* @@ -131,8 +242,11 @@ PUBLIC char * LYLineEditors[]={ * The order of LYLineEditors and LyLineditNames MUST be the same */ PUBLIC char * LYLineeditNames[]={ - "Default Binding ", - (char *) 0 + "Default Binding", +#ifdef EXP_ALT_BINDINGS + "Alternate Bindings", +#endif + (char *) 0 }; /* diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index c326615d..663c968f 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -270,10 +270,11 @@ extern char *form_post_data; /* User data for post form */ extern char *form_get_data; /* User data for get form */ extern char *http_error_file; /* Place HTTP status code in this file */ extern char *authentication_info[2]; /* Id:Password for protected documents */ -extern char *proxyauth_info[2]; /* Id:Password for protected proxy server */ -extern BOOLEAN HEAD_request; /* Do a HEAD request */ +extern char *proxyauth_info[2]; /* Id:Password for protected proxy server */ +extern char *UC_TEMPcharset; /* temporary in UCGetLYhndl_byMIME */ +extern BOOLEAN HEAD_request; /* Do a HEAD request */ extern BOOLEAN scan_for_buried_news_references; -extern BOOLEAN bookmark_start; /* Use bookmarks as startfile */ +extern BOOLEAN bookmark_start; /* Use bookmarks as startfile */ extern BOOLEAN clickable_images; extern BOOLEAN pseudo_inline_alts; extern BOOLEAN crawl; diff --git a/src/LYHistory.c b/src/LYHistory.c index 05d4b6e6..6ba11db6 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -84,7 +84,7 @@ PUBLIC void LYAddVisitedLink ARGS1( } if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL) - outofmem(__FILE__, "HTAddVisitedLink"); + outofmem(__FILE__, "LYAddVisitedLink"); StrAllocCopy(new->address, doc->address); StrAllocCopy(new->title, (doc->title ? doc->title : gettext("(no title)"))); diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 9ab5df62..2d01e830 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -8,6 +8,29 @@ #include +#ifdef EXP_KEYBOARD_LAYOUT +#include +#include +#include +#endif + +#ifdef EXP_KEYBOARD_LAYOUT +PUBLIC int current_layout = 0; /* Index into LYKbLayouts[] */ + +PUBLIC unsigned short * LYKbLayouts[]={ + kb_layout_rot13, + kb_layout_jcuken, + kb_layout_yawerty +}; + +PUBLIC char * LYKbLayoutNames[]={ + "ROT13'd keyboard layout", + "JCUKEN Cyrillic, for AT 101-key kbd", + "YAWERTY Cyrillic, for DEC LK201 kbd", + (char *) 0 +}; +#endif + PRIVATE CONST DocAddress keymap_anchor = {"LYNXKEYMAP", NULL, NULL}; struct _HTStream @@ -751,8 +774,10 @@ GLOBALDEF PUBLIC HTProtocol LYLynxKeymap = {"LYNXKEYMAP", LYLoadKeymap, 0}; * func must be present in the revmap table. * returns TRUE if the mapping was made, FALSE if not. */ -PUBLIC int remap ARGS2(char *,key, char *,func) - { +PUBLIC int remap ARGS2( + char *, key, + char *, func) +{ int i; struct rmap *mp; int c = 0; @@ -897,7 +922,7 @@ PUBLIC void reset_numbers_as_arrows NOARGS } PUBLIC int lookup_keymap ARGS1( - int, func) + int, func) { size_t i; @@ -910,7 +935,7 @@ PUBLIC int lookup_keymap ARGS1( } PUBLIC char *key_for_func ARGS1 ( - int, func) + int, func) { static char buf[512]; int i; @@ -947,7 +972,7 @@ PUBLIC BOOL LYisNonAlnumKeyname ARGS2( * LYK_foo value passed to it as an argument. - FM */ PUBLIC int LYReverseKeymap ARGS1( - int, key_name) + int, key_name) { int i; @@ -959,3 +984,20 @@ PUBLIC int LYReverseKeymap ARGS1( return(-1); } + +#ifdef EXP_KEYBOARD_LAYOUT +PUBLIC int LYSetKbLayout ARGS1( + char *, layout_id) +{ + int i; + + for (i = 0; i < (int) TABLESIZE(LYKbLayoutNames) - 1; i++) { + if (!strcmp(LYKbLayoutNames[i], layout_id)) { + current_layout = i; + return (-1); + } + } + + return 0; +} +#endif diff --git a/src/LYKeymap.h b/src/LYKeymap.h index e8ccad06..a1acced8 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -19,6 +19,13 @@ extern void set_vms_keys NOPARAMS; extern unsigned short keymap[]; /* main keymap matrix */ +#ifdef EXP_KEYBOARD_LAYOUT +extern int current_layout; +extern unsigned short * LYKbLayouts[]; +extern char * LYKbLayoutNames[]; +extern int LYSetKbLayout PARAMS((char *layout_id)); +#endif + #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) extern unsigned short key_override[]; #endif diff --git a/src/LYMail.c b/src/LYMail.c index ee9479fe..dd8a2141 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -69,9 +69,11 @@ PUBLIC void mailform ARGS4( int len, i, ch; #if defined(VMS) || defined(DOSPATH) char my_tmpfile[256]; - char *address_ptr1, *address_ptr2; char *command = NULL; +#ifdef VMS + char *address_ptr1, *address_ptr2; BOOLEAN first = TRUE; +#endif BOOLEAN isPMDF = FALSE; char hdrfile[256]; FILE *hfd; @@ -595,9 +597,11 @@ PUBLIC void mailmsg ARGS4( char cmd[512], *cp, *cp0, *cp1; #if defined(VMS) || defined(DOSPATH) char my_tmpfile[256]; - char *address_ptr1, *address_ptr2; char *command = NULL; +#ifdef VMS + char *address_ptr1, *address_ptr2; BOOLEAN first = TRUE; +#endif BOOLEAN isPMDF = FALSE; char hdrfile[256]; FILE *hfd; @@ -831,18 +835,7 @@ PUBLIC void mailmsg ARGS4( if ((ofp = LYAppendToTxtFile(TRAVERSE_ERRORS)) == NULL) { if ((ofp = LYNewTxtFile(TRAVERSE_ERRORS)) == NULL) { perror(NOOPEN_TRAV_ERR_FILE); -#ifndef NOSIGHUP - (void) signal(SIGHUP, SIG_DFL); -#endif /* NOSIGHUP */ - (void) signal(SIGTERM, SIG_DFL); -#ifndef VMS - (void) signal(SIGINT, SIG_DFL); -#endif /* !VMS */ -#ifdef SIGTSTP - if (no_suspend) - (void) signal(SIGTSTP,SIG_DFL); -#endif /* SIGTSTP */ - exit(-1); + exit_immediately(-1); } } diff --git a/src/LYMain.c b/src/LYMain.c index 0cd4de25..ab2a13b2 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -75,7 +75,7 @@ PUBLIC BOOLEAN UseFixedRecords = USE_FIXED_RECORDS; #endif /* VMS */ #ifndef VMS -PUBLIC char *lynx_version_putenv_command = NULL; +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 */ @@ -461,6 +461,9 @@ PRIVATE void free_lynx_globals NOARGS FREE(LynxSigFile); FREE(system_mail); FREE(system_mail_flags); +#ifdef EXP_PERSISTENT_COOKIES + FREE(LYCookieFile); +#endif FREE(LYUserAgent); FREE(LYUserAgentDefault); FREE(LYHostName); @@ -482,14 +485,23 @@ PRIVATE void free_lynx_globals NOARGS FREE(lynxjumpfile); FREE(startrealm); FREE(personal_mail_address); + FREE(UC_TEMPcharset); FREE(URLDomainPrefixes); 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); } diff --git a/src/LYPrint.c b/src/LYPrint.c index 1367d8f1..1b0c7d4b 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -447,7 +447,7 @@ PUBLIC int printfile ARGS1( if ((outfile_fp = (TOUPPER(c) == 'A' ? LYAppendToTxtFile(buffer) : LYNewTxtFile(buffer))) == NULL) { - CTRACE(tfp, "LYPrint: error is %s\n", strerror(errno)); + CTRACE(tfp, "LYPrint: errno is %d\n", errno); HTAlert(CANNOT_WRITE_TO_FILE); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index d5a9ac6f..1978fa4a 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -972,6 +973,8 @@ static Config_Type Config_Table [] = {0} }; +PRIVATE char *local_url = NULL; + /* * Free memory allocated in 'read_cfg()' */ @@ -996,6 +999,7 @@ PUBLIC void free_lynx_cfg NOARGS break; } } + FREE(local_url); } /* @@ -1194,8 +1198,17 @@ PUBLIC void read_cfg ARGS4( break; #endif default: - if (fp0 != 0) - fprintf(fp0, "%s:%s\n", name, value); + 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; } } @@ -1241,7 +1254,6 @@ PUBLIC void read_cfg ARGS4( */ PUBLIC char *lynx_cfg_infopage NOARGS { - static char *local_url; char tempfile[LY_MAXPATH]; char *temp = 0; FILE *fp0; diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index decf40a5..3d3d9c42 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -49,7 +49,7 @@ PRIVATE char *lynx_compile_opts NOARGS BeginInternalPage (fp0, CONFIG_DEF_TITLE, NULL); fprintf(fp0, "
\n");
 
-	fprintf(fp0, "%s %s lynx.cfg %s\n\n",
+	fprintf(fp0, "%s %s lynx.cfg %s\n\n",
 	    SEE_ALSO,
 	    YOUR_SEGMENT,
 	    lynx_cfg_infopage(),
@@ -85,7 +85,6 @@ PUBLIC int showinfo ARGS4(
 	char *, 	owner_address)
 {
     static char tempfile[LY_MAXPATH];
-    static char *info_url;
     int url_type;
     FILE *fp0;
     char *Address = NULL, *Title = NULL;
@@ -104,12 +103,10 @@ PUBLIC int showinfo ARGS4(
 	return(-1);
     }
 
-    LYLocalFileToURL(&info_url, tempfile);
-
     /*
      *	Point the address pointer at this Url
      */
-    StrAllocCopy(newdoc->address, info_url);
+    LYLocalFileToURL(&newdoc->address, tempfile);
 
     if (nlinks > 0 && links[doc->link].lname != NULL &&
 	(url_type = is_url(links[doc->link].lname)) != 0 &&
diff --git a/src/LYStrings.c b/src/LYStrings.c
index b8421f43..4f88b003 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -407,7 +407,7 @@ static Keysym_String_List Keysym_Strings [] =
  * Ncurses stores the termcap/terminfo names in arrays sorted to match the
  * array of strings in the TERMTYPE struct.
  */
-PRIVATE int lookup_tiname (char *name, NCURSES_CONST char *const *names)
+PRIVATE int lookup_tiname (char *name, NCURSES_CONST char *CONST *names)
 {
     int code;
 
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 22e7de00..8f53178c 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -22,7 +22,7 @@ extern int LYgetstr PARAMS((
 	int		recall));
 extern char *LYstrsep PARAMS((
 	char **		stringp,
-	const char *	delim));
+	CONST char *	delim));
 extern char * LYstrstr PARAMS((
 	char *		chptr,
 	CONST char *	tarptr));
diff --git a/src/LYUtils.c b/src/LYUtils.c
index d1d76319..0147188e 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -107,12 +107,15 @@ PUBLIC void highlight ARGS3(
 {
     char buffer[200];
     int i;
-    char tmp[7], *cp;
+    char tmp[7];
+#if defined(FANCY_CURSES) || defined(USE_SLANG)
+    char *cp;
     char *theData = NULL;
     char *Data = NULL;
     int Offset, HitOffset, tLen;
     int LenNeeded;
     BOOL TargetEmphasisON = FALSE;
+#endif
     BOOL utf_flag = (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8);
 
     tmp[0] = tmp[1] = tmp[2] = '\0';
@@ -5356,10 +5359,6 @@ Cambridge, MA 02139, USA.  */
 #define NULL 0
 #endif /* !NULL */
 
-#if !__STDC__
-#define const
-#endif /* !__STDC__ */
-
 extern char **environ;
 
 /*
@@ -6039,6 +6038,7 @@ PUBLIC int LYSystem ARGS1(
 	char *,	command)
 {
     int code;
+    int do_free = 0;
 
     fflush(stdout);
     fflush(stderr);
@@ -6051,6 +6051,29 @@ PUBLIC int LYSystem ARGS1(
 #ifdef VMS
     code = DCLsystem(command);
 #else
+#  ifdef __EMX__			/* FIXME: Should be LY_CONVERT_SLASH? */
+    /* Configure writes commands which contain direct slashes.
+       Native command-(non)-shell will not tolerate this. */
+    {
+	char *space = command, *slash = command;
+	while (*space && *space != ' ' && *space != '\t')
+	    space++;
+	while (slash < space && *slash != '/')
+	    slash++;
+	if (slash != space) {
+	    char *old = command;
+
+	    command = NULL;
+	    StrAllocCopy(command, old);
+	    do_free = 1;
+	    slash = (slash - old) + command - 1;
+	    space = (space - old) + command;
+	    while (++slash < space)
+		if (*slash == '/')
+		    *slash = '\\';
+	}
+    }
+#  endif
     code = system(command);
 #endif
 
@@ -6062,6 +6085,8 @@ PUBLIC int LYSystem ARGS1(
     fflush(stdout);
     fflush(stderr);
 
+    if (do_free)
+	FREE(command);
     return code;
 }
 
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 49599e74..2ce2ac2c 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -25,6 +25,8 @@
 #include 
 #include 
 
+#include 
+
 /*
  *  Include tables & parameters.
  */
@@ -67,6 +69,8 @@
 #include 
 #endif /* NOTDEFINED */
 
+PUBLIC  char *UC_TEMPcharset = 0;	/* temporary in UCGetLYhndl_byMIME */
+
 /*
  *  Some of the code below, and some of the comments, are left in for
  *  historical reasons.  Not all those tables below are currently
@@ -1017,11 +1021,6 @@ PRIVATE void UCconsole_map_init NOARGS
 /*
  *  OK now, finally, some stuff that is more specifically for Lynx: - KW
  */
-#ifdef NOTDEFINED
-PUBLIC int UCGetcharset_byMIMEname PARAMS((CONST char * UC_MIMEcharset));
-PUBLIC int UCGetcharset_byLYNXname PARAMS((CONST char * UC_LYNXcharset));
-#endif /* NOTDEFINED */
-
 PUBLIC int UCTransUniChar ARGS2(
 	long,		unicode,
 	int,		charset_out)
@@ -1510,9 +1509,9 @@ PUBLIC int UCGetRawUniMode_byLYhndl ARGS1(
 PUBLIC int UCGetLYhndl_byMIME ARGS1(
 	CONST char *,	value)
 {
-  int i;
-  int LYhndl = -1;
-  char *UC_MIMEcharset = NULL;
+#define UC_MIMEcharset UC_TEMPcharset
+    int i;
+    int LYhndl = -1;
 
     if (!value || !(*value)) {
 	CTRACE(tfp, "UCGetLYhndl_byMIME: NULL argument instead of MIME name.\n");
@@ -1639,6 +1638,7 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1(
 
     CTRACE(tfp, "UCGetLYhndl_byMIME: unrecognized MIME name \"%s\"\n", value);
     return -1;	/* returns -1 if no charset found by that MIME name */
+#undef UC_MIMEcharset
 }
 
 /*
diff --git a/src/chrtrans/README.format b/src/chrtrans/README.format
index 636afd32..4b425a00 100644
--- a/src/chrtrans/README.format
+++ b/src/chrtrans/README.format
@@ -32,7 +32,7 @@ b) directives:
 	in the list for Display Character Set
     MIMEName
 	The name for this charset in MIME syntax (one word with digits
-        and some other non-letters allowed, should be IANA registered)
+	and some other non-letters allowed, should be IANA registered)
     Default
 	If "Y[es]" or "1", this is the default (fallback) translation table,
 	it will be used for Unicode -> 8bit (or 7bit) translation if no
@@ -45,7 +45,10 @@ b) directives:
 
     RawOrEnc
 	a number which flags some special property (encoding) for this
-        charset [see utf8_uni.tbl for example, see UCDefs.h for details].
+	charset [see utf8_uni.tbl for example, see UCDefs.h for details].
+
+    Codepage number (IBM specific)
+	used by OS/2 font-switching code.
 
 c) character translation definitions:
    they look like
diff --git a/src/chrtrans/cp1250_uni.tbl b/src/chrtrans/cp1250_uni.tbl
index 7b3820d0..207add88 100644
--- a/src/chrtrans/cp1250_uni.tbl
+++ b/src/chrtrans/cp1250_uni.tbl
@@ -10,7 +10,7 @@ C1250
 #
 #    Name:     cp1250 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1251_uni.tbl b/src/chrtrans/cp1251_uni.tbl
index 21cfb598..97a00449 100644
--- a/src/chrtrans/cp1251_uni.tbl
+++ b/src/chrtrans/cp1251_uni.tbl
@@ -10,7 +10,7 @@ C1251
 #
 #    Name:     cp1251 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1252_uni.tbl b/src/chrtrans/cp1252_uni.tbl
index 0dd82ef8..73d91e57 100644
--- a/src/chrtrans/cp1252_uni.tbl
+++ b/src/chrtrans/cp1252_uni.tbl
@@ -14,7 +14,7 @@ C1252
 #
 #    Name:     cp1252 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1253_uni.tbl b/src/chrtrans/cp1253_uni.tbl
index 3340d719..59cf46fe 100644
--- a/src/chrtrans/cp1253_uni.tbl
+++ b/src/chrtrans/cp1253_uni.tbl
@@ -10,7 +10,7 @@ C1253
 #
 #    Name:     cp1253 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1255_uni.tbl b/src/chrtrans/cp1255_uni.tbl
index 1c38f40a..5b82fcfd 100644
--- a/src/chrtrans/cp1255_uni.tbl
+++ b/src/chrtrans/cp1255_uni.tbl
@@ -10,7 +10,7 @@ C1255
 #
 #    Name:     cp1255 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1256_uni.tbl b/src/chrtrans/cp1256_uni.tbl
index b38c412d..c1bbcfde 100644
--- a/src/chrtrans/cp1256_uni.tbl
+++ b/src/chrtrans/cp1256_uni.tbl
@@ -10,7 +10,7 @@ C1256
 #
 #    Name:     cp1256 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
diff --git a/src/chrtrans/cp1257_uni.tbl b/src/chrtrans/cp1257_uni.tbl
index d42d6731..f5f9a926 100644
--- a/src/chrtrans/cp1257_uni.tbl
+++ b/src/chrtrans/cp1257_uni.tbl
@@ -10,7 +10,7 @@ C1257
 #
 #    Name:     cp1257 to Unicode table
 #    Unicode version: 2.0
-#    Table version: 2.00
+#    Table version: 2.01
 #    Table format:  Format A
 #    Date:          04/15/98
 #
-- 
cgit