lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev New items for Options menu (patch, long)


From: Leonid Pauzner
Subject: lynx-dev New items for Options menu (patch, long)
Date: Mon, 28 Dec 1998 00:24:38 +0300 (MSK)

> This should fix the things I broke, and except for LP's patch from today,
> has me up-to-date again (I think).  www.slcc.edu's still down (but

More changes (LYOptions.c):

* Forms-based options menu: prevent spoofing attempts from possible overruns
  (e.g., user can doing 'e'dit in 'o'ptions and got coredump if
  display_char_set got an illegal number like 50, or hang keyboard
  with illegal Line edit style, for example). - LP
* Forms-based options menu: add new logical section - Document Layout,
  currently with "HTML error tolerance" (TagSoup/SortaSGML),
  "Pop-up for select fields", "Show images" (no_alt/labels/links)
  and "Verbose images". New switches added for information purposes mostly,
  they diplicate hot keys but not so hidden from user's view.
  Documentation updated also. (Oh yes, "Line edit style" option now available
  when we have a real choise >1). - LP


Note for Klaus:
please check option_help.html for TagSoup/SortaSGML (near the bottom below),
this features seems to be undocumented at the moment and nobody on lynx-dev
could give a reasonable advice except you :-)



diff -u old/lyoption.c ./lyoption.c
--- old/lyoption.c      Fri Dec 18 14:01:04 1998
+++ ./lyoption.c        Sun Dec 27 22:03:34 1998
@@ -3279,7 +3279,6 @@
        { FALSE,            "Case insensitive",  "case_insensitive" },
        { TRUE,             "Case sensitive",    "case_sensitive" },
        { 0, 0, 0 }};
-static char * select_popups_string     = "select_popups";
 #if defined(USE_SLANG) || defined(COLOR_CURSES)
 static char * show_color_string                = "show_color";
 static OptValues show_color_values[] = {
@@ -3296,8 +3295,28 @@
        { INTERMEDIATE_MODE,    "Intermediate", "Intermediate" },
        { ADVANCED_MODE,        "Advanced",     "Advanced" },
        { 0, 0, 0 }};
-static char * verbose_images_string    = "verbose_images";
 static char * vi_keys_string           = "vi_keys";
+
+/*
+ * Document Layout
+ */
+static char * DTD_recovery_string      = "DTD";
+static OptValues DTD_type_values[] = {
+       /* New_DTD variable */
+       { FALSE,            "relaxed (TagSoup mode)",  "tagsoup" },
+       { TRUE,             "strict (SortaSGML mode)",   "sortasgml" },
+       { 0, 0, 0 }};
+static char * select_popups_string     = "select_popups";
+static char * images_string            = "images";
+static char * images_ignore_all_string  = "ignore";
+static char * images_use_label_string   = "as labels";
+static char * images_use_links_string   = "as links";
+static char * verbose_images_string    = "verbose_images";
+static OptValues verbose_images_type_values[] = {
+       /* verbose_img variable */
+       { FALSE,            "OFF",  "OFF" },
+       { TRUE,             "show filename",     "ON" },
+       { 0, 0, 0 }};

 /*
  * Bookmark Options
@@ -3488,7 +3507,8 @@
  * Security:  some options are disabled in gen_options() under certain
  * conditions.  We *should* duplicate the same conditions here in postoptions()
  * to prevent user with a limited access from editing HTML options code
- * manually and submit it to access the restricted items.  - LP
+ * manually (e.g., doing 'e'dit in 'o'ptions) and submit it to access the
+ * restricted items. Prevent spoofing attempts from index overrun. - LP
  */

 PUBLIC int postoptions ARGS1(
@@ -3593,13 +3613,23 @@

        /* Line edit style: SELECT */
        if (!strcmp(data[i].tag, lineedit_style_string)) {
-           current_lineedit = atoi(data[i].value);
+           int newval = atoi(data[i].value);
+           int j;
+           /* prevent spoofing attempt */
+           for (j = 0; LYLineeditNames[j]; j++) {
+               if (j==newval)  current_lineedit = newval;
+           }
        }

 #ifdef EXP_KEYBOARD_LAYOUT
        /* Keyboard layout: SELECT */
        if (!strcmp(data[i].tag, kblayout_string)) {
-           current_layout = atoi(data[i].value);
+           int newval = atoi(data[i].value);
+           int j;
+           /* prevent spoofing attempt */
+           for (j = 0; LYKbLayoutNames[j]; j++) {
+               if (j==newval)  current_layout = newval;
+           }
        }
 #endif /* EXP_KEYBOARD_LAYOUT */

@@ -3614,6 +3644,12 @@
            case_sensitive = GetOptValues(search_type_values, data[i].value);
        }

