lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev22 (patch) more reload_read_cfg() changes


From: Leonid Pauzner
Subject: lynx-dev dev22 (patch) more reload_read_cfg() changes
Date: Sat, 17 Apr 1999 12:07:56 +0400 (MSD)

* Fix reload_read_cfg() to avoid persistent cookies mode changing at run time;
  reload printers list, downloaders list, environments - as expected. - LP



This patch applies after all my previous patches, sorry if a little messy.
Besides reload_read_cfg() changes it also affects few lines in LYReadCFG.c
(and rename the user configurable variable name from "dispaly_partial"
to "display_partial_flag", according with my recent reorganization of display
partial logic).




diff -u T2/lymain.c ./lymain.c
--- T2/lymain.c Sat Apr 17 12:00:50 1999
+++ ./lymain.c  Fri Apr 16 15:20:00 1999
@@ -384,7 +384,7 @@
 PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES;

 #ifdef DISP_PARTIAL
-PUBLIC BOOLEAN display_partial = TRUE; /* Display document during download */
+PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during 
download */
 PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */
 PUBLIC int partial_threshold = -1;  /* # of lines to be d/l'ed until we 
repaint */
 #endif
@@ -1257,6 +1257,14 @@
     StrAllocCopy(UCAssume_MIMEcharset,
                        LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);

+    /*
+     * Make sure we have the edit map declared. - FM
+     */
+    if (!LYEditmapDeclared()) {
+       fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
+       exit(-1);
+    }
+
 #if defined(USE_HASH)
     /*
      * If no alternate lynx-style file was specified on
@@ -1304,15 +1312,7 @@
        fclose(fp);
        style_readFromFile(lynx_lss_file);
     }
-#endif
-
-    /*
-     * Make sure we have the edit map declared. - FM
-     */
-    if (!LYEditmapDeclared()) {
-       fprintf(stderr, gettext("\nLynx edit map not declared.\n\n"));
-       exit(-1);
-    }
+#endif /* USE_HASH */

 #if USE_COLOR_TABLE
     /*
@@ -1589,7 +1589,7 @@
      * Disable partial mode if not interactive.
      */
     if (dump_output_immediately)
-       display_partial = FALSE;
+       display_partial_flag = FALSE;
 #endif

 #ifdef VMS
@@ -1851,11 +1851,19 @@
  */
 PUBLIC void reload_read_cfg NOARGS
 {
-    if (!LYRestricted) {
+    if (LYRestricted) return;  /* for sure */

-       /* save .lynxrc file in case we change something from Options Menu */
-       if (!save_rc()) return;
+    /* save .lynxrc file in case we change something from Options Menu */
+    if (!save_rc()) return;    /* can not write the very own file :( */

+    {
+       /* set few safe flags: */
+#ifdef PERSISTENT_COOKIES
+       BOOLEAN persistent_cookies_flag = persistent_cookies;
+       char * LYCookieFile_flag = LYCookieFile;
+#endif
+
+       free_lynx_cfg(); /* free downloaders, printers, not always environments 
*/
        /*
         *  Process the configuration file.
         */
@@ -1871,13 +1879,13 @@
        /* but other things may be lost: */

        /*
-        *  Process any command line arguments not already handled. - FM
+        *  Process any command line arguments not already handled.
         */
                /* Not implemented yet here */

        /*
         *  Process any stdin-derived arguments for a lone "-"  which we've
-        *  loaded into LYStdinArgs. - FM
+        *  loaded into LYStdinArgs.
         */
                /* Not implemented yet here */

@@ -1886,8 +1894,19 @@
         */
                /* Not implemented yet here,
                 * a major problem: file paths
-                * like lynx_temp_space, LYCookieFile etc.
+                * like lynx_save_space, LYCookieFile etc.
                 */
+#ifdef PERSISTENT_COOKIES
+       /* restore old settings */
+        if (persistent_cookies != persistent_cookies_flag) {
+            persistent_cookies = persistent_cookies_flag;
+            HTAlert(gettext("persistent cookies state will be changed in next 
session only."));
+        }
+        if (strcmp(LYCookieFile, LYCookieFile_flag)) {
+            StrAllocCopy(LYCookieFile, LYCookieFile_flag);
+            CTRACE(tfp, "cookies file can be changed in next session only, 
restored.\n")
+        }
+#endif

     }
 }
@@ -2848,7 +2867,7 @@
    ),
 #ifdef DISP_PARTIAL
    PARSE_SET(
-      "partial",       TOGGLE_ARG,             &display_partial,
+      "partial",       TOGGLE_ARG,             &display_partial_flag,
       "toggles display partial pages while downloading"
    ),
    PARSE_INT(
diff -u T2/lymainlo.c ./lymainlo.c
--- T2/lymainlo.c       Sat Apr 17 11:34:20 1999
+++ ./lymainlo.c        Fri Apr 16 16:51:46 1999
@@ -86,7 +86,7 @@
 #ifdef DISP_PARTIAL
 PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
 PUBLIC int NumOfLines_partial = -1; /* initialize to -1 the very first time */
-PUBLIC BOOLEAN display_partial_flag = FALSE;
+PUBLIC BOOLEAN display_partial = FALSE;
 PUBLIC int Newline = 0;
 #else
 PRIVATE int Newline = 0;
@@ -311,9 +311,6 @@
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
     *prev_target = '\0';
     *user_input_buffer = '\0';
-#ifdef DISP_PARTIAL
-    display_partial_flag = display_partial; /* permanent flag, not mutable */
-#endif
     StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
                                    LYUserAgent : ""));
     StrAllocCopy(CurrentNegoLanguage, (language ?
diff -u T2/lyreadcf.c ./lyreadcf.c
--- T2/lyreadcf.c       Sat Apr 17 12:00:54 1999
+++ ./lyreadcf.c        Fri Apr 16 15:43:08 1999
@@ -76,7 +76,6 @@
     return NULL;
 }

-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the DOWNLOADER and UPLOADER menus list. - FM
  */
@@ -121,7 +120,6 @@

     return;
 }
-#endif /* LY_FIND_LEAKS */

 /*
  *  Process string buffer fields for DOWNLOADER or UPLOADER menus.
@@ -201,7 +199,6 @@
 }


-#ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing the PRINTER menus list. - FM
  */
@@ -221,7 +218,6 @@

     return;
 }
-#endif /* LY_FIND_LEAKS */

 /*
  *  Process string buffer fields for PRINTER menus.
@@ -1121,7 +1117,7 @@
      PARSE_SET("no_referer_header", CONF_BOOL, &LYNoRefererHeader),
      PARSE_FUN("outgoing_mail_charset", CONF_FUN, outgoing_mail_charset_fun),
 #ifdef DISP_PARTIAL
-     PARSE_SET("partial", CONF_BOOL, &display_partial),
+     PARSE_SET("partial", CONF_BOOL, &display_partial_flag),
      PARSE_INT("partial_thres", CONF_INT, &partial_threshold),
 #endif
 #ifdef EXP_PERSISTENT_COOKIES
@@ -1206,12 +1202,17 @@
            if (q->str_value != 0) {
                FREE(*(q->str_value));
                FREE(q->str_value);
+               /* is it enough for reload_read_cfg() to clean up
+                * the result of putenv()?  No for certain platforms.
+                */
            }
            break;
        default:
            break;
        }
     }
+    free_item_list();
+    free_printer_item_list();
 }

 /*




reply via email to

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