diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1999-05-28 14:18:50 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1999-05-28 14:18:50 -0400 |
commit | 132787852d4cabd16c3fb46ecda9f5f544d60abd (patch) | |
tree | 314cf32e062373ea172e7087034c01fefcb84712 | |
parent | 953d3d55fdeda61c1de8ca84cb0a561eb39777bf (diff) | |
download | lynx-snapshots-132787852d4cabd16c3fb46ecda9f5f544d60abd.tar.gz |
snapshot of project "lynx", label v2-8-2pre_8
-rw-r--r-- | CHANGES | 48 | ||||
-rw-r--r-- | config.hin | 6 | ||||
-rw-r--r-- | makefile.in | 6 | ||||
-rw-r--r-- | src/GridText.c | 96 | ||||
-rw-r--r-- | src/GridText.h | 1 | ||||
-rw-r--r-- | src/HTAlert.c | 8 | ||||
-rw-r--r-- | src/LYMainLoop.c | 16 | ||||
-rw-r--r-- | src/LYOptions.c | 37 | ||||
-rw-r--r-- | src/LYStrings.c | 4 | ||||
-rw-r--r-- | src/LYStyle.c | 18 | ||||
-rw-r--r-- | userdefs.h | 4 |
11 files changed, 156 insertions, 88 deletions
diff --git a/CHANGES b/CHANGES index 979d81a1..eb1e6d07 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,24 @@ Changes since Lynx 2.8 release =============================================================================== +1999-05-28 (2.8.2pre.7) +* when reloading/reparsing the document with forms, issue a warning only when + user input is detected (forms content is changed from its default so + information will be lost). New function HText_HaveUserChangedForms() is + called from HTReparse_document() and HTuncache_current_document() -LP +* fix exit from postoptions() when need_reload is set but no source_cache, + was broken in dev23 -LP +* remove unneeded float from integer calculations -LP +* move comment for 'const' off the definition line, to simplify debugging + configure problem on HPUX for David Eaton -TD +* move LYGetYX() out of conditional expression, just in case it cannot be + evaluated as a function, i.e., return a value (from bug report by David + Eaton) -TD +* make install for COPYHEADER and COPYING work when the build directory is not + the top source directory -PG +* add check to FastTrimColorClass() to avoid updating stylename and pointer + into it when the tag to be trimmed is not found (fixes a core dump reported + by VH) -TD 1999-05-25 (2.8.2pre.7) * update illustration of forms options menu in Lynx User Guide according to current lynx output -LP @@ -25,11 +43,11 @@ Changes since Lynx 2.8 release 1999-05-24 (2.8.2pre.6) * fix for problem reported by LP -VH Load an html file with META charset and switch "\" to source mode. Now press - ^R to reload: + ^R to reload: (1) In -prettysrc case you got a broken document (charset will be assumed by lynx from assume_charset or assume_local_charset, not from a META charset which was previously pushed with LYPushAssumed() so you get a problem with - 8bit documents when assume_charset != META charset). + 8bit documents when assume_charset != META charset). (2) Without -prettysrc you got a document handled properly via META charset assumption. Now if you press ^R again you will get a broken document. * LYK_SOURCE & HTreparse_document(): when using SOURCE_CACHE_MEMORY fix tiny @@ -188,20 +206,11 @@ Changes since Lynx 2.8 release Harper) this is a detail I overlooked in dev.18 -TD * fixes to compile with SunOS K&R cc -TD 1999-04-27 (2.8.2dev.25) -* fix reload_read_cfg() to avoid persistent cookies mode changing at run time; - reload printers list, downloaders list, environments - as expected. - LP -* fixes for SOURCE_CACHE!=NONE mode, trying to accommodate HTreparse_document() - for mainloop() events: - - add/use flag "from_source_cache" for better mainloop maintenance - - add partial display mode for HTreparse_document() operations - - add warning when the reparsed document may lost its forms content - - fix options menu staff to use HTreparse_document() when possible - LP -* fix exit from postoptions() when the reloaded document was in source mode -LP * updates to INSTALLATION -HN -* undo some redundant dev23 changes, in particular the absence of first - PSRC_TEST responsible for a wrong line breaking in -prettysrc mode (try "lynx - . -prettysrc" and press "\" to see wrapping in dev23-24). Also fix Visited - Links for internal pages (my fault) -LP +* undo some redundant dev23 changes, in particular PSRC_TEST in HText_new + was responsible for a wrong line breaking in -prettysrc mode + (try "lynx . -prettysrc" and press "\" to see wrapping with altered + define). Also fix Visited Links for internal pages -LP * restore links in lynx-dev.html to original form, to make redirection work properly -TD * add to MAKEFILE.W32 (untested - suggested by LP) -TD @@ -304,6 +313,15 @@ Changes since Lynx 2.8 release * fix redefinition of h_errno (report by Tony Bolton) -TD * ifdef'd print_local_dir in HTFile.c since this function does not compile on VMS (report by Andy Harper, Tony Bolton) -TD +* fix reload_read_cfg() to avoid persistent cookies mode changing at run time; + reload printers list, downloaders list, environments - as expected. - LP +* fixes for SOURCE_CACHE!=NONE mode, trying to accommodate HTreparse_document() + for mainloop() events: + - add/use flag "from_source_cache" for better mainloop maintenance + - add partial display mode for HTreparse_document() operations + - add warning when the reparsed document may lose its forms content + - fix options menu stuff to use HTreparse_document() when possible - LP +* fix exit from postoptions() when the reloaded document was in source mode -LP * update flags to correct behavior with SOURCE_CACHE!=NONE: the length of the re-rendered text may vary so the scrolling down is broken (especially nice when switching to source). ("more" updated, "lines_in_file" inlined) -LP diff --git a/config.hin b/config.hin index ef77977e..35793042 100644 --- a/config.hin +++ b/config.hin @@ -184,9 +184,11 @@ #undef uid_t /* defined by AC_TYPE_UID_T */ #undef vfork /* defined by AC_FUNC_FORK */ -/* 'const' may be defined externally by the compiler-wrapper, as in 'unproto' */ +/* 'const' may be defined externally by the compiler-wrapper, as in 'unproto' + * or by AC_C_CONST + */ #ifndef const -#undef const /* defined by AC_C_CONST */ +#undef const #endif /* FIXME:ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ diff --git a/makefile.in b/makefile.in index 9707d005..d18c00c2 100644 --- a/makefile.in +++ b/makefile.in @@ -311,7 +311,7 @@ install-full: install install-help install-doc install-bin: $(BINDIR) @MSG_DIR_MAKE@ cd po && $(MAKE) CC="$(CC)" install -mv -f $(BINDIR)/lynx$x $(BINDIR)/lynx.old - $(INSTALL_PROGRAM) lynx$x $(BINDIR)/lynx$x + $(INSTALL_PROGRAM) lynx$x $(BINDIR)/lynx$x install-man : $(MANDIR) $(INSTALL_DATA) $(srcdir)/lynx.man $(MANDIR)/lynx.1 @@ -372,8 +372,8 @@ install-help : $(DOCDIR) $(HELPDIR) $(LIBDIR)/lynx.tmp >$(LIBDIR)/lynx.cfg chmod 644 $(LIBDIR)/lynx.cfg -rm -f $(LIBDIR)/lynx.tmp - $(INSTALL_DATA) COPYHEADER $(DOCDIR)/COPYHEADER - $(INSTALL_DATA) COPYING $(DOCDIR)/COPYING + $(INSTALL_DATA) $(srcdir)/COPYHEADER $(DOCDIR)/COPYHEADER + $(INSTALL_DATA) $(srcdir)/COPYING $(DOCDIR)/COPYING cd $(HELPDIR) && ( \ ln $(DOCDIR)/COPYHEADER . || cp $(DOCDIR)/COPYHEADER . ; \ ln $(DOCDIR)/COPYING . || cp $(DOCDIR)/COPYING . ) diff --git a/src/GridText.c b/src/GridText.c index b0e3238b..d3d7e2ea 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -6145,6 +6145,13 @@ PUBLIC void HTuncache_current_document NOARGS if (HTMainText) { HTParentAnchor * htmain_anchor = HTMainText->node_anchor; + if (HText_HaveUserChangedForms()) { + /* + * Issue a warning. User forms content will be lost. + */ + HTAlert(RELOADING_FORM); + } + if (htmain_anchor) { if (!(HTOutputFormat && HTOutputFormat == WWW_SOURCE)) { FREE(htmain_anchor->UCStages); @@ -6218,11 +6225,9 @@ PUBLIC BOOLEAN HTreparse_document NOARGS display_partial = display_partial_flag; /* restore */ Newline_partial = Newline; /* initialize */ #endif - if (lynx_mode == FORMS_LYNX_MODE) { + if (HText_HaveUserChangedForms()) { /* - * Note that if there are no form links on the current - * page, lynx_mode won't have this setting and we won't - * know that this warning should be issued. - FM + * Issue a warning. Will not restore changed forms, currently. */ HTAlert(RELOADING_FORM); } @@ -6266,11 +6271,9 @@ PUBLIC BOOLEAN HTreparse_document NOARGS display_partial = display_partial_flag; /* restore */ Newline_partial = Newline; /* initialize */ #endif - if (lynx_mode == FORMS_LYNX_MODE) { + if (HText_HaveUserChangedForms()) { /* - * Note that if there are no form links on the current - * page, lynx_mode won't have this setting and we won't - * know that this warning should be issued. - FM + * Issue a warning. Will not restore changed forms, currently. */ HTAlert(RELOADING_FORM); } @@ -8869,7 +8872,6 @@ PUBLIC void HText_DisableCurrentForm NOARGS if (anchor_ptr == HTMainText->last_anchor) break; - anchor_ptr = anchor_ptr->next; } @@ -8882,49 +8884,99 @@ PUBLIC void HText_ResetForm ARGS1( TextAnchor * anchor_ptr; _statusline(RESETTING_FORM); - if (!HTMainText) + if (HTMainText == 0) return; /* * Go through list of anchors and reset values. */ anchor_ptr = HTMainText->first_anchor; - while (anchor_ptr) { + while (anchor_ptr != 0) { if (anchor_ptr->link_type == INPUT_ANCHOR) { if (anchor_ptr->input_field->number == form->number) { - if (anchor_ptr->input_field->type == F_RADIO_TYPE || - anchor_ptr->input_field->type == F_CHECKBOX_TYPE) { + if (anchor_ptr->input_field->type == F_RADIO_TYPE || + anchor_ptr->input_field->type == F_CHECKBOX_TYPE) { if (anchor_ptr->input_field->orig_value[0] == '0') anchor_ptr->input_field->num_value = 0; else anchor_ptr->input_field->num_value = 1; - } else if (anchor_ptr->input_field->type == - F_OPTION_LIST_TYPE) { + } else if (anchor_ptr->input_field->type == + F_OPTION_LIST_TYPE) { anchor_ptr->input_field->value = anchor_ptr->input_field->orig_value; anchor_ptr->input_field->cp_submit_value = anchor_ptr->input_field->orig_submit_value; - } else { + } else { StrAllocCopy(anchor_ptr->input_field->value, - anchor_ptr->input_field->orig_value); - } - } else if (anchor_ptr->input_field->number > form->number) { - break; - } - + anchor_ptr->input_field->orig_value); + } + } else if (anchor_ptr->input_field->number > form->number) { + break; + } } if (anchor_ptr == HTMainText->last_anchor) break; + anchor_ptr = anchor_ptr->next; + } +} + +/* + * This function is called before reloading/reparsing current document to find + * whether any forms content was changed by user so any information will be + * lost. + */ +PUBLIC BOOLEAN HText_HaveUserChangedForms NOARGS +{ + TextAnchor * anchor_ptr; + + if (HTMainText == 0) + return FALSE; + + /* + * Go through list of anchors to check if any value was changed. + * This code based on HText_ResetForm() + */ + anchor_ptr = HTMainText->first_anchor; + while (anchor_ptr != 0) { + if (anchor_ptr->link_type == INPUT_ANCHOR) { + + if (anchor_ptr->input_field->type == F_RADIO_TYPE || + anchor_ptr->input_field->type == F_CHECKBOX_TYPE) { + + if ((anchor_ptr->input_field->orig_value[0] == '0' && + anchor_ptr->input_field->num_value == 1) || + (anchor_ptr->input_field->orig_value[0] != '0' && + anchor_ptr->input_field->num_value == 0)) + return TRUE; + + } else if (anchor_ptr->input_field->type == F_OPTION_LIST_TYPE) { + if (strcmp(anchor_ptr->input_field->value, + anchor_ptr->input_field->orig_value)) + return TRUE; + + if (strcmp(anchor_ptr->input_field->cp_submit_value, + anchor_ptr->input_field->orig_submit_value)) + return TRUE; + + } else { + if (strcmp(anchor_ptr->input_field->value, + anchor_ptr->input_field->orig_value)) + return TRUE; + } + } + if (anchor_ptr == HTMainText->last_anchor) + break; anchor_ptr = anchor_ptr->next; } + return FALSE; } PUBLIC void HText_activateRadioButton ARGS1( diff --git a/src/GridText.h b/src/GridText.h index f82dd2d2..1eeba7b2 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -232,6 +232,7 @@ extern void HText_SubmitForm PARAMS(( extern void HText_DisableCurrentForm NOPARAMS; extern void HText_ResetForm PARAMS((FormInfo *form)); extern void HText_activateRadioButton PARAMS((FormInfo *form)); +extern BOOLEAN HText_HaveUserChangedForms NOPARAMS; extern HTList * search_queries; /* Previous isindex and whereis queries */ extern void HTSearchQueries_free NOPARAMS; diff --git a/src/HTAlert.c b/src/HTAlert.c index d16b2665..40d3c3d5 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -521,10 +521,10 @@ PUBLIC BOOL HTConfirmCookie ARGS4( ** the whole cookie. Reduce them both by a percentage. ** This should be smarter. */ - float percentage; - percentage = (float)space_free/(float)(namelen + valuelen); - namelen = (int)(percentage*(float)namelen); - valuelen = (int)(percentage*(float)valuelen); + int percentage; /* no float */ + percentage = (100 * space_free) / (namelen + valuelen); + namelen = (percentage * namelen) / 100; + valuelen = (percentage * valuelen) / 100; } if(!LYAcceptAllCookies) { char *message = 0; diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 1ddee54e..8bdc0ae0 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1945,14 +1945,6 @@ new_cmd: /* * this. As the problems show up, we'll try to fix them, * or add warnings. - FM) */ - if (lynx_mode == FORMS_LYNX_MODE) { - /* - * Note that if there are no form links on the current - * page, lynx_mode won't have this setting and we won't - * know that this warning should be issued. - FM - */ - HTAlert(RELOADING_FORM); - } newdoc.line = curdoc.line; newdoc.link = curdoc.link; #endif /* NO_ASSUME_SAME_DOC */ @@ -3920,14 +3912,6 @@ if (!LYUseFormsOptions) { } } #endif - if (lynx_mode == FORMS_LYNX_MODE) { - /* - * Note that if there are no form links on the current - * page, lynx_mode won't have this setting and we won't - * know that this warning should be issued. - FM - */ - HTAlert(RELOADING_FORM); - } HEAD_request = HTLoadedDocumentIsHEAD(); HTuncache_current_document(); #ifdef NO_ASSUME_SAME_DOC diff --git a/src/LYOptions.c b/src/LYOptions.c index 6d52e11f..0884d18a 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1931,7 +1931,7 @@ draw_bookmark_list: if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) { for (a = ((MBM_V_MAXFILES/2 + 1) * (MBM_current - 1)); - a <= ((float)MBM_V_MAXFILES/2 * MBM_current); a++) { + a <= (MBM_current * MBM_V_MAXFILES/2 ); a++) { move((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 5); addch((unsigned char)(a + 'A')); addstr(" : "); @@ -3513,7 +3513,7 @@ PRIVATE int gen_options PARAMS((char **newfile)); * manually (e.g., doing 'e'dit in 'o'ptions) and submit it to access the * restricted items. Prevent spoofing attempts from index overrun. - LP * - * Exit status: NULLFILE (reloading) or NORMAL (from HText cache). + * Exit status: NULLFILE (reload) or NORMAL (use HText cache). * * On exit, got the document which was current before the Options menu: * @@ -3943,6 +3943,10 @@ PUBLIC int postoptions ARGS1( * Being out of mainloop()/getfile() cycle, do things manually. */ CTRACE(tfp, "\nLYOptions.c/postoptions(): exiting...\n"); + CTRACE(tfp, " need_reload = %s\n", + need_reload ? "TRUE" : "FALSE"); + CTRACE(tfp, " need_end_reload = %s\n", + need_end_reload ? "TRUE" : "FALSE"); /* Options menu was pushed before postoptions(), so pop-up. */ LYpop(newdoc); @@ -3965,7 +3969,8 @@ PUBLIC int postoptions ARGS1( if (!HTLoadAbsolute(&WWWDoc)) return(NOT_FOUND); - HTuncache_current_document(); /* will never use again */ + /* comment out to avoid warning when removing forms content... */ + /* HTuncache_current_document(); */ /* will never use again */ /* * Return to previous doc, not to options menu! @@ -3991,6 +3996,11 @@ PUBLIC int postoptions ARGS1( if (!HTLoadAbsolute(&WWWDoc)) return(NOT_FOUND); + /* + * Now most interesting part: reload document when necessary. + * ********************************************************** + */ + reloading = FALSE; /* set manually */ /* force end-to-end reload from remote server if change LYUserAgent * or language or pref_charset (marked by need_end_reload flag above), @@ -4011,7 +4021,7 @@ PUBLIC int postoptions ARGS1( * case LYK_RELOAD (see comments there). - KW */ reloading = TRUE; /* global flag */ - need_reload = TRUE; + need_reload = TRUE; /* this was probably already TRUE, don't worry */ } if (need_reload == FALSE) { @@ -4022,8 +4032,7 @@ PUBLIC int postoptions ARGS1( /* update HText cache */ /* - * Check to see if should reload source, or load html - * (from LYK_RELOAD & LYK_OPTIONS) + * see LYK_RELOAD & LYK_OPTIONS in mainloop for details... */ if (HTisDocumentSource()) { #ifndef USE_PSRC @@ -4035,14 +4044,6 @@ PUBLIC int postoptions ARGS1( HTOutputFormat = WWW_SOURCE; #endif } - if (lynx_mode == FORMS_LYNX_MODE) { - /* Sorry! lynx_mode set according the last display_page() state, - * it always in form mode since we came from form-based option menu - * so the information from mainloop() apperently lost. - * reset here until we learn how to do it properly. - */ - lynx_mode = NORMAL_LYNX_MODE; - } #ifdef SOURCE_CACHE if (reloading == FALSE) { /* one more attempt to be smart enough: */ @@ -4053,10 +4054,14 @@ PUBLIC int postoptions ARGS1( } #endif HEAD_request = HTLoadedDocumentIsHEAD(); - /* no uncache, already loaded */ + /* uncache and load again */ + HTuncache_current_document(); + LYpush(newdoc, FALSE); CTRACE(tfp, "LYOptions.c/postoptions(): now really exit.\n\n"); - return(NORMAL); + return(NULLFILE); } + + /******** Done! **************************************************/ } PRIVATE char *NewSecureValue NOARGS diff --git a/src/LYStrings.c b/src/LYStrings.c index 1e725ee1..0b493dd7 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -245,10 +245,10 @@ PRIVATE int set_clicked_link ARGS3( if (cur_err == 0) { int cury, curx; + LYGetYX(cury,curx); if (code != FOR_INPUT /* Do not pick up the current input field */ - || !(LYGetYX(cury,curx), - (cury == y && (curx >= lx) && ((curx - lx) <= len)))) { + || !((cury == y && (curx >= lx) && ((curx - lx) <= len)))) { if (is_text) have_levent = 1; mouse_link = i; diff --git a/src/LYStyle.c b/src/LYStyle.c index f2be6970..a2accfb8 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,6 +1,6 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * @Id: LYStyle.c 1.27 Wed, 05 May 1999 18:33:59 -0600 dickey @ + * $Id: LYStyle.c,v 1.21 1999/05/28 14:18:50 tom Exp $ */ #include <HTUtils.h> #include <HTML.h> @@ -477,16 +477,22 @@ PUBLIC void FastTrimColorClass ARGS5 ( int*, phcode) /*will be modified*/ { char* tag_start = *pstylename_end; + BOOLEAN found = FALSE; while (tag_start >= stylename) { - for (; tag_start >= stylename && *tag_start!=';' ; --tag_start) + for (; (tag_start >= stylename) && (*tag_start != ';') ; --tag_start) ; - if ( !strncasecomp(tag_start+1, tag_name, name_len) ) break; - --tag_start; + if ( !strncasecomp(tag_start+1, tag_name, name_len) ) { + found = TRUE; + break; + } + --tag_start; + } + if (found) { + *tag_start = '\0'; + *pstylename_end = tag_start; } - *tag_start = '\0'; - *pstylename_end = tag_start; *phcode = hash_code(tag_start+1); } diff --git a/userdefs.h b/userdefs.h index 52ce341f..afc0623d 100644 --- a/userdefs.h +++ b/userdefs.h @@ -1244,12 +1244,12 @@ * the version definition with the Project Version on checkout. Just * ignore it. - kw */ /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */ -#define LYNX_VERSION "2.8.2pre.7" +#define LYNX_VERSION "2.8.2pre.8" #define LYNX_WWW_HOME "http://lynx.browser.org/" #define LYNX_WWW_DIST "http://www.slcc.edu/lynx/current/" #define LYNX_RELEASE FALSE /* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */ -#define LYNX_DATE "Tue, 25 May 1999 11:13:02 -0600" +#define LYNX_DATE "Fri, 28 May 1999 08:04:01 -0600" #define LYNX_DATE_OFF 5 /* truncate the automatically-generated date */ #define LYNX_DATE_LEN 11 /* truncate the automatically-generated date */ #define LYNX_RELEASE_DATE "1998" |