+       /* HTML error tolerance: SELECT */
+       if (!strcmp(data[i].tag, DTD_recovery_string)) {
+               New_DTD = GetOptValues(DTD_type_values, data[i].value);
+           HTSwitchDTD(New_DTD);
+       }
+
        /* Select Popups: ON/OFF */
        if (!strcmp(data[i].tag, select_popups_string)) {
            LYSelectPopups = GetOptValues(bool_values, data[i].value);
@@ -3649,9 +3685,22 @@
            }
        }

+       /* Show Images: SELECT */
+       if (!strcmp(data[i].tag, images_string)) {
+           if (!strcmp(data[i].value, images_ignore_all_string)) {
+               pseudo_inline_alts = FALSE;
+               clickable_images = FALSE;
+           } else if (!strcmp(data[i].value, images_use_label_string)) {
+               pseudo_inline_alts = TRUE;
+               clickable_images = FALSE;
+           } else if (!strcmp(data[i].value, images_use_links_string)) {
+               clickable_images = TRUE;
+           }
+       }
+
        /* Verbose Images: ON/OFF */
        if (!strcmp(data[i].tag, verbose_images_string)) {
-           verbose_img = GetOptValues(bool_values, data[i].value);
+           verbose_img = GetOptValues(verbose_images_type_values, 
data[i].value);
        }

        /* VI Keys: ON/OFF */
