lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev pre4 (patch) forms options page logic corrected


From: Leonid Pauzner
Subject: lynx-dev pre4 (patch) forms options page logic corrected
Date: Tue, 18 May 1999 20:38:56 +0400 (MSD)

* Fix core dump when starting "lynx LYNXOPTIONS:" command.
  All phases of forms options logic now handled by postoptions():
  LYNXOPTIONS:/ without post_data create a page (gen_options() now PRIVATE),
  LYNXOPTIONS:/ with post_data do proccess changes as before.
  Also LYK_ADD_BOOKMARK fixed: forms options page will not be added
  to bookmarks file.


diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Tue May 18 06:12:28 1999
+++ ./lymainlo.c        Tue May 18 09:58:06 1999
@@ -3952,32 +3952,40 @@
 #endif /* !NO_OPTION_MENU */
 #ifndef NO_OPTION_FORMS
            /*
-            * FIXME: Blatantly stolen from LYK_PRINT below,
-            * except ForcePush special.
+            * Generally stolen from LYK_COOKIE_JAR.
+            * Options menu handling done in postoptions()
+            * called from getfile() currently.
+            *
+            * postoptions() also responsible for reloading the document
+            * before the 'options menu' but only when (few) important options
+            * were changed.
+            *
+            * It is critical that post_data is free'd here
+            * since the submition of changed options done
+            * via the same protocol LYNXOPTIONS:
             */
            /*
             *  Don't do if already viewing options page.
             */
            if (strcmp((curdoc.title ? curdoc.title : ""), OPTIONS_TITLE)) {

-               if (gen_options(&newdoc.address) < 0)
-                   break;
-               StrAllocCopy(newdoc.title, OPTIONS_TITLE);
+               StrAllocCopy(newdoc.address, "LYNXOPTIONS:/");
                FREE(newdoc.post_data);
                FREE(newdoc.post_content_type);
                FREE(newdoc.bookmark);
                newdoc.isHEAD = FALSE;
                newdoc.safe = FALSE;
-               if (check_realm)
+               newdoc.internal_link = FALSE;
+               LYforce_no_cache = TRUE;
+               if (LYValidate || check_realm) {
                    LYPermitURL = TRUE;
-
+               }
+           } else {
                /*
-                * FIXME:  this was a temporary solution until we find the
-                * correct place in postoptions() to reload the document
-                * before the 'options menu' only when (few) important options
-                * were changed.
+                *  If already in the options menu, get out.
                 */
-               /* HTuncache_current_document(); */
+               cmd = LYK_PREV_DOC;
+               goto new_cmd;
            }
 #endif /* !NO_OPTION_FORMS */
            break;
@@ -4919,6 +4927,8 @@
                       DOWNLOAD_OPTIONS_TITLE) &&
                strcmp((curdoc.title ? curdoc.title : ""),
                       COOKIE_JAR_TITLE) &&
+               strcmp((curdoc.title ? curdoc.title : ""),
+                      OPTIONS_TITLE) &&
                ((nlinks <= 0) ||
                 (links[curdoc.link].lname != NULL &&
                  strncmp(links[curdoc.link].lname,
diff -u old/lyoption.c ./lyoption.c
--- old/lyoption.c      Wed May  5 17:34:00 1999
+++ ./lyoption.c        Tue May 18 09:46:26 1999
@@ -3493,6 +3493,7 @@
     return q;
 }

+PRIVATE int gen_options PARAMS((char **newfile));
 /*
  * Handle options from the pseudo-post.  I think we really only need
  * post_data here, but bring along everything just in case.  It's only a
@@ -3549,7 +3550,6 @@

     if (strstr(newdoc->address, "LYNXOPTIONS://MBM_MENU")) {
        FREE(newdoc->post_data);
-       FREE(data);
        if (!no_bookmark)
           edit_bookmarks();
        else /* anonymous */
@@ -3557,6 +3557,30 @@
        return(NULLFILE);
     }

+
+    /*-------------------------------------------------
+     * kludge gen_options() call:
+     *--------------------------------------------------*/
+
+    if (strstr(newdoc->address, "LYNXOPTIONS:/") && !newdoc->post_data) {
+       int status = gen_options(&newdoc->address);
+       if (status == NOT_FOUND)
+           return(NOT_FOUND);
+
+       /* exit to getfile() cyrcle */
+       WWWDoc.address = newdoc->address;
+       WWWDoc.post_data = newdoc->post_data;
+       WWWDoc.post_content_type = newdoc->post_content_type;
+       WWWDoc.bookmark = newdoc->bookmark;
+       WWWDoc.isHEAD = newdoc->isHEAD;
+       WWWDoc.safe = newdoc->safe;
+
+       if (!HTLoadAbsolute(&WWWDoc))
+           return(NOT_FOUND);
+       return(NORMAL);
+    }
+
+
     data = break_data(newdoc->post_data);

     for (i = 0; data[i].tag != NULL; i++) {
@@ -4052,7 +4076,7 @@
  * This function is synchronized with postoptions().  Read the comments in
  * postoptions() header if you change something in gen_options().
  */
-PUBLIC int gen_options ARGS1(
+PRIVATE int gen_options ARGS1(
        char **,        newfile)
 {
     int i;
@@ -4068,7 +4092,7 @@
     fp0 = LYOpenTemp(tempfile, HTML_SUFFIX, "w");
     if (fp0 == NULL) {
        HTAlert(UNABLE_TO_OPEN_TEMPFILE);
-       return(-1);
+       return(NOT_FOUND);
     }

     LYLocalFileToURL(newfile, tempfile);
@@ -4459,6 +4483,6 @@
     EndInternalPage(fp0);

     LYCloseTempFP(fp0);
-    return(0);
+    return(NORMAL);
 }
 #endif /* !NO_OPTION_FORMS */
diff -u old/lyoption.h ./lyoption.h
--- old/lyoption.h      Wed Dec 16 13:56:42 1998
+++ ./lyoption.h        Tue May 18 08:48:12 1999
@@ -16,7 +16,6 @@

 #ifndef NO_OPTION_FORMS
 extern int postoptions PARAMS((document *newdoc));
-extern int gen_options PARAMS((char **newfile));
 #endif /* !NO_OPTION_FORMS */

 #ifndef NO_OPTION_MENU




reply via email to

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