lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev20: patch #6 (LYNXCFG: add links for included lynx.cfg)


From: Leonid Pauzner
Subject: lynx-dev dev20: patch #6 (LYNXCFG: add links for included lynx.cfg)
Date: Sun, 28 Mar 1999 03:36:58 +0400 (MSD)

* At LYNXCFG:/ page, add links for every included configuration file
  so we can read and edit them (no, currently the changes will be active
  the next session only.  Minore reorganization of LYMain.c done,
  more required).



diff -u old/lyreadcf.c ./lyreadcf.c
--- old/lyreadcf.c      Thu Mar 18 11:05:54 1999
+++ ./lyreadcf.c        Sun Mar 28 01:38:32 1999
@@ -1235,8 +1235,11 @@
            /* include another file */
 #ifndef NO_CONFIG_INFO
            if (fp0 != 0) {
-               fprintf(fp0, "%s:%s\n\n", name, value);
+               char *url = 0;
+               LYLocalFileToURL(&url, value);
+               fprintf(fp0, "%s:<a href=\"%s\">%s</a>\n\n", name, url, value);
                fprintf(fp0, "    #&lt;begin  %s&gt;\n", value);
+               FREE(url);
            }
 #endif
            read_cfg (value, cfg_filename, nesting_level + 1, fp0);
@@ -1370,20 +1373,36 @@
        fprintf(fp0, "<pre>\n");

 #ifndef NO_CONFIG_INFO