@@ -3686,13 +3735,14 @@

        /* Assume Character Set: SELECT */
        if (!strcmp(data[i].tag, assume_char_set_string)) {
-           int newval;
+           int newval = UCGetLYhndl_byMIME(data[i].value);

-           newval = UCGetLYhndl_byMIME(data[i].value);
-           if ((raw_mode_old &&
-                newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset))
-              || (!raw_mode_old &&
-                  newval != UCLYhndl_for_unspec)) {
+           if (newval >= 0 && (
+                   (raw_mode_old &&
+                     newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset))
+                   || (!raw_mode_old &&
+                     newval != UCLYhndl_for_unspec)
+               )) {

                UCLYhndl_for_unspec = newval;
                StrAllocCopy(UCAssume_MIMEcharset, data[i].value);
@@ -3702,7 +3752,12 @@

        /* Display Character Set: SELECT */
        if (!strcmp(data[i].tag, display_char_set_string)) {
-           current_char_set = atoi(data[i].value);
+           int newval = atoi(data[i].value);
+           int j;
+           /* prevent spoofing attempt */
+           for (j = 0; LYchar_set_names[j]; j++) {
+               if (j==newval)  current_char_set = newval;
+           }
        }

        /* Raw Mode: ON/OFF */
@@ -3766,7 +3821,7 @@
        /*
         * charset settings: the order is essential here.
         */
-       if (display_char_set_old != current_char_set) {
+       if (display_char_set_old != current_char_set) {
                /*
                 *  Set the LYUseDefaultRawMode value and character
                 *  handling if LYRawMode was changed. - FM
@@ -3777,7 +3832,7 @@
        if (assume_char_set_changed) {
                LYRawMode = (UCLYhndl_for_unspec == current_char_set);
            }
-       if (raw_mode_old != LYRawMode || assume_char_set_changed) {
+       if (raw_mode_old != LYRawMode || assume_char_set_changed) {
                /*
                 *  Set the raw 8-bit or CJK mode defaults and
                 *  character set if changed. - FM
@@ -3945,14 +4000,17 @@
     EndSelect(fp0);

     /* Line edit style: SELECT */
-    PutLabel(fp0, "Line edit style");
-    BeginSelect(fp0, lineedit_style_string);
-    for (i = 0; LYLineeditNames[i]; i++) {
-       char temp[16];
-       sprintf(temp, "%d", i);
-       PutOption(fp0, i==current_lineedit, temp, LYLineeditNames[i]);
+    if (LYLineeditNames[1]) /* well, at least 2 line edit styles available */
+    {
+       PutLabel(fp0, "Line edit style");
+       BeginSelect(fp0, lineedit_style_string);
+       for (i = 0; LYLineeditNames[i]; i++) {
+           char temp[16];
+           sprintf(temp, "%d", i);
+           PutOption(fp0, i==current_lineedit, temp, LYLineeditNames[i]);
+       }
+       EndSelect(fp0);
     }
-    EndSelect(fp0);

 #ifdef EXP_KEYBOARD_LAYOUT
     /* Keyboard layout: SELECT */
@@ -3971,12 +4029,6 @@
     PutTextInput(fp0, mail_address_string,
                NOTEMPTY(personal_mail_address), text_len, "");

-    /* Select Popups: ON/OFF */
-    PutLabel(fp0, gettext("Popups for select fields"));
-    BeginSelect(fp0, select_popups_string);
-    PutOptValues(fp0, LYSelectPopups, bool_values);
-    EndSelect(fp0);
-
     /* Search Type: SELECT */
     PutLabel(fp0, gettext("Searching type"));
     BeginSelect(fp0, search_type_string);
@@ -4039,22 +4091,52 @@
     PutOptValues(fp0, user_mode, user_mode_values);
     EndSelect(fp0);

-    /* Verbose Images: ON/OFF */
-    PutLabel(fp0, gettext("Verbose images"));
-    BeginSelect(fp0, verbose_images_string);
-    PutOptValues(fp0, verbose_img, bool_values);
-    EndSelect(fp0);
-
     /* VI Keys: ON/OFF */
     PutLabel(fp0, gettext("VI keys"));
     BeginSelect(fp0, vi_keys_string);
     PutOptValues(fp0, vi_keys, bool_values);
     EndSelect(fp0);

-
     /* X Display: INPUT */
     PutLabel(fp0, gettext("X Display"));
     PutTextInput(fp0, x_display_string, NOTEMPTY(x_display), text_len, "");
+
+    /*
+     * Document Layout
+     */
+    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Document Layout"));
+
+       /* HTML error tolerance: SELECT */
+    PutLabel(fp0, gettext("HTML error tolerance"));
+    BeginSelect(fp0, DTD_recovery_string);
+    PutOptValues(fp0, New_DTD, DTD_type_values);
+    EndSelect(fp0);
+
+    /* Select Popups: ON/OFF */
+    PutLabel(fp0, gettext("Popups for select fields"));
+    BeginSelect(fp0, select_popups_string);
+    PutOptValues(fp0, LYSelectPopups, bool_values);
+    EndSelect(fp0);
+
+    /* Show Images: SELECT */
+    PutLabel(fp0, gettext("Show images"));
+    BeginSelect(fp0, images_string);
+    PutOption(fp0, !pseudo_inline_alts && !clickable_images,
+       images_ignore_all_string,
+       images_ignore_all_string);
+    PutOption(fp0, pseudo_inline_alts && !clickable_images,
+       images_use_label_string,
+       images_use_label_string);
+    PutOption(fp0, clickable_images,
+       images_use_links_string,
+       images_use_links_string);
+    EndSelect(fp0);
+
+    /* Verbose Images: ON/OFF */
+    PutLabel(fp0, gettext("Verbose images"));
+    BeginSelect(fp0, verbose_images_string);
+    PutOptValues(fp0, verbose_img, verbose_images_type_values);
+    EndSelect(fp0);

     /*
      * Bookmark Options
diff -u old/option_h.htm ./option_h.htm
--- old/option_h.htm    Sat Dec 12 20:10:36 1998
+++ ./option_h.htm      Sun Dec 27 22:24:20 1998
@@ -19,15 +19,20 @@
 <LI><A HREF="#EM">Emacs keys</A>
 <LI><A HREF="#LL">Execution links</A>
 <LI><A HREF="#KM">Keypad mode</A>
+<LI><A HREF="#LE">Line edit style</A>
 <LI><A HREF="#PM">Personal Mail Address</A>
-<LI><A HREF="#PU">Pop-ups for select fields</A>
 <LI><A HREF="#ST">Searching type</A>
 <LI><A HREF="#SC">Show color</A>
 <LI><A HREF="#CL">Show cursor for current link or option</A>
 <LI><A HREF="#UM">User Mode</A>
-<LI><A HREF="#VB">Verbose Images</A>
 <LI><A HREF="#VI">VI keys</A>
 <LI><A HREF="#DV">X DISPLAY variable</A></UL>
+<LI>Document Layout
+<UL>
+<LI><A HREF="#tagsoup">HTML error tolerance</A>
+<LI><A HREF="#PU">Pop-ups for select fields</A>
+<LI><A HREF="#SI">Show Images</A>
+<LI><A HREF="#VB">Verbose Images</A></UL>
 <LI>Bookmark Options
 <UL>
 <LI><A HREF="#MB">Multi-bookmarks</A>
@@ -47,9 +52,6 @@
 <LI><A HREF="#PC">Preferred Document Charset</A>
 <LI><A HREF="#PL">Preferred Document Language</A>
 <LI><A HREF="#UA">User Agent</A></UL>
-<LI> -- not in Options Form --
-<UL>
-<LI><A HREF="#LE">Line edit style</A></UL>
 </UL>

 <H1><A NAME="CK">Cookies</A></H1>
@@ -156,6 +158,33 @@
 <dt><EM>Intermediate (normal)</EM>: Normal status-line messages appear.
 <dt><EM>Advanced</EM>: The URL is shown on the status line.
 </dl>
+
+<H1><A NAME="tagsoup">HTML error tolerance</A></H1>
+
+While the proper HTML markup should be canonical, badly nested HTML pages
+may be recovered in different ways.  There are two error recovery modes
+in Lynx: SortaSGML with the recovery at SGML stage and TagSoup mode
+with the recovery at HTML parsing stage, the letter gives more
+recovery and was the default in Lynx 2.7.2 and before,
+and the first may be useful for page validation purposes.
+One particular difference known for &lt;li&gt;..&lt;/li&gt;
+or similar strong markup inside &lt;a HREF="some.url"&gt;..&lt;/a&gt;
+anchore text - those links are not reachable in SortaSGML
+(such markup should be placed outside &lt;a&gt;..&lt;/a&gt; indeed).
+Default recovery mode can also be switched with CTRL-V key,
+from lynx.cfg or command line switch.
+
+
+<H1><A NAME="SI">Show Images</A></H1>
+
+Text-based browser cannot show images directly, so we have a choise:
+ignore all images without ALT= text string (this also switched by
+<A HREF="../Lynx_users_guide.html#[-key">'[' key</A>),
+show labels (see also "verbose images" for choise between [IMAGE] and 
filename),
+use links for every image to make it possible to download them
+(also switched by <A HREF="../Lynx_users_guide.html#*-key">'*' key</A>).
+Changing of these setings will not be saved but could be made permanent
+by changing respective settings in lynx.cfg.

 <H1><A NAME="VB">Verbose Images</A></H1>

diff -u old/lynx_use.htm ./lynx_use.htm
--- old/lynx_use.htm    Fri Dec 25 14:20:50 1998
+++ ./lynx_use.htm      Sun Dec 27 21:54:12 1998
@@ -1218,7 +1218,7 @@
            create a log can be toggled on with the <em>-tlog</em> switch.
            Note that this ability is disabled in anonymous or validation
            accounts.
-   <dt><em>*</em>
+   <dt><A NAME="*-key"><em>*</em></A>
        <dd>The '<em>*</em>' command toggles image_links mode on and off.
            When on, links will be created for all images, including inlines.
            If you have an image viewer mapped to the image's MIME type, you
@@ -1229,7 +1229,7 @@
            When on, the charset is assumed to match the selected character
            set and 8-bit characters are not reverse translated with respect
            to the ISO-8859-1 conversion tables.
-   <dt><em>[</em>
+   <dt><A NAME="[-key"><em>[</em></A>
        <dd>The '<em>[</em>' command toggles pseudo_inlines mode on and off.
            When on, inline images which have no ALT string specified will
            have an <em>[INLINE]</em> pseudo-ALT string inserted in the Lynx



reply via email to

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