diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-11-24 19:17:20 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-11-24 19:17:20 -0500 |
commit | 97d3287af85e3890f03d2a48474de0d1a431b676 (patch) | |
tree | 7db3a7cebf5a3ddce7154e927a2f1d8f3a17fa8c /src | |
parent | e47cfd5646f55de9688ff42df3055fd9c09b503f (diff) | |
download | lynx-snapshots-97d3287af85e3890f03d2a48474de0d1a431b676.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-97
Diffstat (limited to 'src')
-rw-r--r-- | src/HTML.c | 72 | ||||
-rw-r--r-- | src/LYCharUtils.c | 301 | ||||
-rw-r--r-- | src/LYCurses.c | 12 | ||||
-rw-r--r-- | src/LYEditmap.c | 2 | ||||
-rw-r--r-- | src/LYForms.c | 11 | ||||
-rw-r--r-- | src/LYKeymap.c | 3 | ||||
-rw-r--r-- | src/LYKeymap.h | 15 | ||||
-rw-r--r-- | src/LYLocal.c | 2 | ||||
-rw-r--r-- | src/LYLocal.h | 2 | ||||
-rw-r--r-- | src/LYMainLoop.c | 21 | ||||
-rw-r--r-- | src/LYOptions.c | 8 | ||||
-rw-r--r-- | src/LYStrings.c | 6 | ||||
-rw-r--r-- | src/LYStrings.h | 38 | ||||
-rw-r--r-- | src/LYUtils.c | 37 | ||||
-rw-r--r-- | src/UCdomap.c | 4 | ||||
-rw-r--r-- | src/makefile.in | 2 | ||||
-rw-r--r-- | src/mktime.c | 77 | ||||
-rw-r--r-- | src/strstr.c | 64 |
18 files changed, 572 insertions, 105 deletions
diff --git a/src/HTML.c b/src/HTML.c index 283c375f..a21fee2c 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -4436,7 +4436,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, "HTML: ***** BUTTON tag not within FORM element *****\n"); + fprintf(stderr, "Bad HTML: BUTTON tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -4691,7 +4691,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, "HTML: ***** INPUT tag not within FORM element *****\n"); + fprintf(stderr, "Bad HTML: INPUT tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -4710,7 +4710,8 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, "HTML: ***** Missing TEXTAREA end tag. *****\n"); + fprintf(stderr, + "Bad HTML: Missing TEXTAREA end tag. *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5070,7 +5071,7 @@ PRIVATE void HTML_start_element ARGS6( if (!me->inFORM) { if (TRACE) { fprintf(stderr, - "HTML: ***** TEXTAREA start tag not within FORM element *****\n"); + "Bad HTML: TEXTAREA start tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5163,7 +5164,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inSELECT) { if (TRACE) { fprintf(stderr, - "HTML: ***** SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"); + "Bad HTML: SELECT start tag in SELECT element. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5190,7 +5191,7 @@ PRIVATE void HTML_start_element ARGS6( if (!me->inFORM) { if (TRACE) { fprintf(stderr, - "HTML: ***** SELECT start tag not within FORM element *****\n"); + "Bad HTML: SELECT start tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5213,7 +5214,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, "HTML: ***** Missing TEXTAREA end tag *****\n"); + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5307,7 +5308,7 @@ PRIVATE void HTML_start_element ARGS6( if (!me->inSELECT) { if (TRACE) { fprintf(stderr, - "HTML: ***** OPTION tag not within SELECT element *****\n"); + "Bad HTML: OPTION tag not within SELECT element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5563,9 +5564,9 @@ PRIVATE void HTML_start_element ARGS6( HTML_end_element(me, HTML_U, (char **)&include); } me->inTABLE = TRUE; - if (me->sp[0].tag_number == HTML_PRE) { + if (!strcmp(me->sp->style->name, "Preformatted")) { UPDATE_STYLE; - LYCheckForID(me, present, value, (int)HTML_TABLE_ID); + CHECK_ID(HTML_TABLE_ID); break; } if (me->Division_Level < (MAX_NESTING - 1)) { @@ -5623,6 +5624,11 @@ PRIVATE void HTML_start_element ARGS6( } me->in_word = NO; + if (!strcmp(me->sp->style->name, "Preformatted")) { + CHECK_ID(HTML_TR_ID); + me->inP = FALSE; + break; + } if (LYoverride_default_alignment(me)) { me->sp->style->alignment = styles[me->sp[0].tag_number]->alignment; } else if (me->List_Nesting_Level >= 0 || @@ -5952,7 +5958,7 @@ PRIVATE void HTML_end_element ARGS3( */ if (me->inTEXTAREA && element_number != HTML_TEXTAREA) if (TRACE) { - fprintf(stderr, "HTML: ***** Missing TEXTAREA end tag *****\n"); + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -5970,7 +5976,7 @@ PRIVATE void HTML_end_element ARGS3( if (me->inA || me->inSELECT || me->inTEXTAREA) if (TRACE) { fprintf(stderr, - "HTML: ***** %s%s%s%s%s not closed before HTML end tag\n", + "Bad HTML: %s%s%s%s%s not closed before HTML end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", me->inTEXTAREA ? "TEXTAREA" : "", @@ -6086,7 +6092,7 @@ PRIVATE void HTML_end_element ARGS3( if (me->inA || me->inSELECT || me->inTEXTAREA) if (TRACE) { fprintf(stderr, - "HTML: ***** %s%s%s%s%s not closed before BODY end tag *****\n", + "Bad HTML: %s%s%s%s%s not closed before BODY end tag *****\n", me->inSELECT ? "SELECT" : "", (me->inSELECT && me->inTEXTAREA) ? ", " : "", me->inTEXTAREA ? "TEXTAREA" : "", @@ -6542,7 +6548,7 @@ PRIVATE void HTML_end_element ARGS3( */ if (TRACE) { fprintf(stderr, - "HTML: ***** Unmatched OBJECT start and end tags. ***** Discarding content:\n%s\n", + "Bad HTML: Unmatched OBJECT start and end tags. ***** Discarding content:\n%s\n", me->object.data); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); @@ -6620,7 +6626,7 @@ PRIVATE void HTML_end_element ARGS3( } else { if (TRACE) { fprintf(stderr, - "HTML: ***** Unmatched OBJECT start and end tags. ***** Discarding content.\n"); + "Bad HTML: Unmatched OBJECT start and end tags. ***** Discarding content.\n"); goto End_Object; } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); @@ -6824,7 +6830,7 @@ End_Object: */ if (!me->inFORM) { if (TRACE) { - fprintf(stderr, "HTML: ***** Unmatched FORM end tag *****\n"); + fprintf(stderr, "Bad HTML: Unmatched FORM end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -6846,7 +6852,7 @@ End_Object: if (me->inSELECT) { if (TRACE) { fprintf(stderr, - "HTML: ***** Open SELECT at FORM end. Faking SELECT end tag. *****\n"); + "Bad HTML: Open SELECT at FORM end. Faking SELECT end tag. *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -6909,7 +6915,7 @@ End_Object: */ if (!me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, "HTML: ***** Unmatched TEXTAREA end tag *****\n"); + fprintf(stderr, "Bad HTML: Unmatched TEXTAREA end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7060,7 +7066,7 @@ End_Object: */ if (!me->inSELECT) { if (TRACE) { - fprintf(stderr, "HTML: ***** Unmatched SELECT end tag *****\n"); + fprintf(stderr, "Bad HTML: Unmatched SELECT end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7085,7 +7091,7 @@ End_Object: if (!me->inFORM) { if (TRACE) { fprintf(stderr, - "HTML: ***** SELECT end tag not within FORM element *****\n"); + "Bad HTML: SELECT end tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7175,7 +7181,7 @@ End_Object: case HTML_TABLE: me->inTABLE = FALSE; - if (me->sp[0].tag_number == HTML_PRE) { + if (!strcmp(me->sp->style->name, "Preformatted")) { break; } if (me->Division_Level >= 0) @@ -7405,7 +7411,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) */ if (TRACE) { fprintf(stderr, - "HTML_free: ***** SELECT or OPTION not ended properly *****\n"); + "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7417,7 +7423,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * markup meant to be shown somewhere. - kw */ if (TRACE) - fprintf(stderr, " ***** leftover option data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", me->option.data); HTML_put_string(me, me->option.data); HTChunkClear(&me->option); @@ -7430,7 +7436,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) */ if (TRACE) { fprintf(stderr, - "HTML_free: ***** TEXTAREA not used properly *****\n"); + "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7442,7 +7448,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) * markup meant to be shown somewhere. - kw */ if (TRACE) - fprintf(stderr, " ***** leftover textarea data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); HTML_put_string(me, me->textarea.data); HTChunkClear(&me->textarea); @@ -7478,7 +7484,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) */ if (TRACE) { fprintf(stderr, - "HTML_free: ***** SELECT or OPTION not ended properly *****\n"); + "Bad HTML: SELECT or OPTION not ended properly *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7486,7 +7492,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) } if (TRACE) { HTChunkTerminate(&me->option); - fprintf(stderr, " ***** leftover option data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -7499,7 +7505,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) */ if (TRACE) { fprintf(stderr, - "HTML_free: ***** TEXTAREA not used properly *****\n"); + "Bad HTML: TEXTAREA not used properly *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -7507,7 +7513,7 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) } if (TRACE) { HTChunkTerminate(&me->textarea); - fprintf(stderr, " ***** leftover textarea data: %s\n", + fprintf(stderr, "HTML_free: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); @@ -7576,9 +7582,9 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) */ if (TRACE) { fprintf(stderr, - "HTML_abort: ***** SELECT or OPTION not ended properly *****\n"); + "HTML_abort: SELECT or OPTION not ended properly *****\n"); HTChunkTerminate(&me->option); - fprintf(stderr, " ***** leftover option data: %s\n", + fprintf(stderr, "HTML_abort: ***** leftover option data: %s\n", me->option.data); } HTChunkClear(&me->option); @@ -7591,9 +7597,9 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) */ if (TRACE) { fprintf(stderr, - "HTML_abort: ***** TEXTAREA not used properly *****\n"); + "HTML_abort: TEXTAREA not used properly *****\n"); HTChunkTerminate(&me->textarea); - fprintf(stderr, " ***** leftover textarea data: %s\n", + fprintf(stderr, "HTML_abort: ***** leftover textarea data: %s\n", me->textarea.data); } HTChunkClear(&me->textarea); diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 8b72ffac..20969f52 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -2135,6 +2135,131 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( } continue; } + if ((code == 1) || + (code > 129 && code < 156)) { + /* + ** Assume these are MicroSoft code points, + ** inflicted on us by FrontPage. - FM + */ + switch (code) { + case 1: + /* + ** WHITE SMILING FACE + */ + code = 0x263a; + break; + case 130: + /* + ** SINGLE LOW-9 QUOTATION MARK (sbquo) + */ + code = 0x201a; + break; + case 132: + /* + ** DOUBLE LOW-9 QUOTATION MARK (bdquo) + */ + code = 0x201e; + break; + case 133: + /* + ** HORIZONTAL ELLIPSIS (hellip) + */ + code = 0x2026; + break; + case 134: + /* + ** DAGGER (dagger) + */ + code = 0x2020; + break; + case 135: + /* + ** DOUBLE DAGGER (Dagger) + */ + code = 0x2021; + break; + case 137: + /* + ** PER MILLE SIGN (permil) + */ + code = 0x2030; + break; + case 139: + /* + ** SINGLE LEFT-POINTING ANGLE QUOTATION MARK + ** (lsaquo) + */ + code = 0x2039; + break; + case 145: + /* + ** LEFT SINGLE QUOTATION MARK (lsquo) + */ + code = 0x2018; + break; + case 146: + /* + ** RIGHT SINGLE QUOTATION MARK (rsquo) + */ + code = 0x2019; + break; + case 147: + /* + ** LEFT DOUBLE QUOTATION MARK (ldquo) + */ + code = 0x201c; + break; + case 148: + /* + ** RIGHT DOUBLE QUOTATION MARK (rdquo) + */ + code = 0x201d; + break; + case 149: + /* + ** BULLET (bull) + */ + code = 0x2022; + break; + case 150: + /* + ** EN DASH (ndash) + */ + code = 0x2013; + break; + case 151: + /* + ** EM DASH (mdash) + */ + code = 0x2014; + break; + case 152: + /* + ** SMALL TILDE (tilde) + */ + code = 0x02dc; + break; + case 153: + /* + ** TRADE MARK SIGN (trade) + */ + code = 0x2122; + break; + case 155: + /* + ** SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + ** (rsaquo) + */ + code = 0x203a; + break; + default: + /* + ** Do not attempt a conversion + ** to valid Unicode values. + */ + break; + } + } /* ** For 173 (shy), use that value if it's ** a hidden INPUT, otherwise ignore it @@ -2155,6 +2280,20 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( } continue; } + /* + ** For 8211 (ndash or endash), and 8212 + ** (mdash or emdash), use an ASCII hyphen + ** ('-'). - FM + */ + if (code == 8211 || + code == 8212) { + HTChunkPutc(s, '-'); + if (cpe != ';' && cpe != '\0') { + p--; + *p = cpe; + } + continue; + } /* ** Seek a translation from the chartrans tables. */ @@ -2289,6 +2428,40 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( } continue; /* + ** Ignore (8204) zwnj, if we get to here. - FM + */ + } else if (code == 8204) { + if (TRACE) { + fprintf(stderr, + "LYUnEscapeEntities: Ignoring '%s%s;'.\n", + (isHex ? "&#x" : "&#"), + cp); + } + if (cpe != ';' && cpe != '\0') { + p--; + *p = cpe; + } + continue; + } else + /* + ** Ignore 8205 (zwj), + ** 8206 (lrm), and 8207 (rln), if we get to here. - FM + */ + if (code == 8205 || + code == 8206 || + code == 8207) { + if (TRACE) { + fprintf(stderr, + "LYUnEscapeEntities: Ignoring '%s%s'.\n", + (isHex ? "&#x" : "&#"), + cp); + } + if (cpe != ';' && cpe != '\0') { + p--; + *p = cpe; + } + continue; + /* ** Show the numeric entity if the value: ** (1) Is greater than 255 and unhandled Unicode. */ @@ -2397,6 +2570,77 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( cp++; cpe = *cp; *cp = '\0'; + + /* + ** For 160 (nbsp), use an ASCII space (32) if + ** plain_space or hidden is TRUE, otherwise use + ** the Lynx special character. - FM + */ + if (!strcmp(p, "nbsp")) { + if (hidden || plain_space) { + HTChunkPutc(s, ' '); + } else { + HTChunkPutc(s, HT_NON_BREAK_SPACE); + } + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } + /* + ** For 173 (shy), skip it if plain_space or hidden is + ** TRUE, otherwise use the Lynx special character. - FM + */ + if (!strcmp(p, "shy")) { + if (!(plain_space || hidden)) { + HTChunkPutc(s, LY_SOFT_HYPHEN); + } + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } + /* + ** For 8194 (ensp), 8195 (emsp), and 8201 + ** (thinsp), use an ASCII space (32) if + ** hidden or plain_space is TRUE, otherwise + ** use the Lynx special character. - FM + */ + if (!strcmp(p, "ensp") || !strcmp(p, "emsp") || + !strcmp(p, "thinsp")) { + if (hidden || plain_space) { + HTChunkPutc(s, ' '); + } else { + HTChunkPutc(s, HT_EM_SPACE); + } + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } + /* + ** For 8211 (ndash or endash), and 8212 + ** (mdash or emdash), use an ASCII space + ** (32). - FM + */ + if (!strcmp(p, "ndash") || + !strcmp(p, "endash") || + !strcmp(p, "mdash") || + !strcmp(p, "emdash")) { + HTChunkPutc(s, '-'); + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } for (low = 0, high = HTML_dtd.number_of_entities; high > low ; diff < 0 ? (low = i+1) : (high = i)) { @@ -2675,6 +2919,57 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9( p = (cp+1); break; } + if ((chk && uck == -4) && + (uck = UCTransUniCharStr(replace_buf, + 60, code, + UCGetLYhndl_byMIME("us-ascii"), + 0) >= 0)) { + /* + ** Got a replacement string (yippey). - FM + */ + HTChunkPuts(s, replace_buf); + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } + /* + ** Ignore (8204) zwnj, if we get to here. - FM + */ + if (!strcmp(p, "zwnj")) { + if (TRACE) { + fprintf(stderr, + "LYUnEscapeEntities: Ignoring '%s'.\n", + p); + } + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } + /* + ** Ignore 8205 (zwj), + ** 8206 (lrm), and 8207 (rln), if we get to here. - FM + */ + if (!strcmp(p, "zwj") || + !strcmp(p, "lrm") || + !strcmp(p, "rlm")) { + if (TRACE) { + fprintf(stderr, + "LYUnEscapeEntities: Ignoring '%s'.\n", + p); + } + *cp = cpe; + if (*cp != ';') + p = cp; + else + p = (cp+1); + continue; + } /* ** Seek a translation from the chartrans tables. */ @@ -3889,7 +4184,7 @@ PUBLIC void LYHandleSELECT ARGS5( if (!me->inFORM) { if (TRACE) { fprintf(stderr, - "HTML: ***** SELECT start tag not within FORM element *****\n"); + "Bad HTML: SELECT start tag not within FORM element *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -3912,7 +4207,7 @@ PUBLIC void LYHandleSELECT ARGS5( */ if (me->inTEXTAREA) { if (TRACE) { - fprintf(stderr, "HTML: ***** Missing TEXTAREA end tag *****\n"); + fprintf(stderr, "Bad HTML: Missing TEXTAREA end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; @@ -3998,7 +4293,7 @@ PUBLIC void LYHandleSELECT ARGS5( */ if (!me->inSELECT) { if (TRACE) { - fprintf(stderr, "HTML: ***** Unmatched SELECT end tag *****\n"); + fprintf(stderr, "Bad HTML: Unmatched SELECT end tag *****\n"); } else if (!me->inBadHTML) { _statusline(BAD_HTML_USE_TRACE); me->inBadHTML = TRUE; diff --git a/src/LYCurses.c b/src/LYCurses.c index 23daf95a..3ab3c51c 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -236,12 +236,16 @@ PUBLIC void LYbox ARGS2( * specifiy our own ASCII characters for the corners and call * wborder() instead of box(). - kw */ +#ifdef FANCY_CURSES if (!boxvert || !boxhori) box(win, boxvert, boxhori); else if (boxvert == '*' || boxhori == '*') wborder(win, boxvert, boxvert, boxhori, boxhori, '*', '*', '*', '*'); else wborder(win, boxvert, boxvert, boxhori, boxhori, '/', '\\', '\\', '/'); +#else + box(win, boxvert, boxhori); +#endif #ifdef CSS if (formfield) wcurses_css(win, "frame", ABS_OFF); @@ -989,7 +993,7 @@ PUBLIC BOOLEAN setup ARGS1( { static char term_putenv[120]; char buffer[120]; -#if !defined(NO_SIZECHANGEHACK) +#if defined(USE_SIZECHANGEHACK) #if defined(HAVE_SIZECHANGE) && !defined(USE_SLANG) /* * Hack to deal with a problem in sysV curses, that screen can't be @@ -1009,7 +1013,7 @@ PUBLIC BOOLEAN setup ARGS1( (void) putenv(cols_putenv); } #endif /* !NO_SIZECHANGE && !USE_SLANG */ -#endif /* !NO_SIZECHANGEHACK */ +#endif /* USE_SIZECHANGEHACK */ /* * If the display was not set by a command line option then @@ -1056,7 +1060,7 @@ PUBLIC BOOLEAN setup ARGS1( } #endif /* HAVE_TTYTYPE */ -#if defined(HAVE_SIZECHANGE) && !defined(USE_SLANG) && !defined(NO_SIZECHANGEHACK) +#if defined(HAVE_SIZECHANGE) && !defined(USE_SLANG) && defined(USE_SIZECHANGEHACK) if (lines_putenv != NULL) { /* * Use SIGWINCH handler to set the true window size. - AJL && FM @@ -1075,7 +1079,7 @@ PUBLIC BOOLEAN setup ARGS1( #else LYlines = LINES; LYcols = COLS; -#endif /* !NO_SIZECHANGE && !USE_SLANG && !NO_SIZECHANGEHACK */ +#endif /* !NO_SIZECHANGE && !USE_SLANG && USE_SIZECHANGEHACK */ if (LYlines <= 0) LYlines = 24; if (LYcols <= 0) diff --git a/src/LYEditmap.c b/src/LYEditmap.c index cf42ddd2..54c146ff 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -28,7 +28,7 @@ LYE_NOP, LYE_ENTER, LYE_FORWW, LYE_ABORT, LYE_BACKW, LYE_NOP, LYE_DELN, LYE_NOP, /* ^P XON ^R XOFF */ -LYE_UPPER, LYE_ERASE, LYE_LINKN, LYE_NOP, +LYE_UPPER, LYE_ERASE, LYE_LKCMD, LYE_NOP, /* ^T ^U ^V ^W */ LYE_ERASE, LYE_NOP, LYE_NOP, LYE_NOP, diff --git a/src/LYForms.c b/src/LYForms.c index df0b3b1c..67a11869 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -358,10 +358,15 @@ again: action = EditBinding(ch); if (action == LYE_ENTER) break; - if (action == LYE_LINKN) { - if ((ch = LYReverseKeymap(LYK_F_LINK_NUM)) <= 0) { - ch = DO_NOTHING; + if (action == LYE_LKCMD) { + _statusline(ENTER_LYNX_COMMAND); + ch = LYgetch(); +#ifdef VMS + if (HadVMSInterrupt) { + HadVMSInterrupt = FALSE; + ch = 7; } +#endif /* VMS */ break; } if (action == LYE_AIX && diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 14b80ef1..8cad69e7 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -123,7 +123,7 @@ LYK_FORM_UP, 0, LYK_FORM_DOWN, LYK_INLINE_TOGGLE, LYK_NOCACHE, 0, LYK_INTERRUPT, LYK_INLINE_TOGGLE, /* X */ /* Y */ /* Z */ /* [ */ -LYK_SOURCE, LYK_HEAD, 0, 0, +LYK_SOURCE, LYK_HEAD, 0, LYK_CLEAR_AUTH, /* \ */ /* ] */ /* ^ */ /* _ */ LYK_MINIMAL, LYK_ADD_BOOKMARK, LYK_PREV_PAGE, LYK_COMMENT, @@ -462,6 +462,7 @@ PRIVATE struct rmap revmap[] = { { "RAW_TOGGLE", "toggle raw 8-bit translations or CJK mode ON or OFF" }, { "COOKIE_JAR", "examine the Cookie Jar" }, { "F_LINK_NUM", "invoke the 'Follow link (or page) number:' prompt" }, +{ "CLEAR_AUTH", "clear all authorization info for this session" }, { "SWITCH_DTD", "switch between two ways of parsing HTML" }, #ifdef USE_EXTERNALS { "EXTERN", "run external program with url" }, diff --git a/src/LYKeymap.h b/src/LYKeymap.h index 133e1f2f..049ade2b 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -92,16 +92,17 @@ extern char override[]; #define LYK_RAW_TOGGLE 68 #define LYK_COOKIE_JAR 69 #define LYK_F_LINK_NUM 70 -#define LYK_SWITCH_DTD 71 +#define LYK_CLEAR_AUTH 71 +#define LYK_SWITCH_DTD 72 #ifdef USE_EXTERNALS -#define LYK_EXTERN 72 +#define LYK_EXTERN 73 #if defined(VMS) || defined(DIRED_SUPPORT) -#define LYK_DIRED_MENU 73 +#define LYK_DIRED_MENU 74 #endif /* VMS || DIRED_SUPPORT */ #else /* USE_EXTERNALS */ #if defined(VMS) || defined(DIRED_SUPPORT) -#define LYK_DIRED_MENU 72 +#define LYK_DIRED_MENU 73 #endif /* VMS || DIRED_SUPPORT */ #endif /* !defined(USE_EXTERNALS) */ @@ -115,9 +116,9 @@ extern char override[]; #endif /* DIRED_SUPPORT */ #ifdef NOT_USED -#define LYK_VERSION 80 -#define LYK_FORM_UP 81 -#define LYK_FORM_DOWN 82 +#define LYK_VERSION 81 +#define LYK_FORM_UP 82 +#define LYK_FORM_DOWN 83 #endif /* NOT_USED */ #endif /* LYKEYMAP_H */ diff --git a/src/LYLocal.c b/src/LYLocal.c index ba553a68..177af674 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -47,7 +47,9 @@ #ifndef VMS #ifndef _WINDOWS +#ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif #include <errno.h> #include <grp.h> #endif /*_WINDOWS */ diff --git a/src/LYLocal.h b/src/LYLocal.h index 6a042e60..8c1b5730 100644 --- a/src/LYLocal.h +++ b/src/LYLocal.h @@ -7,8 +7,10 @@ #include <types.h> #include <stat.h> #else +#if 0 /* already included in tcp.h */ #include <sys/types.h> #include <sys/stat.h> +#endif #endif /* VMS */ #ifndef S_IRWXU diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index d73b9a22..208ad88b 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -6,6 +6,8 @@ #include "HTFTP.h" #include "HTFile.h" #include "HTTP.h" +#include "HTAABrow.h" +#include "HTNews.h" #include "LYCurses.h" #include "LYStyle.h" #include "LYGlobalDefs.h" @@ -5322,6 +5324,25 @@ check_add_bookmark_to_self: } break; + case LYK_CLEAR_AUTH: + if (old_c != real_c) { + old_c = real_c; + if (HTConfirm(CLEAR_ALL_AUTH_INFO)) { + FREE(authentication_info[0]); + FREE(authentication_info[1]); + FREE(proxyauth_info[0]); + FREE(proxyauth_info[1]); + HTClearHTTPAuthInfo(); + HTClearNNTPAuthInfo(); + HTClearFTPPassword(); + _statusline(AUTH_INFO_CLEARED); + } else { + _statusline(CANCELLED); + } + sleep(MessageSecs); + } + break; + #ifdef NOT_USED case LYK_VERSION: if (old_c != real_c) { diff --git a/src/LYOptions.c b/src/LYOptions.c index 8cc9886c..5d657a7a 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -205,10 +205,14 @@ draw_options: * might have non-ASCII or multibyte/CJK characters. - FM */ response = 0; +#ifdef FANCY_CURSES if (enable_scrollback) clear(); else erase(); +#else + clear(); +#endif move(0, 5); lynx_start_h1_color (); @@ -1795,10 +1799,14 @@ draw_bookmark_list: * to increase the chances that any non-ASCII or multibyte/CJK * characters will be handled properly. - FM */ +#ifdef FANCY_CURSES if (enable_scrollback) clear(); else erase(); +#else + clear(); +#endif move(0, 5); lynx_start_h1_color (); diff --git a/src/LYStrings.c b/src/LYStrings.c index 04cad25f..868590df 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -155,7 +155,7 @@ PUBLIC char * LYmbcsstrncpy ARGS5(char *,dst, CONST char *,src, int,n_bytes, /* * LYmbcs_skip_glyphs() skips a given number of display positions * in a string and returns the resulting pointer. It takes account - * of UTF-8 encoded characters. - kw + * of UTF-8 encoded characters. - KW */ PUBLIC char * LYmbcs_skip_glyphs ARGS3( char *, data, @@ -172,7 +172,7 @@ PUBLIC char * LYmbcs_skip_glyphs ARGS3( if (!utf_flag) return (data + n_glyphs); - while(*data) { + while (*data) { if (IS_NEW_GLYPH(*data)) { if (i_glyphs++ >= n_glyphs) { return data; @@ -1086,7 +1086,7 @@ again: return(-1); break; - case LYE_LINKN: + case LYE_LKCMD: /* * Used only in form_getstr() for invoking * the LYK_F_LINK_NUM prompt when in form diff --git a/src/LYStrings.h b/src/LYStrings.h index e6d7f178..df22b35c 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -2,9 +2,6 @@ #define LYSTRINGS_H #include <string.h> -#ifdef __STRICT_BSD__ -extern char *strstr(); -#endif /* __STRICT_BSD__ */ extern int get_mouse_link NOPARAMS; extern char * LYstrncpy PARAMS(( @@ -22,6 +19,19 @@ extern char * LYstrstr PARAMS(( char * chptr, char * tarptr)); +extern char * LYmbcsstrncpy PARAMS(( + char * dst, + CONST char * src, + int n_bytes, + int n_glyphs, + int enc)); +extern char * LYmbcs_skip_glyphs PARAMS(( + char * data, + int n_glyphs, + BOOL utf_flag)); +extern int LYmbcsstrlen PARAMS(( + char * str, + BOOL utf_flag)); extern char * LYno_attr_mbcs_strstr PARAMS(( char * chptr, char * tarptr, @@ -34,24 +44,6 @@ extern char * LYno_attr_mbcs_case_strstr PARAMS(( BOOL utf_flag, int * nstartp, int * nendp)); -#ifdef EXP_CHARTRANS -extern int LYmbcsstrlen PARAMS(( - char * str, - BOOL utf_flag)); -extern char * LYmbcs_skip_glyphs PARAMS(( - char * data, - int n_glyphs, - BOOL utf_flag)); -extern char * LYmbcsstrncpy PARAMS(( - char * dst, - CONST char * src, - int n_bytes, - int n_glyphs, - int enc)); -#else -#define LYmbcsstrlen(str,utf_flag) strlen(str) -#define LYmbcsstrncpy(dest,src,n,n_glyphs,enc) LYstrncpy(dest, src, n) -#endif extern char * LYno_attr_char_strstr PARAMS(( char * chptr, @@ -144,9 +136,9 @@ typedef struct _EditFieldData { #define LYE_LOWER (LYE_BACKW +1) /* Lower case the line */ #define LYE_UPPER (LYE_LOWER +1) /* Upper case the line */ -#define LYE_LINKN (LYE_UPPER +1) /* Invoke F_LINK_NUM */ +#define LYE_LKCMD (LYE_UPPER +1) /* Invoke command prompt */ -#define LYE_AIX (LYE_LINKN +1) /* Hex 97 */ +#define LYE_AIX (LYE_LKCMD +1) /* Hex 97 */ extern void LYSetupEdit PARAMS(( EditFieldData * edit, diff --git a/src/LYUtils.c b/src/LYUtils.c index f4ba7728..0ece6343 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -347,8 +347,7 @@ PUBLIC void highlight ARGS3( } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Start emphasis immediately if we are @@ -445,8 +444,7 @@ PUBLIC void highlight ARGS3( } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[(utf_extra + 1)] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -625,8 +623,7 @@ highlight_hit_within_hightext: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Start emphasis immediately if we are making @@ -729,8 +726,7 @@ highlight_hit_within_hightext: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -898,8 +894,7 @@ highlight_hit_within_hightext: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[(utf_extra + 1)] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -1082,8 +1077,7 @@ highlight_search_hightext2: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Start emphasis immediately if we are @@ -1180,8 +1174,7 @@ highlight_search_hightext2: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[(utf_extra + 1)] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -1267,7 +1260,6 @@ highlight_search_hightext2: (offset - Offset), utf_flag); } - data = (Data + (offset - Offset)); if ((case_sensitive ? (cp = LYno_attr_mbcs_strstr(data, target, @@ -1360,8 +1352,7 @@ highlight_hit_within_hightext2: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Start emphasis immediately if we are making @@ -1464,8 +1455,7 @@ highlight_hit_within_hightext2: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[utf_extra+1] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -1633,8 +1623,7 @@ highlight_hit_within_hightext2: } } if (utf_extra) { - strncpy(&tmp[1], &data[itmp+1], utf_extra); - tmp[(utf_extra + 1)] = '\0'; + LYstrncpy(&tmp[1], &data[itmp+1], utf_extra); itmp += utf_extra; /* * Make sure we don't restore emphasis to @@ -3421,7 +3410,7 @@ PUBLIC void tempname ARGS2( fclose(fp); if (TRACE) fprintf(stderr, - "tempname: file '%s' already exits!\n", + "tempname: file '%s' already exists!\n", namebuffer); counter++; continue; @@ -3439,7 +3428,7 @@ PUBLIC void tempname ARGS2( fclose(fp); if (TRACE) fprintf(stderr, - "tempname: file '%s' already exits!\n", + "tempname: file '%s' already exists!\n", namebuffer); counter++; continue; @@ -3457,7 +3446,7 @@ PUBLIC void tempname ARGS2( fclose(fp); if (TRACE) fprintf(stderr, - "tempname: file '%s' already exits!\n", + "tempname: file '%s' already exists!\n", namebuffer); continue; } diff --git a/src/UCdomap.c b/src/UCdomap.c index e81ad05c..2bd75f5a 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1577,8 +1577,8 @@ PUBLIC int UCGetLYhndl_byMIME ARGS1( isdigit((unsigned char)UC_MIMEcharset[5])) { char tmp[16]; /* - * For "cpNNNN", try "windows-NNNN" - * if not yet found. - kw + * For "cp1NNN", try "windows-1NNN" + * if not yet found. - KW */ sprintf(tmp, "windows-%s", UC_MIMEcharset + 2); return UCGetLYhndl_byMIME(tmp); diff --git a/src/makefile.in b/src/makefile.in index 203e97b2..e6f436f5 100644 --- a/src/makefile.in +++ b/src/makefile.in @@ -49,7 +49,7 @@ LYForms.o LYPrint.o LYrcFile.o LYDownload.o LYNews.o LYKeymap.o \ HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \ LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \ LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \ -LYStyle.o LYHash.o @EXTRA_OBJS@ +LYStyle.o LYHash.o @EXTRA_OBJS@ @LIBOBJS@ C_SRC = $(OBJS:.o=.c) diff --git a/src/mktime.c b/src/mktime.c new file mode 100644 index 00000000..0db7f122 --- /dev/null +++ b/src/mktime.c @@ -0,0 +1,77 @@ +/* + * mktime.c -- converts a struct tm into a time_t + * + * Copyright (C) 1997 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Written by Philippe De Muyter <phdm@macqel.be>. */ + +#include <time.h> + +static time_t +mkgmtime(t) +register struct tm *t; +{ + register short month, year; + register long time; + static int m_to_d[12] = +{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + + month = t->tm_mon; + year = t->tm_year + month / 12 + 1900; + month %= 12; + if (month < 0) + { + year -= 1; + month += 12; + } + time = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; + time = (year - 1970) * 365 + m_to_d[month]; + if (month <= 1) + year -= 1; + time += (year - 1968) / 4; + time -= (year - 1900) / 100; + time += (year - 1600) / 400; + time += t->tm_mday; + time -= 1; + time *= 24; + time += t->tm_hour; + time *= 60; + time += t->tm_min; + time *= 60; + time += t->tm_sec; + return(time); +} + +/* +** mktime -- convert tm struct to time_t +** if tm_isdst >= 0 use it, else compute it +*/ + +time_t +mktime(t) +struct tm *t; +{ + time_t now; + + tzset(); + now = mkgmtime(t) + timezone; + if (t->tm_isdst > 0 + || (t->tm_isdst < 0 && localtime(&now)->tm_isdst)) + now -= 3600; + return(now); +} diff --git a/src/strstr.c b/src/strstr.c new file mode 100644 index 00000000..3d7442c1 --- /dev/null +++ b/src/strstr.c @@ -0,0 +1,64 @@ +/* + * strstr.c -- return the offset of one string within another. + * + * Copyright (C) 1997 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Written by Philippe De Muyter <phdm@macqel.be>. */ + +/* + * NAME + * + * strstr -- locate first occurrence of a substring + * + * SYNOPSIS + * + * char *strstr (char *s1, char *s2) + * + * DESCRIPTION + * + * Locates the first occurrence in the string pointed to by S1 of the string + * pointed to by S2. Returns a pointer to the substring found, or a NULL + * pointer if not found. If S2 points to a string with zero length, the + * function returns S1. + * + * BUGS + * + */ + +char * +strstr (buf, sub) + register char *buf; + register char *sub; +{ + register char *bp; + register char *sp; + + if (!*sub) + return buf; + while (*buf) + { + bp = buf; + sp = sub; + do { + if (!*sp) + return buf; + } while (*bp++ == *sp++); + buf += 1; + } + return 0; +} |