lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev Re: lynx.cfg change/reload on-line


From: Leonid Pauzner
Subject: lynx-dev Re: lynx.cfg change/reload on-line
Date: Sat, 17 Oct 1998 14:07:59 +0400 (MSD)

> Starting from discussion with HN and DK about lynx.cfg info page
> I realize an easy way to made changes for lynx.cfg online (for 2.8.2 cyrcle):

> 1) add HREF="file://localhost... " links for all cfg files
> which are rendered through info page to make them viewable
> and editable, and

> 2) call read_cfg() after the editor or shell was invoked and closed.

"1)" done. However changes will be activated only after the restarting lynx.


diff -u old/lyreadcf.c ./lyreadcf.c
--- old/lyreadcf.c      Thu Oct 15 18:23:48 1998
+++ ./lyreadcf.c        Sat Oct 17 13:51:16 1998
@@ -1156,13 +1156,22 @@

        case CONF_INCLUDE:
            /* include another file */
-           if (fp0 != 0) {
+           if (fp0 == 0) {
+               read_cfg (value, cfg_filename, nesting_level + 1, fp0);
+           } else {/* fp0 != 0 */
+#ifndef NO_CONFIG_INFO
+               char *url;
                fprintf(fp0, "%s:%s\n\n", name, value);
-               fprintf(fp0, "    #<begin  %s>\n", value);
+               LYLocalFileToURL(&url, value);
+               fprintf(fp0, "    #begin  <a href=\"%s\">%s</a>\n",
+                                       url, value);
+               FREE(url);
+#endif /* !NO_CONFIG_INFO */
+               read_cfg (value, cfg_filename, nesting_level + 1, fp0);
+#ifndef NO_CONFIG_INFO
+               fprintf(fp0, "    #end of %s\n\n", value);
+#endif /* !NO_CONFIG_INFO */
            }
-           read_cfg (value, cfg_filename, nesting_level + 1, fp0);
-           if (fp0 != 0)
-               fprintf(fp0, "    #&lt;end of %s&gt;\n\n", value);
            break;

        case CONF_ADD_ITEM:
@@ -1225,6 +1234,7 @@
 {
     static char *local_url;
     char tempfile[LY_MAXPATH];
+    char *url_for_clean_distributions_lynx_cfg = 0; /* should be global... */
     char *temp = 0;
     FILE *fp0;

@@ -1240,23 +1250,38 @@
        BeginInternalPage (fp0, LYNXCFG_TITLE, NULL);
        fprintf(fp0, "<pre>\n");

+
 #ifndef NO_CONFIG_INFO
        fprintf(fp0, "<em>This is read from your lynx.cfg file,\n");
+
+       if (url_for_clean_distributions_lynx_cfg != 0) /* should be global... */
+       StrAllocCopy(temp, url_for_clean_distributions_lynx_cfg);
 #if defined(HAVE_CONFIG_H) || defined(VMS)
-       StrAllocCopy(temp, LYNX_CFG_FILE);
+       if (temp == 0)
+       LYLocalFileToURL(&temp, LYNX_CFG_FILE); /* built-in default location */
 #else
-       StrAllocCopy(temp, helpfilepath); /* no absolute path... */
-       StrAllocCat(temp, LYNXCFG_HELP);  /* for lynx.cfg on DOS/Win32 */
+       if (temp == 0) {
+       /* StrAllocCopy(temp, helpfilepath);*/ /* no absolute path... */
+       /* StrAllocCat(temp, LYNXCFG_HELP); */ /* for lynx.cfg on DOS/Win32 */
+       }
 #endif /* HAVE_CONFIG_H */
+       if (temp != 0) {
        fprintf(fp0, "please \"read\" distribution's <a href=\"%s\">lynx.cfg",
                     temp);
        fprintf(fp0, "</a> for more comments.</em>\n\n");
+       FREE(temp);
+       } else {
+       fprintf(fp0, "please \"read\" lynx.cfg for more comments.</em>\n\n");
+       }
+
+       LYLocalFileToURL(&temp, lynx_cfg_file);
+       fprintf(fp0, "    #<em>Your primary configuration <a 
href=\"%s\">%s</a></em>\n",
+                    temp, lynx_cfg_file);
+       FREE(temp);

-       fprintf(fp0, "    #<em>Your primary configuration %s</em>\n",
-                    lynx_cfg_file);
 #else
        fprintf(fp0, "<em>This is read from your lynx.cfg file:</em>\n\n");
-#endif /* NO_CONFIG_INFO */
+#endif /* !NO_CONFIG_INFO */

        /*
         *  Process the configuration file.



reply via email to

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