-       fprintf(fp0, "<em>%s\n", gettext("This is read from your lynx.cfg 
file,"));
 #if defined(HAVE_CONFIG_H) || defined(VMS)
-       StrAllocCopy(temp, LYNX_CFG_FILE);
-#else
-       StrAllocCopy(temp, helpfilepath); /* no absolute path... */
-       StrAllocCat(temp, LYNXCFG_HELP);  /* for lynx.cfg on DOS/Win32 */
-#endif /* HAVE_CONFIG_H */
-       fprintf(fp0, "%s <a href=\"%s\">lynx.cfg",
-                    gettext("please \"read\" distribution's"),
+       if (strcmp(lynx_cfg_file, LYNX_CFG_FILE)) {
+           StrAllocCopy(temp, LYNX_CFG_FILE);
+           fprintf(fp0, "<em>%s\n%s",
+                    gettext("This is read from your lynx.cfg file,"),
+                    gettext("please \"read\" distribution's"));
+           fprintf(fp0, " <a href=\"%s\">lynx.cfg</a> ",
                     temp);
-       fprintf(fp0, "</a> %s</em>\n\n", gettext("for more comments."));
+           FREE(temp);
+           fprintf(fp0, "%s</em>\n\n",
+                    gettext("for more comments."));
+       } else
+#endif /* HAVE_CONFIG_H */
+       {
+       /* no absolute path... for lynx.cfg on DOS/Win32 */
+           fprintf(fp0, "<em>%s\n%s",
+                    gettext("This is read from your lynx.cfg file,"),
+                    gettext("please \"read\" distribution's"));
+           fprintf(fp0, " </em>lynx.cfg<em> ");
+           fprintf(fp0, "%s</em>\n\n",
+                    gettext("for more comments."));
+       }

-       fprintf(fp0, "    #<em>%s %s</em>\n", gettext("Your primary 
configuration"),
+       LYLocalFileToURL(&temp, lynx_cfg_file);
+       fprintf(fp0, "    #<em>%s <a href=\"%s\">%s</a></em>\n",
+                    gettext("Your primary configuration"),
+                    temp,
                     lynx_cfg_file);
+       FREE(temp);
+
 #else
        fprintf(fp0, "<em>%s</em>\n\n", gettext("This is read from your 
lynx.cfg file:"));
 #endif /* NO_CONFIG_INFO */
@@ -1393,7 +1412,6 @@
         */
        read_cfg(lynx_cfg_file, "main program", 1, fp0);

-       FREE(temp);
        fprintf(fp0, "</pre>\n");
        EndInternalPage(fp0);
        LYCloseTempFP(fp0);

diff -u old/lymain.c ./lymain.c
--- old/lymain.c        Thu Mar 18 11:05:50 1999
+++ ./lymain.c  Sun Mar 28 02:37:34 1999
@@ -255,13 +255,13 @@
 PUBLIC BOOLEAN override_no_download = FALSE;
 PUBLIC BOOLEAN show_dotfiles = FALSE; /* From rcfile if no_dotfiles is false */
 PUBLIC BOOLEAN LYforce_HTML_mode = FALSE;
-PUBLIC char *homepage = NULL;  /* home page or main screen */
 PUBLIC char *editor = NULL;    /* the name of the current editor */
 PUBLIC char *jumpfile = NULL;  /* the name of the default jumps file */
 PUBLIC char *jumpprompt = NULL; /* the default jumps prompt */
 PUBLIC char *bookmark_page = NULL; /* the name of the default bookmark page */
 PUBLIC char *BookmarkPage = NULL;  /* the name of the current bookmark page */
 PUBLIC char *LynxHome = NULL;  /* the default Home HREF. */
+PUBLIC char *homepage = NULL;  /* home page or main screen */
 PUBLIC char *startfile = NULL; /* the first file */
 PUBLIC char *helpfile = NULL;  /* the main help file */
 PUBLIC char *helpfilepath = NULL;   /* the path to the help file set */
@@ -471,8 +471,10 @@
 #endif /* VMS */

     FREE(LynxHome);
+    FREE(homepage);
     FREE(startfile);
     FREE(helpfile);
+    FREE(helpfilepath);
     FREE(jumpprompt);
 #ifdef JUMPFILE
     FREE(jumpfile);
@@ -501,8 +503,6 @@
     FREE(LYHostName);
     FREE(LYLocalDomain);
     FREE(lynx_save_space);
-    FREE(homepage);
-    FREE(helpfilepath);
     FREE(bookmark_page);
     FREE(BookmarkPage);
     for (i = 0; i <= MBM_V_MAXFILES; i++) {
@@ -1335,9 +1335,81 @@
      */
     read_rc();

+    /*
+     * Get WWW_HOME environment variable if it exists.
+     */
+    if ((cp = getenv("WWW_HOME")) != NULL) {
+       StrAllocCopy(startfile, cp);
+       LYTrimStartfile(startfile);
+    }
+
+    /*
+     * Set the LynxHome URL.  If it's a file URL and the
+     * host is defaulted, force in "//localhost", and if
+     * it's not an absolute URL, make it one. - FM
+     */
+    StrAllocCopy(LynxHome, startfile);
+    LYFillLocalFileURL((char **)&LynxHome, "file://localhost");
+    LYEnsureAbsoluteURL((char **)&LynxHome, "LynxHome");
+
+    /*
+     * Process any command line arguments not already handled. - FM
+     */
+    for (i = 1; i < argc; i++) {
+       parse_arg(&argv[i], &i);
+    }
+
+    /*
+     * Process any stdin-derived arguments for a lone "-"  which we've
+     * loaded into LYStdinArgs. - FM
+     */
+    if (LYStdinArgs != NULL) {
+       char *my_args[2];
+       HTList *cur = LYStdinArgs;
+
+       my_args[1] = NULL;
+       while (NULL != (my_args[0] = (char *)HTList_nextObject(cur))) {
+           parse_arg(my_args, (int *)0);
+       }
+       LYStdinArgs_free();
+    }
+
+    /*
+     * Set the rest of variables when the configuration have read.
+     */
+
     HTSwitchDTD(!Old_DTD);

     /*
+     * Set up the proper character set with the desired
+     * startup raw 8-bit or CJK mode handling.  - FM
+     */
+    HTMLUseCharacterSet(current_char_set);
+
+#ifdef EXP_PERSISTENT_COOKIES
+    /*
+     * Sod it, this looks like a reasonable place to load the
+     * cookies file, probably.  - RP
+     */
+    if (persistent_cookies) {
+       if(LYCookieFile == NULL) {
+           LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, 
COOKIE_FILE);
+       } else {
+           if ((cp = strchr(LYCookieFile, '~'))) {
+               temp = NULL;
+               *(cp++) = '\0';
+               StrAllocCopy(temp, cp);
+               LYTrimPathSep(temp);
+               StrAllocCopy(LYCookieFile, wwwName(Home_Dir()));
+               StrAllocCat(LYCookieFile, temp);
+               FREE(temp);
+           }
+       }
+       LYLoadCookies(LYCookieFile);
+    }
+#endif
+
+    /*
      * Check for a save space path in the environment.
      * If one was set in the configuration file, that
      * one will be overridden. - FM
@@ -1392,45 +1464,6 @@
     HTFormatInit();
     HTFileInit();

-    /*
-     * Get WWW_HOME environment variable if it exists.
-     */
-    if ((cp = getenv("WWW_HOME")) != NULL) {
-       StrAllocCopy(startfile, cp);
-       LYTrimStartfile(startfile);
-    }
-
-    /*
-     * Set the LynxHome URL.  If it's a file URL and the
-     * host is defaulted, force in "//localhost", and if
-     * it's not an absolute URL, make it one. - FM
-     */
-    StrAllocCopy(LynxHome, startfile);
-    LYFillLocalFileURL((char **)&LynxHome, "file://localhost");
-    LYEnsureAbsoluteURL((char **)&LynxHome, "LynxHome");
-
-    /*
-     * Process any command line arguments not already handled. - FM
-     */
-    for (i = 1; i < argc; i++) {
-       parse_arg(&argv[i], &i);
-    }
-
-    /*
-     * Process any stdin-derived arguments for a lone "-"  which we've
-     * loaded into LYStdinArgs. - FM
-     */
-    if (LYStdinArgs != NULL) {
-       char *my_args[2];
-       HTList *cur = LYStdinArgs;
-
-       my_args[1] = NULL;
-       while (NULL != (my_args[0] = (char *)HTList_nextObject(cur))) {
-           parse_arg(my_args, (int *)0);
-       }
-       LYStdinArgs_free();
-    }
-
 #ifndef VMS
 #ifdef SYSLOG_REQUESTED_URLS
     if (syslog_txt) {
@@ -1557,35 +1590,6 @@
     }
 #endif /* !VMS */

-    /*
-     * Set up the proper character set with the desired
-     * startup raw 8-bit or CJK mode handling.  - FM
-     */
-    HTMLUseCharacterSet(current_char_set);
-
-#ifdef EXP_PERSISTENT_COOKIES
-    /*
-     * Sod it, this looks like a reasonable place to load the
-     * cookies file, probably.  - RP
-     */
-    if (persistent_cookies) {
-       if(LYCookieFile == NULL) {
-           LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, 
COOKIE_FILE);
-       } else {
-           if ((cp = strchr(LYCookieFile, '~'))) {
-               temp = NULL;
-               *(cp++) = '\0';
-               StrAllocCopy(temp, cp);
-               LYTrimPathSep(temp);
-               StrAllocCopy(LYCookieFile, wwwName(Home_Dir()));
-               StrAllocCat(LYCookieFile, temp);
-               FREE(temp);
-           }
-       }
-       LYLoadCookies(LYCookieFile);
-    }
-#endif
-
 #ifdef SIGTSTP
     /*
      * Block Control-Z suspending if requested. - FM
@@ -2470,16 +2474,6 @@
     return 0;
 }

-/* -tagsoup */
-static int tagsoup_fun ARGS3(
-       Parse_Args_Type *,      p GCC_UNUSED,
-       char **,                argv GCC_UNUSED,
-       char *,                 next_arg GCC_UNUSED)
-{
-    HTSwitchDTD(!(Old_DTD = YES));
-    return 0;
-}
-
 /* -traversal */
 static int traversal_fun ARGS3(
        Parse_Args_Type *,      p GCC_UNUSED,
@@ -2922,7 +2916,7 @@
 #endif
 #endif
    PARSE_FUN(
-      "tagsoup",       FUNCTION_ARG,           tagsoup_fun,
+      "tagsoup",       SET_ARG,                &Old_DTD,
       "use TagSoup rather than SortaSGML parser"
    ),
    PARSE_SET(



reply via email to

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