[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev More on reading the lynx.cfg file
From: |
Leonid Pauzner |
Subject: |
Re: lynx-dev More on reading the lynx.cfg file |
Date: |
Thu, 22 Oct 1998 23:08:55 +0400 (MSD) |
> * From: Doug Kaufman <address@hidden>
> * Date: Wed, 21 Oct 1998 23:38:18 -0700 (PDT)
> * Reply-To: address@hidden
> * Sender: address@hidden
> _________________________________________________________________
> Since we are getting close to a release, I wanted to try to state more
> clearly why I disagree with Leonid about the code in LYReadCFG.c. The
> following snippet is the code in question:
The patch was proposed by me about a week ago,
it enable href= for each rendered cfg file (in case we have include).
(Also, it introduce a separate href= for clean distribution's lynx.cfg,
currently nothing for DOS/WIN but compilation default for UNIX/VMS)
It is not a good idea to ask users to not remove comments from...
From: "Leonid Pauzner" <address@hidden>
Date: Sat, 17 Oct 1998 14:07:59 +0400 (MSD)
Subject: Re: lynx.cfg change/reload on-line
> Starting from discussion with HN and DK about lynx.cfg info page
> I realize an easy way to made changes for lynx.cfg online:
> 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, " #<end of %s>\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.