diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-10 19:47:00 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-11-10 19:47:00 -0500 |
commit | d3f9d5478df478427c2aa5db4507ddd0a38f0eb6 (patch) | |
tree | e27eacd6bbda653dd77f11cc020b9e0a59f7f4fc /src/LYrcFile.c | |
parent | 18024037b515bfff83e0230b35151babe6005e18 (diff) | |
download | lynx-snapshots-d3f9d5478df478427c2aa5db4507ddd0a38f0eb6.tar.gz |
snapshot of project "lynx", label v2-8-2dev_2
Diffstat (limited to 'src/LYrcFile.c')
-rw-r--r-- | src/LYrcFile.c | 383 |
1 files changed, 235 insertions, 148 deletions
diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 64aadeff..63269ac6 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,5 +1,4 @@ #include <HTUtils.h> -#include <tcp.h> #include <HTFTP.h> #include <LYUtils.h> #include <LYrcFile.h> @@ -7,13 +6,20 @@ #include <LYGlobalDefs.h> #include <LYCharSets.h> #include <LYBookmark.h> +#include <LYCookie.h> #include <LYLeaks.h> +#ifdef FNAMES_8_3 +#define FNAME_LYNXRC "lynx.rc" +#else +#define FNAME_LYNXRC ".lynxrc" +#endif /* FNAMES_8_3 */ + PUBLIC void read_rc NOPARAMS { char line_buffer[256]; - char rcfile[256]; + char rcfile[LY_MAXPATH]; FILE *fp; char *cp, *cp2; int number_sign; @@ -25,15 +31,7 @@ PUBLIC void read_rc NOPARAMS /* * Make an RC file name. */ -#ifdef DJGPP - sprintf(rcfile, "%s/lynx.rc", Home_Dir()); -#else -#ifdef VMS - sprintf(rcfile, "sys$login:.lynxrc"); -#else - sprintf(rcfile, "%s/.lynxrc", Home_Dir()); -#endif /* VMS */ -#endif /* DJGPP */ + LYAddPathToHome(rcfile, sizeof(rcfile), FNAME_LYNXRC); /* * Open the RC file for reading. @@ -45,7 +43,7 @@ PUBLIC void read_rc NOPARAMS /* * Process the entries. */ - while (fgets(line_buffer, 256, fp) != NULL) { + while (fgets(line_buffer, sizeof(line_buffer)-1, fp) != NULL) { /* * Remove the /n from the end of the line. */ @@ -55,8 +53,7 @@ PUBLIC void read_rc NOPARAMS /* * Remove any trailing white space. */ - while (line_buffer[0] && isspace(line_buffer[strlen(line_buffer)-1])) - line_buffer[strlen(line_buffer)-1] = '\0'; + LYTrimTrailing(line_buffer); /* * Skip any comment or blank lines. @@ -81,8 +78,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); StrAllocCopy(editor, cp); /* @@ -93,8 +89,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp,'=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); /* * Since this is the "Default Bookmark File", we save it @@ -113,8 +108,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = (cp2 + 1); - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "standard", 8)) { LYMultiBookmarks = TRUE; LYMBMAdvanced = FALSE; @@ -181,8 +175,7 @@ PUBLIC void read_rc NOPARAMS /* * Eat spaces in front of description. */ - while (isspace(*MBM_cp1)) - MBM_cp1++; + MBM_cp1 = LYSkipBlanks(MBM_cp1); while (*MBM_cp1) MBM_line[MBM_i2++] = *MBM_cp1++; MBM_line[MBM_i2++] = '\0'; @@ -205,8 +198,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "BY_FILENAME", 11)) HTfileSortMethod = FILE_BY_NAME; else if (!strncasecomp(cp, "BY_TYPE", 7)) @@ -225,8 +217,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); StrAllocCopy(personal_mail_address, cp); /* @@ -238,8 +229,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) case_sensitive = TRUE; else @@ -255,15 +245,13 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - for (; LYchar_set_names[i]; i++) { - if (!strncmp(cp, LYchar_set_names[i], strlen(cp))) { - current_char_set=i; - HTMLSetRawModeDefault(i); - break; - } - } + cp = LYSkipBlanks(cp); + + i = UCGetLYhndl_byAnyName(cp); /* by MIME or full name */ + if (i < 0) + ; /* do nothing here: so fallback to lynx.cfg */ + else + current_char_set = i; /* * Preferred language. @@ -274,8 +262,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); StrAllocCopy(language, cp); /* @@ -287,8 +274,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); StrAllocCopy(pref_charset, cp); /* @@ -299,8 +285,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) vi_keys = TRUE; else @@ -314,8 +299,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) emacs_keys = TRUE; else @@ -329,8 +313,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) show_dotfiles = TRUE; else @@ -344,8 +327,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "always", 6)) { LYrcShowColor = SHOW_COLOR_ALWAYS; #if defined(USE_SLANG) || defined(COLOR_CURSES) @@ -368,8 +350,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "off", 3)) LYSelectPopups = FALSE; else @@ -383,8 +364,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char * )strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "off", 3)) LYShowCursor = FALSE; else @@ -398,8 +378,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (LYstrstr(cp, "LINKS_ARE_NUMBERED")) keypad_mode = LINKS_ARE_NUMBERED; else if (LYstrstr(cp, "LINKS_AND_FORM_FIELDS_ARE_NUMBERED")) @@ -417,8 +396,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); for (; LYLineeditNames[i]; i++) { if (!strncmp(cp, LYLineeditNames[i], strlen(cp))) { current_lineedit = i; @@ -435,8 +413,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp,'=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (LYstrstr(cp, "FILES_FIRST") != NULL) { dir_list_style = FILES_FIRST; } else if (LYstrstr(cp,"DIRECTORIES_FIRST") != NULL) { @@ -447,6 +424,59 @@ PUBLIC void read_rc NOPARAMS #endif /* DIRED_SUPPORT */ /* + * Accept cookies from all domains? + */ + } else if ((cp = LYstrstr(line_buffer, "accept_all_cookies")) != NULL && + cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + if (LYstrstr(cp,"TRUE") != NULL) { + LYAcceptAllCookies = TRUE; + } else { + LYAcceptAllCookies = FALSE; + } + + + /* + * Accept all cookies from certain domains? + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_accept_domains")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + cookie_add_acceptlist(cp); + + + /* + * Reject all cookies from certain domains? + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_reject_domains")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + cookie_add_rejectlist(cp); + +#ifdef EXP_PERSISTENT_COOKIES + /* + * File to store cookies in. + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_file")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + + StrAllocCopy(LYCookieFile, cp); +#endif /* EXP_PERSISTENT_COOKIES */ + + /* * User mode. */ } else if ((cp = LYstrstr(line_buffer, "user_mode")) != NULL && @@ -454,8 +484,7 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (LYstrstr(cp, "ADVANCED") != NULL) { user_mode = ADVANCED_MODE; } else if (LYstrstr(cp,"INTERMEDIATE") != NULL) { @@ -474,14 +503,26 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ - + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) local_exec = TRUE; else local_exec = FALSE; +#ifdef DISP_PARTIAL + /* + * Partial display logic--set the threshold # of lines before + * Lynx redraws the screen + */ + } else if ((cp = LYstrstr(line_buffer, "partial_thres")) != NULL && + cp-line_buffer < number_sign) { + if ((cp2 = (char *)strchr(cp, '=')) != NULL) + cp = cp2 + 1; + cp = LYSkipBlanks(cp); + if (atoi(cp) != 0) + partial_threshold = atoi(cp); +#endif /* DISP_PARTIAL */ + /* * Local execution mode - only links in local files. */ @@ -491,14 +532,25 @@ PUBLIC void read_rc NOPARAMS if ((cp2 = (char *)strchr(cp, '=')) != NULL) cp = cp2 + 1; - while (isspace(*cp)) - cp++; /* get rid of spaces */ + cp = LYSkipBlanks(cp); if (!strncasecomp(cp, "on", 2)) local_exec_on_local_files = TRUE; else local_exec_on_local_files=FALSE; #endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ + } else if ((cp = LYstrstr(line_buffer, + "verbose_images")) != NULL && + cp-line_buffer < number_sign) { + + if ((cp2 = (char *)strchr(cp, '=')) != NULL) + cp = cp2 + 1; + cp = LYSkipBlanks(cp); + if (!strncasecomp(cp, "on", 2)) + verbose_img = 1; + else if (!strncasecomp(cp, "off", 3)) + verbose_img = 0; + } /* end of if */ } /* end of while */ @@ -508,7 +560,7 @@ PUBLIC void read_rc NOPARAMS PUBLIC int save_rc NOPARAMS { - char rcfile[256]; + char rcfile[LY_MAXPATH]; FILE *fp; int i; int MBM_c; @@ -516,22 +568,11 @@ PUBLIC int save_rc NOPARAMS /* * Make a name. */ -#ifdef DJGPP - sprintf(rcfile, "%s/lynx.rc", Home_Dir()); -#else -#ifdef VMS - sprintf(rcfile, "sys$login:.lynxrc"); -#else - sprintf(rcfile, "%s/.lynxrc", Home_Dir()); -#endif /* VMS */ -#endif /* DJGPP */ + LYAddPathToHome(rcfile, sizeof(rcfile), FNAME_LYNXRC); /* * Open the file for write. */ -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_TEXT; -#endif /* __DJGPP__ or _WINDOWS */ if ((fp = LYNewTxtFile(rcfile)) == NULL) { return FALSE; } @@ -539,7 +580,7 @@ PUBLIC int save_rc NOPARAMS /* * Header. */ - fprintf(fp, "# Lynx User Defaults File\n#\n\ + fprintf(fp, gettext("# Lynx User Defaults File\n#\n\ # This file contains options saved from the Lynx Options Screen (normally\n\ # with the '>' key). There is normally no need to edit this file manually,\n\ # since the defaults here can be controlled from the Options Screen, and the\n\ @@ -547,31 +588,31 @@ PUBLIC int save_rc NOPARAMS # completely rewritten. You have been warned...\n\ # If you are looking for the general configuration file - it is normally\n\ # called lynx.cfg, and it has different content and a different format.\n\ -# It is not this file.\n\n"); +# It is not this file.\n\n")); /* * File editor */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # file_editor specifies the editor to be invoked when editing local files\n\ # or sending mail. If no editor is specified, then file editing is disabled\n\ # unless it is activated from the command line, and the built-in line editor\n\ -# will be used for sending mail.\n"); +# will be used for sending mail.\n")); fprintf(fp, "file_editor=%s\n\n", (editor ? editor : "")); /* * Default bookmark file. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # bookmark_file specifies the name and location of the default bookmark\n\ # file into which the user can paste links for easy access at a later\n\ -# date.\n"); +# date.\n")); fprintf(fp, "bookmark_file=%s\n\n", (bookmark_page ? bookmark_page : "")); /* * Multiple (sub)bookmark support settings. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If sub_bookmarks is not turned \"off\", and multiple bookmarks have\n\ # been defined (see below), then all bookmark operations will first\n\ # prompt the user to select an active sub-bookmark file. If the default\n\ @@ -580,7 +621,7 @@ PUBLIC int save_rc NOPARAMS # user mode is advanced, the 'v'iew bookmark command will invoke a\n\ # statusline prompt instead of the menu seen in novice and intermediate\n\ # user modes. When this option is set to \"standard\", the menu will be\n\ -# presented regardless of user mode.\n"); +# presented regardless of user mode.\n")); fprintf(fp, "sub_bookmarks=%s\n\n", (LYMultiBookmarks ? (LYMBMAdvanced ? "advanced" : "standard") @@ -589,11 +630,11 @@ PUBLIC int save_rc NOPARAMS /* * Multiple (sub)bookmark definitions and descriptions. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # The following allow you to define sub-bookmark files and descriptions.\n\ # The format is multi_bookmark<capital_letter>=<filename>,<description>\n\ # Up to 26 bookmark files (for the English capital letters) are allowed.\n\ -# We start with \"multi_bookmarkB\" since 'A' is the default (see above).\n"); +# We start with \"multi_bookmarkB\" since 'A' is the default (see above).\n")); for (MBM_c = 1; MBM_c <= MBM_V_MAXFILES; MBM_c++) fprintf(fp, "multi_bookmark%c=%s%s%s\n", (MBM_c + 'A'), @@ -608,13 +649,13 @@ PUBLIC int save_rc NOPARAMS /* * FTP/file sorting method. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # The file_sorting_method specifies which value to sort on when viewing\n\ # file lists such as FTP directories. The options are:\n\ # BY_FILENAME -- sorts on the name of the file\n\ # BY_TYPE -- sorts on the type of the file\n\ # BY_SIZE -- sorts on the size of the file\n\ -# BY_DATE -- sorts on the date of the file\n"); +# BY_DATE -- sorts on the date of the file\n")); fprintf(fp, "file_sorting_method=%s\n\n", (HTfileSortMethod == FILE_BY_NAME ? "BY_FILENAME" : @@ -626,36 +667,36 @@ PUBLIC int save_rc NOPARAMS /* * Personal mail address. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # personal_mail_address specifies your personal mail address. The\n\ # address will be sent during HTTP file transfers for authorization and\n\ # logging purposes, and for mailed comments.\n\ # If you do not want this information given out, set the NO_FROM_HEADER\n\ # to TRUE in lynx.cfg, or use the -nofrom command line switch. You also\n\ # could leave this field blank, but then you won't have it included in\n\ -# your mailed comments.\n"); +# your mailed comments.\n")); fprintf(fp, "personal_mail_address=%s\n\n", (personal_mail_address ? personal_mail_address : "")); /* * Searching type. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If case_sensitive_searching is \"on\" then when the user invokes a search\n\ # using the 's' or '/' keys, the search performed will be case sensitive\n\ -# instead of case INsensitive. The default is usually \"off\".\n"); +# instead of case INsensitive. The default is usually \"off\".\n")); fprintf(fp, "case_sensitive_searching=%s\n\n", (case_sensitive ? "on" : "off")); /* * Character set. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # The character_set definition controls the representation of 8 bit\n\ # characters for your terminal. If 8 bit characters do not show up\n\ # correctly on your screen you may try changing to a different 8 bit\n\ # set or using the 7 bit character approximations.\n\ -# Current valid characters sets are:\n"); +# Current valid characters sets are:\n")); for (i = 0; LYchar_set_names[i]; i++) fprintf(fp, "# %s\n", LYchar_set_names[i]); fprintf(fp, "character_set=%s\n\n", LYchar_set_names[current_char_set]); @@ -664,18 +705,18 @@ PUBLIC int save_rc NOPARAMS /* * Preferred language. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # preferred_language specifies the language in MIME notation (e.g., en,\n\ # fr, may be a comma-separated list in decreasing preference)\n\ # which Lynx will indicate you prefer in requests to http servers.\n\ # If a file in that language is available, the server will send it.\n\ -# Otherwise, the server will send the file in it's default language.\n"); +# Otherwise, the server will send the file in it's default language.\n")); fprintf(fp, "preferred_language=%s\n\n", (language ? language : "")); /* * Preferred charset. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # preferred_charset specifies the character set in MIME notation (e.g.,\n\ # ISO-8859-2, ISO-8859-5) which Lynx will indicate you prefer in requests\n\ # to http servers using an Accept-Charset header. The value should NOT\n\ @@ -687,7 +728,7 @@ PUBLIC int save_rc NOPARAMS # and if the server cannot send a response which is acceptable\n\ # according to the Accept-Charset header, then the server SHOULD send\n\ # an error response, though the sending of an unacceptable response\n\ -# is also allowed.\n"); +# is also allowed.\n")); fprintf(fp, "preferred_charset=%s\n\n", (pref_charset ? pref_charset : "")); @@ -695,7 +736,7 @@ PUBLIC int save_rc NOPARAMS * Show color. */ if (LYChosenShowColor != SHOW_COLOR_UNKNOWN) { - fprintf(fp, "\ + fprintf(fp, gettext("\ # show_color specifies how to set the color mode at startup. A value of\n\ # \"never\" will force color mode off (treat the terminal as monochrome)\n\ # at startup even if the terminal appears to be color capable. A value of\n\ @@ -710,7 +751,7 @@ PUBLIC int save_rc NOPARAMS # the -color and -nocolor command line switches.\n\ # The mode set at startup can be changed via the \"show color\" option in\n\ # the 'o'ptions menu. If the option settings are saved, the \"on\" and\n\ -# \"off\" \"show color\" settings will be treated as \"default\".\n"); +# \"off\" \"show color\" settings will be treated as \"default\".\n")); fprintf(fp, "show_color=%s\n\n", ((LYChosenShowColor == SHOW_COLOR_NEVER ? "never" : (LYChosenShowColor == SHOW_COLOR_ALWAYS ? "always" : @@ -720,100 +761,113 @@ PUBLIC int save_rc NOPARAMS /* * VI keys. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If vi_keys is set to \"on\", then the normal VI movement keys:\n\ # j = down k = up\n\ # h = left l = right\n\ # will be enabled. These keys are only lower case.\n\ # Capital 'H', 'J' and 'K will still activate help, jump shortcuts,\n\ -# and the keymap display, respectively.\n"); +# and the keymap display, respectively.\n")); fprintf(fp, "vi_keys=%s\n\n", (vi_keys ? "on" : "off")); /* * EMACS keys. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If emacs_keys is to \"on\" then the normal EMACS movement keys:\n\ # ^N = down ^P = up\n\ # ^B = left ^F = right\n\ -# will be enabled.\n"); +# will be enabled.\n")); fprintf(fp, "emacs_keys=%s\n\n", (emacs_keys ? "on" : "off")); /* * Show dot files. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # show_dotfiles specifies that the directory listing should include\n\ # \"hidden\" (dot) files/directories. If set \"on\", this will be\n\ # honored only if enabled via userdefs.h and/or lynx.cfg, and not\n\ # restricted via a command line switch. If display of hidden files\n\ -# is disabled, creation of such files via Lynx also is disabled.\n"); +# is disabled, creation of such files via Lynx also is disabled.\n")); fprintf(fp, "show_dotfiles=%s\n\n", (show_dotfiles ? "on" : "off")); /* * Select popups. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # select_popups specifies whether the OPTIONs in a SELECT block which\n\ # lacks a MULTIPLE attribute are presented as a vertical list of radio\n\ # buttons or via a popup menu. Note that if the MULTIPLE attribute is\n\ # present in the SELECT start tag, Lynx always will create a vertical list\n\ # of checkboxes for the OPTIONs. A value of \"on\" will set popup menus\n\ # as the default while a value of \"off\" will set use of radio boxes.\n\ -# The default can be overridden via the -popup command line toggle.\n"); +# The default can be overridden via the -popup command line toggle.\n")); fprintf(fp, "select_popups=%s\n\n", (LYSelectPopups ? "on" : "off")); /* * Show cursor. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # show_cursor specifies whether to 'hide' the cursor to the right (and\n\ # bottom, if possible) of the screen, or to place it to the left of the\n\ # current link in documents, or current option in select popup windows.\n\ # Positioning the cursor to the left of the current link or option is\n\ # helpful for speech or braille interfaces, and when the terminal is\n\ -# one which does not distingish the current link based on highlighting\n\ +# one which does not distinguish the current link based on highlighting\n\ # or color. A value of \"on\" will set positioning to the left as the\n\ # default while a value of \"off\" will set 'hiding' of the cursor.\n\ -# The default can be overridden via the -show_cursor command line toggle.\n"); +# The default can be overridden via the -show_cursor command line toggle.\n")); fprintf(fp, "show_cursor=%s\n\n", (LYShowCursor ? "on" : "off")); /* * Keypad mode. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If keypad_mode is set to \"NUMBERS_AS_ARROWS\", then the numbers on\n\ # your keypad when the numlock is on will act as arrow keys:\n\ # 8 = Up Arrow\n\ # 4 = Left Arrow 6 = Right Arrow\n\ # 2 = Down Arrow\n\ # and the corresponding keyboard numbers will act as arrow keys,\n\ -# regardless of whether numlock is on.\n"); - fprintf(fp, "\ +# regardless of whether numlock is on.\n")); + fprintf(fp, gettext("\ # If keypad_mode is set to \"LINKS_ARE_NUMBERED\", then numbers will\n\ -# appear next to each link and numbers are used to select links.\n"); - fprintf(fp, "\ +# appear next to each link and numbers are used to select links.\n")); + fprintf(fp, gettext("\ # If keypad_mode is set to \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\", then\n\ # numbers will appear next to each link and visible form input field.\n\ # Numbers are used to select links, or to move the \"current link\" to a\n\ # form input field or button. In addition, options in popup menus are\n\ # indexed so that the user may type an option number to select an option in\n\ # a popup menu, even if the option isn't visible on the screen. Reference\n\ -# lists and output from the list command also enumerate form inputs.\n"); - fprintf(fp, "\ +# lists and output from the list command also enumerate form inputs.\n")); + fprintf(fp, gettext("\ # NOTE: Some fixed format documents may look disfigured when\n\ # \"LINKS_ARE_NUMBERED\" or \"LINKS_AND_FORM_FIELDS_ARE_NUMBERED\" are\n\ -# enabled.\n"); +# enabled.\n")); fprintf(fp, "keypad_mode=%s\n\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? "NUMBERS_AS_ARROWS" : ((keypad_mode == LINKS_ARE_NUMBERED) ? "LINKS_ARE_NUMBERED" : "LINKS_AND_FORM_FIELDS_ARE_NUMBERED"))); +#ifdef DISP_PARTIAL + /* + * Partial display threshold + */ + fprintf(fp, gettext("\ +# partial_thres specifies the number of lines Lynx should download and render\n\ +# before we redraw the screen in Partial Display logic\n\ +# e.g. partial_thres=2\n\ +# would have Lynx redraw every 2 lines that it renders\n\ +# partial_thres=-1 would use the entire screensize\n")); + fprintf(fp, "partial_thres=%d\n\n", partial_threshold); +#endif /* DISP_PARTIAL */ + /* * Lineedit mode. */ - fprintf(fp, "\ -# linedit_mode specifies the key binding used for inputting strings in\n\ + fprintf(fp, gettext("\ +# lineedit_mode specifies the key binding used for inputting strings in\n\ # prompts and forms. If lineedit_mode is set to \"Default Binding\" then\n\ # the following control characters are used for moving and deleting:\n\ #\n\ @@ -823,7 +877,7 @@ PUBLIC int save_rc NOPARAMS # Delete char: ^H ^R ^A = Beginning of line\n\ # Delete word: ^B ^F ^E = End of line\n\ #\n\ -# Current lineedit modes are:\n"); +# Current lineedit modes are:\n")); { char **bindings = LYLineeditNames; while (*bindings) { @@ -837,11 +891,11 @@ PUBLIC int save_rc NOPARAMS /* * List directory style. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # dir_list_styles specifies the directory list style under DIRED_SUPPORT\n\ # (if implemented). The default is \"MIXED_STYLE\", which sorts both\n\ # files and directories together. \"FILES_FIRST\" lists files first and\n\ -# \"DIRECTORIES_FIRST\" lists directories first.\n"); +# \"DIRECTORIES_FIRST\" lists directories first.\n")); fprintf(fp, "dir_list_style=%s\n\n", (dir_list_style==FILES_FIRST ? "FILES_FIRST" : @@ -852,24 +906,62 @@ PUBLIC int save_rc NOPARAMS /* * User mode. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # user_mode specifies the users level of knowledge with Lynx. The\n\ # default is \"NOVICE\" which displays two extra lines of help at the\n\ # bottom of the screen to aid the user in learning the basic Lynx\n\ # commands. Set user_mode to \"INTERMEDIATE\" to turn off the extra info.\n\ # Use \"ADVANCED\" to see the URL of the currently selected link at the\n\ -# bottom of the screen.\n"); +# bottom of the screen.\n")); fprintf(fp, "user_mode=%s\n\n", (user_mode == NOVICE_MODE ? "NOVICE" : (user_mode == ADVANCED_MODE ? "ADVANCED" : "INTERMEDIATE"))); + /* + * Cookie options + */ + fprintf(fp, gettext("\ +# accept_all_cookies allows the user to tell Lynx to automatically\n\ +# accept all cookies if desired. The default is \"FALSE\" which will\n\ +# prompt for each cookie. Set accept_all_cookies to \"TRUE\" to accept\n\ +# all cookies.\n")); + fprintf(fp, "accept_all_cookies=%s\n\n", + (LYAcceptAllCookies == FALSE ? "FALSE" : "TRUE")); + + fprintf(fp, gettext("\ +# cookie_accept_domains and cookie_reject_domains are comma-delimited\n\ +# lists of domains (with a leading '.') to automatically accept or\n\ +# reject all cookies from. The accept_all_cookies parameter will\n\ +# override any settings made here. If a single domain is specified in\n\ +# both cookie_accept_domains and in cookie_reject_domains, the rejection\n\ +# will take precedence.\n")); + fprintf(fp, "# cookie_accept_domains=\n"); + fprintf(fp, "# cookie_reject_domains=\n\n"); + + /* + * cookie_accept_domains and cookie_reject_domains not set here because + * there's not currently a method on the options menu (maybe later?) + * to set them. + */ + +#ifdef EXP_PERSISTENT_COOKIES + /* + * Cookie file. + */ + fprintf(fp, gettext("\ +# cookie_file specifies the file in which to store persistent cookies.\n\ +# The default is ~/.lynx_cookies.\n")); + fprintf(fp, "cookie_file=%s\n\n", + (LYCookieFile == NULL ? "~/.lynx_cookies" : LYCookieFile)); +#endif /* EXP_PERSISTENT_COOKIES */ + #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) /* * Local execution mode - all links. */ - fprintf(fp, "\ -# If run_all_execution_links is set \"on\" then all local exection links\n\ + fprintf(fp, gettext("\ +# If run_all_execution_links is set \"on\" then all local execution links\n\ # will be executed when they are selected.\n\ #\n\ # WARNING - This is potentially VERY dangerous. Since you may view\n\ @@ -877,14 +969,14 @@ PUBLIC int save_rc NOPARAMS # there exists the possibility that Trojan horse links could be\n\ # written. Trojan horse links could be written to erase files\n\ # or compromise security. This should only be set to \"on\" if\n\ -# you are viewing trusted source information.\n"); +# you are viewing trusted source information.\n")); fprintf(fp, "run_all_execution_links=%s\n\n", (local_exec ? "on" : "off")); /* * Local execution mode - only links in local files. */ - fprintf(fp, "\ + fprintf(fp, gettext("\ # If run_execution_links_on_local_files is set \"on\" then all local\n\ # execution links that are found in LOCAL files will be executed when they\n\ # are selected. This is different from run_all_execution_links in that\n\ @@ -896,29 +988,24 @@ PUBLIC int save_rc NOPARAMS # there exists the possibility that Trojan horse links could be\n\ # written. Trojan horse links could be written to erase files\n\ # or compromise security. This should only be set to \"on\" if\n\ -# you are viewing trusted source information.\n"); +# you are viewing trusted source information.\n")); fprintf(fp, "run_execution_links_on_local_files=%s\n\n", (local_exec_on_local_files ? "on" : "off")); #endif /* defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) */ + fprintf(fp, gettext("\ +# If verbose_images is \"on\", lynx will print the name of the image\n\ +# source file in place of [INLINE], [LINK] or [IMAGE]\n\ +# See also VERBOSE_IMAGES in lynx.cfg\n")); + fprintf(fp, "verbose_images=%s\n\n", + verbose_img ? "on" : "off"); + /* * Close the RC file. */ fclose(fp); -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_BINARY; -#endif /* __DJGPP__ or _WINDOWS */ -#ifdef VMS - /* - * Get rid of any copies of the .lynxrc file that VMS creates. - */ - while (remove("sys$login:.lynxrc;-1") == 0) ; - /* - * Reset version number. - */ - rename("sys$login:.lynxrc", "sys$login:.lynxrc;1"); -#endif /* VMS */ + HTSYS_purge(rcfile); - return TRUE; + return TRUE; } |