diff options
-rw-r--r-- | CHANGES | 15 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTAccess.c | 32 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 81 | ||||
-rw-r--r-- | WWW/Library/Implementation/dtd_util.c | 6 | ||||
-rw-r--r-- | samples/opaque.lss | 96 | ||||
-rw-r--r-- | src/AttrList.h | 2 | ||||
-rw-r--r-- | src/GridText.c | 56 | ||||
-rw-r--r-- | src/LYCharUtils.c | 4 | ||||
-rw-r--r-- | src/LYStrings.c | 26 | ||||
-rw-r--r-- | src/LYStyle.c | 4 | ||||
-rw-r--r-- | src/LYUtils.c | 11 | ||||
-rw-r--r-- | src/LYrcFile.c | 56 | ||||
-rw-r--r-- | src/parsdate.c | 160 |
13 files changed, 338 insertions, 211 deletions
diff --git a/CHANGES b/CHANGES index 001648a3..b1ca9743 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,22 @@ --- $LynxId: CHANGES,v 1.288 2008/07/19 14:59:01 tom Exp $ +-- $LynxId: CHANGES,v 1.293 2008/08/31 23:31:07 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== 2008-0?-?? (2.8.7dev.10) +* revise introductory comment written to ".lynxrc" (Debian #461158) -TD +* discard anchor's post_data field in HTLoadDocument() if Lynx is about to + reload a document. That would happen if the result of the form includes a + link back to the form. Removing the data causes Lynx to prompt the user, + e.g., + Resubmit POST content to http://localhost/cgi-bin/lynxtest.pl ? (y/n) + to offer the user the choice between revisiting form or re-POST'ing the + data that was on the form (report by Andreas K Foerster) -TD +* fixes for LYHighlight() when the highlighted text is empty -TD +* translate named entities, etc., for "content" field of refresh-URL, cf: + 2.8.5dev.13 (report by Ivan Shmakov) -TD +* suppress computation in TrimmedLength() for source-view, which is not needed + for Debian #204515 (patch by Mike Knight) * add check-po rule to po/makefile -TD * modify top-level makefile to work with configure --srcdir -TD * add update-po rule to top-level makefile -TD diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index 4f4ebd8e..ebcf0863 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -1,4 +1,7 @@ -/* Access Manager HTAccess.c +/* + * $LynxId: HTAccess.c,v 1.66 2008/08/31 22:38:38 tom Exp $ + * + * Access Manager HTAccess.c * ============== * * Authors @@ -681,21 +684,19 @@ static int HTLoad(const char *addr, if (status == HT_FORBIDDEN) { /* prevent crash if telnet or similar was forbidden by rule. - kw */ LYFixCursesOn("show alert:"); - return HTLoadError(sink, 500, gettext("Access forbidden by rule")); + status = HTLoadError(sink, 500, gettext("Access forbidden by rule")); } else if (status == HT_REDIRECTING) { - return status; /* fake redirection by rule, to redirecting_url */ + ; /* fake redirection by rule, to redirecting_url */ + } else if (status >= 0) { + /* prevent crash if telnet or similar mapped or proxied by rule. - kw */ + LYFixCursesOnForAccess(addr, HTAnchor_physical(anchor)); + p = (HTProtocol *) HTAnchor_protocol(anchor); + anchor->parent->underway = TRUE; /* Hack to deal with caching */ + status = p->load(HTAnchor_physical(anchor), + anchor, format_out, sink); + anchor->parent->underway = FALSE; + LYUCPopAssumed(); } - if (status < 0) - return status; /* Can't resolve or forbidden */ - - /* prevent crash if telnet or similar mapped or proxied by rule. - kw */ - LYFixCursesOnForAccess(addr, HTAnchor_physical(anchor)); - p = (HTProtocol *) HTAnchor_protocol(anchor); - anchor->parent->underway = TRUE; /* Hack to deal with caching */ - status = p->load(HTAnchor_physical(anchor), - anchor, format_out, sink); - anchor->parent->underway = FALSE; - LYUCPopAssumed(); return status; } @@ -903,11 +904,12 @@ static BOOL HTLoadDocument(const char *full_address, /* may include #fragment */ return YES; } else { ForcingNoCache = YES; + BStrFree(anchor->post_data); CTRACE((tfp, "HTAccess: Auto-reloading document.\n")); } } - if (text && HText_HaveUserChangedForms(text)) { + if (HText_HaveUserChangedForms(text)) { /* * Issue a warning. User forms content will be lost. * Will not restore changed forms, currently. diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index d00690ee..4c571fd7 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.106 2008/07/15 23:54:39 tom Exp $ + * $LynxId: SGML.c,v 1.109 2008/08/31 18:34:05 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -509,7 +509,7 @@ static void handle_attribute_name(HTStream *context, const char *s) } /* for */ CTRACE((tfp, "SGML: Unknown attribute %s for tag %s\n", - s, context->current_tag->name)); + s, NonNull(context->current_tag->name))); context->current_attribute_number = INVALID; /* Invalid */ } @@ -1371,8 +1371,12 @@ HTTag *SGMLFindTag(const SGML_dtd * dtd, {NULL}; /*optimize using the previous results */ HTTag **res = last + (UCH(*s) % 64); /*pointer arithmetic */ - if (*res && !strcasecomp((*res)->name, s)) - return *res; + if (*res) { + if ((*res)->name == NULL) + return NULL; + if (!strcasecomp((*res)->name, s)) + return *res; + } for (low = 0, high = dtd->number_of_tags; high > low; @@ -1526,6 +1530,39 @@ static void transform_tag(HTStream *context, HTChunk *string) } #endif /* USE_PRETTYSRC */ +static BOOL ignore_when_empty(HTTag * tag) +{ + BOOL result = FALSE; + + if (tag->name != 0 + && tag->contents != SGML_EMPTY + && tag->tagclass != Tgc_Plike + && (tag->tagclass == Tgc_SELECTlike + || (tag->contains && tag->icontains))) { + result = TRUE; + } + CTRACE((tfp, "SGML Do%s ignore_when_empty:%s\n", + result ? "" : " not", + NonNull(tag->name))); + return result; +} + +static void discard_empty(HTStream *context) +{ + CTRACE((tfp, "SGML discarding empty %s\n", + NonNull(context->current_tag->name))); + CTRACE_FLUSH(tfp); + + /* disable start_element() */ + context->current_tag->name = 0; + + /* these may be redundant: */ + context->current_tag->contents = SGML_EMPTY; + context->string->size = 0; + + /* do not call end_element() if start_element() was not called */ +} + static void SGML_character(HTStream *context, char c_in) { const SGML_dtd *dtd = context->dtd; @@ -1750,7 +1787,7 @@ static void SGML_character(HTStream *context, char c_in) * We jump up to here from below if we have * stuff in the recover, insert, or csi buffers * to process. We zero saved_char_in, in effect - * as a flag that the octet in not that of the + * as a flag that the octet is not that of the * actual call to this function. This may be OK * for now, for the stuff this function adds to * its recover buffer, but it might not be for @@ -1788,7 +1825,8 @@ static void SGML_character(HTStream *context, char c_in) */ /* * Works for both ASCII and EBCDIC. -- gil - *//* S/390 -- gil -- 0811 */ + * S/390 -- gil -- 0811 + */ if (TOASCII(unsign_c) < 32 && c != '\t' && c != '\n' && c != '\r' && HTCJK == NOCJK) @@ -1813,7 +1851,7 @@ static void SGML_character(HTStream *context, char c_in) /* Almost all CJK characters are double byte but only Japanese * JIS X0201 Kana is single byte. To prevent to fail SGML parsing - * we have to care them here. -- TH + * we have to take care of them here. -- TH */ if ((HTCJK == JAPANESE) && (context->state == S_in_kanji) && !IS_JAPANESE_2BYTE(context->kanji_buf, UCH(c)) @@ -1861,7 +1899,7 @@ static void SGML_character(HTStream *context, char c_in) case S_tagname_slash: /* * We had something link "<name/" so far, set state to S_text but keep - * context->slashedtag as as a flag; except if we get '>' directly + * context->slashedtag as a flag; except if we get '>' directly * after the "<name/", and really have a tag for that name in * context->slashedtag, in which case keep state as is and let code * below deal with it. - kw @@ -1940,6 +1978,7 @@ static void SGML_character(HTStream *context, char c_in) } context->slashedtag = NULL; } else if (context->slashedtag && + context->slashedtag->name && (c == '/' || (c == '>' && context->state == S_tagname_slash)) && TOASCII(unsign_c) < 127) { @@ -2093,7 +2132,7 @@ static void SGML_character(HTStream *context, char c_in) HTChunkPuts(string, EntityName); HTChunkTerminate(string); #ifdef USE_PRETTYSRC - /* we need to disable it temporary */ + /* we need to disable it temporarily */ if (psrc_view) { psrc_view_backup = 1; psrc_view = 0; @@ -2101,7 +2140,7 @@ static void SGML_character(HTStream *context, char c_in) #endif handle_entity(context, '\0'); #ifdef USE_PRETTYSRC - /* we need to disable it temporary */ + /* we need to disable it temporarily */ if (psrc_view_backup) psrc_view = TRUE; #endif @@ -2216,17 +2255,20 @@ static void SGML_character(HTStream *context, char c_in) * with old servers, and for Lynx). - FM */ case_S_litteral: - case S_litteral: /*PSRC:this case not understood completely by HV, not done */ + case S_litteral: + /*PSRC:this case not understood completely by HV, not done */ HTChunkPutc(string, c); #ifdef USE_PRETTYSRC - if (psrc_view) { /*there is nothing useful in the element_stack */ + if (psrc_view) { + /* there is nothing useful in the element_stack */ testtag = context->current_tag; } else #endif - testtag = context->element_stack ? - context->element_stack->tag : NULL; + testtag = (context->element_stack + ? context->element_stack->tag + : NULL); - if (testtag == NULL) { + if (testtag == NULL || testtag->name == NULL) { string->size--; context->state = S_text; goto top1; @@ -2469,8 +2511,7 @@ static void SGML_character(HTStream *context, char c_in) * Handle a numeric entity. */ case S_incro: -/* S/390 -- gil -- 1075 *//* CTRACE((tfp, "%s: %d: numeric %d %d\n", - __FILE__, __LINE__, unsign_c, c)); */ + /* S/390 -- gil -- 1075 */ if ((TOASCII(unsign_c) < 127) && (context->isHex ? isxdigit(UCH(c)) : isdigit(UCH(c)))) { @@ -3525,10 +3566,8 @@ static void SGML_character(HTStream *context, char c_in) && (string->size == 1) && (string->data[0] == '/')) { if (context->extended_html - && context->current_tag->name) { - CTRACE((tfp, "SGML discarding empty %s\n", context->current_tag->name)); - string->size = 0; - context->current_tag->contents = SGML_EMPTY; + && ignore_when_empty(context->current_tag)) { + discard_empty(context); } } else { HTChunkTerminate(string); diff --git a/WWW/Library/Implementation/dtd_util.c b/WWW/Library/Implementation/dtd_util.c index 87a1b2a7..268d19ed 100644 --- a/WWW/Library/Implementation/dtd_util.c +++ b/WWW/Library/Implementation/dtd_util.c @@ -1,5 +1,5 @@ /* - * $LynxId: dtd_util.c,v 1.27 2008/07/15 22:43:29 tom Exp $ + * $LynxId: dtd_util.c,v 1.28 2008/08/18 23:42:12 tom Exp $ * * Given a SGML_dtd structure, write a corresponding flat file, or "C" source. * Given the flat-file, write the "C" source. @@ -192,7 +192,7 @@ static const char *DEF_name(const SGML_dtd * dtd, int which) typedef struct { const char *name; - attr *attrs; + const attr *attrs; int count; int which; } AttrInfo; @@ -490,7 +490,7 @@ static void dump_header(FILE *output, const SGML_dtd * dtd) fprintf(output, "#endif\t\t\t\t/* %s */\n", marker); } -static void dump_flat_attrs(FILE *output, const char *name, attr * attributes, int number_of_attributes) +static void dump_flat_attrs(FILE *output, const char *name, const attr * attributes, int number_of_attributes) { int n; diff --git a/samples/opaque.lss b/samples/opaque.lss index 864b6f9c..80e39693 100644 --- a/samples/opaque.lss +++ b/samples/opaque.lss @@ -1,48 +1,48 @@ -# From: claudio santambrogio <claudio.santambrogio@tiscali.it> - -em:bold:cyan -strong:bold:cyan -dt:bold:cyan -var:bold:cyan -samp:bold:cyan -b:bold:cyan -i:bold:cyan -alink:reverse:brightgreen:red -a:bold:green -img:dim:cyan:default -status:reverse:cyan:default -fig:normal:gray -caption:reverse:cyan -hr:normal:gray -blockquote:normal:cyan:default -address:normal:cyan -title:normal:cyan:default -tt:normal:white:default -h1:bold:cyan:default -label:normal:cyan -value:normal:cyan -high:bold:cyan -q:normal:cyan -small:dim:cyan -big:bold:cyan -sup:bold:cyan -sub:dim:cyan -lh:bold:cyan -code:normal:cyan -alert:bold:red -normal:normal:brown:black - -span.htmlsrc_comment:normal:white -span.htmlsrc_tag:normal:cyan -##the following makes no difference (except increasing the speed) since tag -##is already in cyan. -#span.htmlsrc_attrib:normal:cyan -#span.htmlsrc_attrval:normal:magenta -span.htmlsrc_abracket:normal:cyan -span.htmlsrc_entity:normal:green -##span.htmlsrc_href: -##span.htmlsrc_entire: -span.htmlsrc_badseq:normal:red -span.htmlsrc_badtag:normal:red -span.htmlsrc_badattr:normal:red -span.htmlsrc_sgmlspecial:normal:yellow +# From: claudio santambrogio <claudio.santambrogio@tiscali.it> + +em:bold:cyan +strong:bold:cyan +dt:bold:cyan +var:bold:cyan +samp:bold:cyan +b:bold:cyan +i:bold:cyan +alink:reverse:brightgreen:red +a:bold:green +img:dim:cyan:default +status:reverse:cyan:default +fig:normal:gray +caption:reverse:cyan +hr:normal:gray +blockquote:normal:cyan:default +address:normal:cyan +title:normal:cyan:default +tt:normal:white:default +h1:bold:cyan:default +label:normal:cyan +value:normal:cyan +high:bold:cyan +q:normal:cyan +small:dim:cyan +big:bold:cyan +sup:bold:cyan +sub:dim:cyan +lh:bold:cyan +code:normal:cyan +alert:bold:red +normal:normal:brown:black + +span.htmlsrc_comment:normal:white +span.htmlsrc_tag:normal:cyan +##the following makes no difference (except increasing the speed) since tag +##is already in cyan. +#span.htmlsrc_attrib:normal:cyan +#span.htmlsrc_attrval:normal:magenta +span.htmlsrc_abracket:normal:cyan +span.htmlsrc_entity:normal:green +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal:red +span.htmlsrc_badtag:normal:red +span.htmlsrc_badattr:normal:red +span.htmlsrc_sgmlspecial:normal:yellow diff --git a/src/AttrList.h b/src/AttrList.h index 5d4015d6..0bfa24a5 100644 --- a/src/AttrList.h +++ b/src/AttrList.h @@ -47,7 +47,7 @@ extern "C" { /* stack of attributes during page rendering */ #define MAX_LAST_STYLES 128 - extern int last_styles[MAX_LAST_STYLES]; + extern int last_styles[MAX_LAST_STYLES + 1]; extern int last_colorattr_ptr; #endif diff --git a/src/GridText.c b/src/GridText.c index 388ac476..27d24e46 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.144 2008/02/11 00:07:05 Paul.B.Mahol Exp $ + * $LynxId: GridText.c,v 1.146 2008/08/31 14:58:57 tom Exp $ * * Character grid hypertext object * =============================== @@ -2754,15 +2754,20 @@ static HTLine *insert_blanks_in_line(HTLine *line, int line_number, } #if defined(USE_COLOR_STYLE) +/* + * Found an OFF change not part of an adjacent matched pair. + * + * Walk backward looking for the corresponding ON change. + * Move everything after split_pos to be at split_pos. + * + * This can only work correctly if all changes are correctly nested! If this + * fails, assume it is safer to leave whatever comes before the OFF on the + * previous line alone. + */ static HTStyleChange *skip_matched_and_correct_offsets(HTStyleChange *end, HTStyleChange *start, unsigned split_pos) -{ /* Found an OFF change not part of an adjacent matched pair. - * Walk backward looking for the corresponding ON change. - * Move everything after split_pos to be at split_pos. - * This can only work correctly if all changes are correctly - * nested! If this fails, assume it is safer to leave whatever - * comes before the OFF on the previous line alone. */ +{ int level = 0; HTStyleChange *tmp = end; @@ -7846,27 +7851,30 @@ static void write_hyphen(FILE *fp) static int TrimmedLength(char *string) { int result = strlen(string); - int adjust = result; - unsigned ch; - while (adjust > 0) { - ch = UCH(string[adjust - 1]); - if (isspace(ch) || IsSpecialAttrChar(ch)) { - --adjust; - } else { - break; - } - } - if (result != adjust) { - char *dst = string + adjust; - char *src = dst; + if (!HTisDocumentSource()) { + int adjust = result; + unsigned ch; - for (;;) { - src = LYSkipBlanks(src); - if ((*dst++ = *src++) == '\0') + while (adjust > 0) { + ch = UCH(string[adjust - 1]); + if (isspace(ch) || IsSpecialAttrChar(ch)) { + --adjust; + } else { break; + } + } + if (result != adjust) { + char *dst = string + adjust; + char *src = dst; + + for (;;) { + src = LYSkipBlanks(src); + if ((*dst++ = *src++) == '\0') + break; + } + result = (dst - string - 1); } - result = (dst - string - 1); } return result; } diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 568e4e96..f268c301 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.89 2007/08/02 19:31:34 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.90 2008/08/31 17:00:05 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -2490,6 +2490,8 @@ void LYHandleMETA(HTStructured * me, const BOOL *present, } else if (!strcasecomp(NonNull(http_equiv), "Refresh")) { char *Seconds = NULL; + LYUCTranslateHTMLString(&content, me->tag_charset, me->tag_charset, + NO, NO, YES, st_other); LYParseRefreshURL(content, &Seconds, &href); if (Seconds) { diff --git a/src/LYStrings.c b/src/LYStrings.c index 2177377d..bb0d7a09 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1,4 +1,4 @@ -/* $LynxId: LYStrings.c,v 1.134 2008/07/04 15:06:56 tom Exp $ */ +/* $LynxId: LYStrings.c,v 1.135 2008/08/31 18:54:07 tom Exp $ */ #include <HTUtils.h> #include <HTCJK.h> #include <UCAux.h> @@ -636,18 +636,22 @@ const char *LYmbcs_skip_glyphs(const char *data, if (n_glyphs < 0) n_glyphs = 0; - if (!data) - return NULL; - if (!utf_flag) - return (data + n_glyphs); - - while (*data) { - if (IS_NEW_GLYPH(*data)) { - if (i_glyphs++ >= n_glyphs) { - return data; + if (!isEmpty(data)) { + if (!utf_flag) { + while (n_glyphs-- > 0) { + if (!*++data) + break; + } + } else { + while (*data) { + if (IS_NEW_GLYPH(*data)) { + if (i_glyphs++ >= n_glyphs) { + break; + } + } + data++; } } - data++; } return data; } diff --git a/src/LYStyle.c b/src/LYStyle.c index 512a5bde..749655f4 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYStyle.c,v 1.61 2007/07/23 19:57:17 tom Exp $ + * $LynxId: LYStyle.c,v 1.62 2008/08/31 16:00:10 tom Exp $ * * character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) @@ -46,7 +46,7 @@ static int cached_styles_rows = 0; static int cached_styles_cols = 0; /* stack of attributes during page rendering */ -int last_styles[MAX_LAST_STYLES] = +int last_styles[MAX_LAST_STYLES + 1] = {0}; int last_colorattr_ptr = 0; diff --git a/src/LYUtils.c b/src/LYUtils.c index 806dfd06..4a7063ab 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,4 +1,4 @@ -/* $LynxId: LYUtils.c,v 1.168 2008/06/29 21:44:03 tom Exp $ */ +/* $LynxId: LYUtils.c,v 1.169 2008/08/31 19:03:45 tom Exp $ */ #include <HTUtils.h> #include <HTTCP.h> #include <HTParse.h> @@ -1085,12 +1085,15 @@ void LYhighlight(int flag, int avail_space = (LYcolLimit - LXP) + (LYcolLimit * (LYlines - LYP)); const char *text = LYGetHiliteStr(cur, 0); + if (text == 0) + text = ""; + if (avail_space > links[cur].l_form->size) avail_space = links[cur].l_form->size; - gllen = LYmbcsstrlen(NonNull(text), utf_flag, NO); - len = LYmbcs_skip_glyphs(NonNull(text), avail_space, utf_flag) - text; - LYwaddnstr(LYwin, NonNull(text), len); + gllen = LYmbcsstrlen(text, utf_flag, NO); + len = LYmbcs_skip_glyphs(text, avail_space, utf_flag) - text; + LYwaddnstr(LYwin, text, len); while (gllen++ < avail_space) LYaddch('_'); diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 11bca175..73c86230 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,4 +1,4 @@ -/* $LynxId: LYrcFile.c,v 1.73 2008/07/02 00:17:13 Paul.B.Mahol Exp $ */ +/* $LynxId: LYrcFile.c,v 1.74 2008/08/31 23:28:15 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <LYUtils.h> @@ -800,13 +800,12 @@ static void write_list(FILE *fp, const char *list) while (*list != 0) { int ch = *list++; + if (first) { + fputs("# ", fp); + first = FALSE; + } if (ch == '\n') { first = TRUE; - } else { - if (first) { - fputs("# ", fp); - first = FALSE; - } } fputc(ch, fp); } @@ -874,13 +873,48 @@ int save_rc(FILE *fp) write_list(fp, gettext("\ Lynx User Defaults File\n\ \n\ +")); + + /* + * We have either the HTML options form, or the older menu, or both. + */ +#ifndef NO_OPTION_FORMS + write_list(fp, gettext("\ +This file contains options saved from the Lynx Options Screen (normally\n\ +with the 'o' key). To save options with that screen, you must select the\n\ +checkbox:\n\ +")); + fprintf(fp, "#\t%s\n", SAVE_OPTIONS); + fprintf(fp, "#\n"); + write_list(fp, gettext("\ +You must then save the settings using the link on the line above the\n\ +checkbox:\n\ +")); + fprintf(fp, "#\t%s\n", ACCEPT_CHANGES); + fprintf(fp, "#\n"); +#ifndef NO_OPTION_MENU + write_list(fp, gettext("\ +You may also use the command-line option \"-forms_options\", which displays\n\ +the simpler Options Menu instead. Save options with that using the '>' key.\n\ +\n\ +")); +#endif +#else /* we only have old options-menu */ + write_list(fp, gettext("\ This file contains options saved from the Lynx Options Screen (normally\n\ -with the '>' key). There is normally no need to edit this file manually,\n\ -since the defaults here can be controlled from the Options Screen, and the\n\ -next time options are saved from the Options Screen this file will be\n\ -completely rewritten. You have been warned...\n\ +with the '>' key).\n\ +\n\ +")); +#endif + + write_list(fp, gettext("\ +There is normally no need to edit this file manually, since the defaults\n\ +here can be controlled from the Options Screen, and the next time options\n\ +are saved from the Options Screen this file will be completely rewritten.\n\ +You have been warned...\n\ +\n\ If you are looking for the general configuration file - it is normally\n\ -called lynx.cfg, and it has different content and a different format.\n\ +called \"lynx.cfg\". It has different content and a different format.\n\ It is not this file.\n\ ")); fprintf(fp, "\n"); diff --git a/src/parsdate.c b/src/parsdate.c index 3af9ce5c..7fa2ba5e 100644 --- a/src/parsdate.c +++ b/src/parsdate.c @@ -3,24 +3,37 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #endif #include <stdlib.h> +#include <string.h> #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define YYPATCH 20050813 - -#define YYEMPTY (-1) -#define yyclearin (yychar = YYEMPTY) -#define yyerrok (yyerrflag = 0) -#define YYRECOVERING (yyerrflag != 0) +#define YYPATCH 20080827 + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +#ifdef YYPARSE_PARAM_TYPE +#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +#else +#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +#endif +#else +#define YYPARSE_DECL() yyparse(void) +#endif /* YYPARSE_PARAM */ -extern int yyparse(void); +extern int YYPARSE_DECL(); static int yygrowstack(void); #define YYPREFIX "yy" #line 2 "parsdate.y" /* - * $LynxId: parsdate.c,v 1.2 2008/07/01 20:14:38 tom Exp $ + * $LynxId: parsdate.c,v 1.3 2008/08/31 16:04:04 tom Exp $ * * This module is adapted and extended from tin, to use for LYmktime(). * @@ -148,7 +161,7 @@ typedef union { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 152 "y.tab.c" +#line 164 "y.tab.c" #define tDAY 257 #define tDAYZONE 258 #define tMERIDIAN 259 @@ -160,19 +173,19 @@ typedef union { #define tZONE 265 #define tDST 266 #define YYERRCODE 256 -short yylhs[] = { -1, +static const short yylhs[] = { -1, 0, 0, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8, 8, 8, 3, 3, }; -short yylen[] = { 2, +static const short yylen[] = { 2, 0, 2, 1, 2, 1, 1, 2, 1, 2, 4, 4, 6, 6, 1, 1, 2, 2, 1, 1, 3, 5, 2, 4, 2, 3, 5, 6, 3, 9, 2, 2, 2, 2, 0, 1, }; -short yydefred[] = { 1, +static const short yydefred[] = { 1, 0, 0, 0, 0, 0, 2, 0, 5, 0, 8, 0, 0, 0, 32, 30, 35, 0, 33, 31, 0, 0, 0, 9, 0, 19, 0, 18, 4, 7, 0, @@ -180,10 +193,10 @@ short yydefred[] = { 1, 0, 23, 0, 11, 10, 0, 0, 26, 0, 0, 21, 0, 27, 13, 12, 0, 0, 29, }; -short yydgoto[] = { 1, +static const short yydgoto[] = { 1, 27, 28, 23, 6, 7, 8, 9, 10, }; -short yysindex[] = { 0, +static const short yysindex[] = { 0, -240, -41, -256, -227, -45, 0, -251, 0, -251, 0, -254, -249, -22, 0, 0, 0, -237, 0, 0, -235, -228, -226, 0, -236, 0, -224, 0, 0, 0, -223, @@ -191,7 +204,7 @@ short yysindex[] = { 0, -215, 0, -218, 0, 0, -217, -216, 0, -214, -234, 0, -8, 0, 0, 0, -213, -212, 0, }; -short yyrindex[] = { 0, +static const short yyrindex[] = { 0, 0, 0, 0, 0, 5, 0, 26, 0, 31, 0, 0, 0, 11, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, @@ -199,11 +212,11 @@ short yyrindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -short yygindex[] = { 0, +static const short yygindex[] = { 0, -17, 44, -31, 0, 0, 0, 0, 0, }; #define YYTABLESIZE 300 -short yytable[] = { 43, +static const short yytable[] = { 43, 34, 22, 12, 45, 34, 41, 24, 13, 38, 30, 22, 25, 21, 26, 31, 15, 2, 44, 55, 3, 20, 32, 4, 5, 16, 3, 33, 34, 25, 37, @@ -235,7 +248,7 @@ short yytable[] = { 43, 20, 0, 3, 20, 20, 3, 0, 6, 14, 3, 6, 14, 0, 24, 6, 14, 24, 0, 0, 24, }; -short yycheck[] = { 58, +static const short yycheck[] = { 58, 0, 47, 44, 35, 0, 45, 258, 264, 26, 264, 0, 263, 58, 265, 264, 0, 257, 35, 50, 260, 0, 44, 263, 264, 259, 0, 264, 263, 263, 266, @@ -273,7 +286,8 @@ short yycheck[] = { 58, #endif #define YYMAXTOKEN 266 #if YYDEBUG -char *yyname[] = { +static const char *yyname[] = { + "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,"','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -284,7 +298,7 @@ char *yyname[] = { "tMERIDIAN","tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tZONE", "tDST", }; -char *yyrule[] = { +static const char *yyrule[] = { "$accept : spec", "spec :", "spec : spec item", @@ -321,6 +335,7 @@ char *yyrule[] = { "rel : tUNUMBER tMONTH_UNIT", "o_merid :", "o_merid : tMERIDIAN", + }; #endif #if YYDEBUG @@ -355,7 +370,7 @@ YYSTYPE yylval; static short *yyss; static short *yysslim; static YYSTYPE *yyvs; -static int yystacksize; +static unsigned yystacksize; #line 350 "parsdate.y" /* @@ -928,11 +943,12 @@ parsedate( * from the error return value. (Alternately could set errno on error.) */ return Start == -1 ? 0 : Start; } -#line 932 "y.tab.c" +#line 946 "y.tab.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(void) { - int newsize, i; + int i; + unsigned newsize; short *newss; YYSTYPE *newvs; @@ -965,16 +981,17 @@ static int yygrowstack(void) return 0; } -#define YYABORT goto yyabort +#define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab +#define YYERROR goto yyerrlab + int -yyparse(void) +YYPARSE_DECL() { - register int yym, yyn, yystate; + int yym, yyn, yystate; #if YYDEBUG - register const char *yys; + const char *yys; if ((yys = getenv("YYDEBUG")) != 0) { @@ -987,11 +1004,13 @@ yyparse(void) yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; + yystate = 0; if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; - *yyssp = yystate = 0; + yystate = 0; + *yyssp = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; @@ -1021,7 +1040,8 @@ yyloop: { goto yyoverflow; } - *++yyssp = yystate = yytable[yyn]; + yystate = yytable[yyn]; + *++yyssp = yytable[yyn]; *++yyvsp = yylval; yychar = YYEMPTY; if (yyerrflag > 0) --yyerrflag; @@ -1037,9 +1057,7 @@ yyloop: yyerror("syntax error"); -#ifdef lint goto yyerrlab; -#endif yyerrlab: ++yynerrs; @@ -1062,7 +1080,8 @@ yyinrecovery: { goto yyoverflow; } - *++yyssp = yystate = yytable[yyn]; + yystate = yytable[yyn]; + *++yyssp = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } @@ -1103,12 +1122,15 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - yyval = yyvsp[1-yym]; + if (yym) + yyval = yyvsp[1-yym]; + else + memset(&yyval, 0, sizeof yyval); switch (yyn) { case 3: #line 146 "parsdate.y" -{ + { yyHaveTime++; #if defined(lint) /* I am compulsive about lint natterings... */ @@ -1120,27 +1142,27 @@ case 3: break; case 4: #line 155 "parsdate.y" -{ + { yyHaveTime++; yyTimezone = yyvsp[0].Number; } break; case 5: #line 159 "parsdate.y" -{ + { yyHaveDate++; } break; case 6: #line 162 "parsdate.y" -{ + { yyHaveDate++; yyHaveTime++; } break; case 7: #line 166 "parsdate.y" -{ + { yyHaveDate++; yyHaveTime++; yyTimezone = yyvsp[0].Number; @@ -1148,13 +1170,13 @@ case 7: break; case 8: #line 171 "parsdate.y" -{ + { yyHaveRel = 1; } break; case 9: #line 176 "parsdate.y" -{ + { if (yyvsp[-1].Number < 100) { yyHour = yyvsp[-1].Number; yyMinutes = 0; @@ -1169,7 +1191,7 @@ case 9: break; case 10: #line 188 "parsdate.y" -{ + { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; yySeconds = 0; @@ -1178,7 +1200,7 @@ case 10: break; case 11: #line 194 "parsdate.y" -{ + { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; yyTimezone = yyvsp[0].Number; @@ -1188,7 +1210,7 @@ case 11: break; case 12: #line 201 "parsdate.y" -{ + { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; yySeconds = yyvsp[-1].Number; @@ -1197,7 +1219,7 @@ case 12: break; case 13: #line 207 "parsdate.y" -{ + { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; yySeconds = yyvsp[-1].Number; @@ -1208,28 +1230,28 @@ case 13: break; case 14: #line 217 "parsdate.y" -{ + { yyval.Number = yyvsp[0].Number; yyDSTmode = DSToff; } break; case 15: #line 221 "parsdate.y" -{ + { yyval.Number = yyvsp[0].Number; yyDSTmode = DSTon; } break; case 16: #line 225 "parsdate.y" -{ + { yyTimezone = yyvsp[-1].Number; yyDSTmode = DSTon; } break; case 17: #line 229 "parsdate.y" -{ + { /* Only allow "GMT+300" and "GMT-0800" */ if (yyvsp[-1].Number != 0) { YYABORT; @@ -1240,14 +1262,14 @@ case 17: break; case 18: #line 237 "parsdate.y" -{ + { yyval.Number = yyvsp[0].Number; yyDSTmode = DSToff; } break; case 19: #line 243 "parsdate.y" -{ + { int i; /* Unix and GMT and numeric timezones -- a little confusing. */ @@ -1269,14 +1291,14 @@ case 19: break; case 20: #line 264 "parsdate.y" -{ + { yyMonth = yyvsp[-2].Number; yyDay = yyvsp[0].Number; } break; case 21: #line 268 "parsdate.y" -{ + { if (yyvsp[-4].Number > 100) { yyYear = yyvsp[-4].Number; yyMonth = yyvsp[-2].Number; @@ -1291,14 +1313,14 @@ case 21: break; case 22: #line 280 "parsdate.y" -{ + { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[0].Number; } break; case 23: #line 284 "parsdate.y" -{ + { yyMonth = yyvsp[-3].Number; yyDay = yyvsp[-2].Number; yyYear = yyvsp[0].Number; @@ -1306,14 +1328,14 @@ case 23: break; case 24: #line 289 "parsdate.y" -{ + { yyDay = yyvsp[-1].Number; yyMonth = yyvsp[0].Number; } break; case 25: #line 293 "parsdate.y" -{ + { yyDay = yyvsp[-2].Number; yyMonth = yyvsp[-1].Number; yyYear = yyvsp[0].Number; @@ -1321,7 +1343,7 @@ case 25: break; case 26: #line 298 "parsdate.y" -{ + { yyDay = yyvsp[-2].Number; yyMonth = yyvsp[-1].Number; yyYear = yyvsp[0].Number; @@ -1329,7 +1351,7 @@ case 26: break; case 27: #line 303 "parsdate.y" -{ + { yyDay = yyvsp[-3].Number; yyMonth = yyvsp[-1].Number; yyYear = -yyvsp[0].Number; @@ -1337,7 +1359,7 @@ case 27: break; case 28: #line 308 "parsdate.y" -{ + { yyDay = yyvsp[-2].Number; yyMonth = -yyvsp[-1].Number; yyYear = -yyvsp[0].Number; @@ -1347,7 +1369,7 @@ case 28: break; case 29: #line 317 "parsdate.y" -{ + { yyMonth = yyvsp[-7].Number; yyDay = yyvsp[-6].Number; yyYear = yyvsp[0].Number; @@ -1358,41 +1380,41 @@ case 29: break; case 30: #line 327 "parsdate.y" -{ + { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; } break; case 31: #line 330 "parsdate.y" -{ + { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; } break; case 32: #line 333 "parsdate.y" -{ + { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 33: #line 336 "parsdate.y" -{ + { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; } break; case 34: #line 341 "parsdate.y" -{ + { yyval.Meridian = MER24; } break; case 35: #line 344 "parsdate.y" -{ + { yyval.Meridian = yyvsp[0].Meridian; } break; -#line 1396 "y.tab.c" +#line 1419 "y.tab.c" } yyssp -= yym; yystate = *yyssp; @@ -1439,7 +1461,7 @@ to state %d\n", YYPREFIX, *yyssp, yystate); { goto yyoverflow; } - *++yyssp = yystate; + *++yyssp = (short) yystate; *++yyvsp = yyval; goto yyloop; |