⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lyrcfile.c

📁 基于rtos开发的浏览器!
💻 C
📖 第 1 页 / 共 2 页
字号:
#include "HTUtils.h"#include "tcp.h"#include "HTFTP.h"#include "LYUtils.h"#include "LYrcFile.h"#include "LYStrings.h"#include "LYGlobalDefs.h"#include "LYCharSets.h"#include "LYBookmark.h"#include "LYLeaks.h"PUBLIC void read_rc NOPARAMS{    char line_buffer[256];    char rcfile[256];    FILE *fp;    char *cp, *cp2;    int number_sign;    char MBM_line[256];    int  MBM_counter;    char *MBM_cp2, *MBM_cp1;    int  MBM_i2;    /*     *  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 */    /*     *  Open the RC file for reading.     */    if ((fp = fopen(rcfile, "r")) == NULL) {	return;    }    /*     *  Process the entries.     */    while (fgets(line_buffer, 256, fp) != NULL) {	/*	 *  Remove the /n from the end of the line.	 */	if (line_buffer[0] && line_buffer[strlen(line_buffer)-1] == '\n')	    line_buffer[strlen(line_buffer)-1] = '\0';	/*	 *  Remove any trailing white space.	 */	while (line_buffer[0] && isspace(line_buffer[strlen(line_buffer)-1]))	    line_buffer[strlen(line_buffer)-1] = '\0';	/*	 *  Skip any comment or blank lines.	 */	if (line_buffer[0] == '\0' || line_buffer[0] == '#')	    continue;	/*	 *  Find the line position of the number sign if there is one.	 */	if ((cp = (char *)strchr(line_buffer, '#')) == NULL)	    number_sign = 999;	else	    number_sign = cp - line_buffer;	/*	 *  File editor.	 */	if (!system_editor &&	    (cp = LYstrstr(line_buffer, "file_editor")) != NULL &&	    cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    StrAllocCopy(editor, cp);	/*	 *  Default bookmark file.	 */	} else if ((cp = LYstrstr(line_buffer, "bookmark_file")) != NULL &&		    cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp,'=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    /*	     *  Since this is the "Default Bookmark File", we save it	     *  as a globals, and as the first MBM_A_subbookmark entry.	     */	    StrAllocCopy(bookmark_page, cp);	    StrAllocCopy(BookmarkPage, cp);	    StrAllocCopy(MBM_A_subbookmark[0], cp);	    StrAllocCopy(MBM_A_subdescript[0], MULTIBOOKMARKS_DEFAULT);	/*	 *  Multiple (sub)bookmark support settings.	 */	} else if ((cp = LYstrstr(line_buffer, "sub_bookmarks")) != NULL &&		   cp-line_buffer < number_sign) {	   if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = (cp2 + 1);	   while (isspace(*cp))	       cp++;  /* get rid of spaces */	   if (!strncasecomp(cp, "standard", 8)) {	      LYMultiBookmarks = TRUE;	      LYMBMAdvanced = FALSE;	   } else if (!strncasecomp(cp, "advanced", 8)) {	      LYMultiBookmarks = TRUE;	      LYMBMAdvanced = TRUE;	   } else {	      LYMultiBookmarks = FALSE;	   }	/*	 *  Multiple (sub)bookmark definitions and descriptions.	 */	} else if ((cp = LYstrstr(line_buffer, "multi_bookmark")) != NULL &&		   cp-line_buffer < number_sign) {	    /*	     *  Found the root, now cycle through all the	     *	possible spaces and match specific ones.	     */	    for (MBM_counter = 1;		 MBM_counter <= MBM_V_MAXFILES; MBM_counter++) {		sprintf(MBM_line, "multi_bookmark%c", (MBM_counter + 'A'));		if ((cp = LYstrstr(line_buffer, MBM_line)) != NULL &&		    cp-line_buffer < number_sign) {		    if ((MBM_cp1 = (char *)strchr(cp, '=')) == NULL) {			break;		    } else {			if ((MBM_cp2 = (char *)strchr(cp, ',')) == NULL) {			    break;			} else {			    MBM_i2 = 0;			    /*			     *  skip over the '='.			     */			    MBM_cp1++;			    while (MBM_cp1 && MBM_cp1 != MBM_cp2) {				/*				 *  Skip spaces.				 */				if (isspace(*MBM_cp1)) {				    MBM_cp1++;				    continue;				} else {				    MBM_line[MBM_i2++] = *MBM_cp1++;				}			    }			    MBM_line[MBM_i2++] = '\0';			    StrAllocCopy(MBM_A_subbookmark[MBM_counter],					 MBM_line);			    /*			     *  Now get the description ',' and ->.			     */			    MBM_cp1 = (char *)strchr(cp, ',');			    MBM_i2 = 0;			    /*			     *  Skip over the ','.			     */			    MBM_cp1++;			    /*			     *  Eat spaces in front of description.			     */			    while (isspace(*MBM_cp1))				MBM_cp1++;			    while (*MBM_cp1)				MBM_line[MBM_i2++] = *MBM_cp1++;			    MBM_line[MBM_i2++] = '\0';			    StrAllocCopy(MBM_A_subdescript[MBM_counter],					 MBM_line);			    break;			}		    }		}	    }	/*	 * FTP/file sorting method.	 */	} else if ((cp = LYstrstr(line_buffer,				  "file_sorting_method")) != NULL &&		   cp-line_buffer < number_sign) {	   if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	   while (isspace(*cp))	       cp++;  /* get rid of spaces */	   if (!strncasecomp(cp, "BY_FILENAME", 11))		HTfileSortMethod = FILE_BY_NAME;	   else if (!strncasecomp(cp, "BY_TYPE", 7))		HTfileSortMethod = FILE_BY_TYPE;	   else if (!strncasecomp(cp, "BY_SIZE", 7))		HTfileSortMethod = FILE_BY_SIZE;	   else if (!strncasecomp(cp, "BY_DATE", 7))		HTfileSortMethod = FILE_BY_DATE;	/*	 *  Personal mail address.	 */	} else if ((cp = LYstrstr(line_buffer,				  "personal_mail_address")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    StrAllocCopy(personal_mail_address, cp);	/*	 *  Searching type.	 */	} else if ((cp = LYstrstr(line_buffer,				  "case_sensitive_searching")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "on", 2))		case_sensitive = TRUE;	    else		case_sensitive = FALSE;	/*	 *  Character set.	 */	} else if ((cp = LYstrstr(line_buffer, "character_set")) != NULL &&		   cp-line_buffer < number_sign) {	    int i = 0;	    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;		}	    }	/*	 *  Preferred language.	 */	} else if ((cp = LYstrstr(line_buffer,				  "preferred_language")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    StrAllocCopy(language, cp);	/*	 *  Preferred charset.	 */	} else if ((cp = LYstrstr(line_buffer,				  "preferred_charset")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    StrAllocCopy(pref_charset, cp);	/*	 * VI keys.	 */	} else if ((cp = LYstrstr(line_buffer, "vi_keys")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char * )strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "on", 2))		vi_keys = TRUE;	    else		vi_keys = FALSE;	/*	 *  EMACS keys.	 */	} else if ((cp = LYstrstr(line_buffer, "emacs_keys")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "on", 2))		emacs_keys = TRUE;	    else		emacs_keys=FALSE;	/*	 *  Show dot files.	 */	} else if ((cp = LYstrstr(line_buffer, "show_dotfiles")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char * )strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "on", 2))		show_dotfiles = TRUE;	    else		show_dotfiles = FALSE;	/*	 *  Show color.	 */	} else if ((cp = LYstrstr(line_buffer, "show_color")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char * )strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "always", 6)) {		LYrcShowColor = SHOW_COLOR_ALWAYS;#if defined(USE_SLANG) || defined(COLOR_CURSES)		if (LYShowColor != SHOW_COLOR_NEVER)		    LYShowColor = SHOW_COLOR_ALWAYS;#endif /* USE_SLANG || COLOR_CURSES */	    } else if (!strncasecomp(cp, "never", 5)) {		LYrcShowColor = SHOW_COLOR_NEVER;#if defined(COLOR_CURSES)		if (LYShowColor == SHOW_COLOR_ON)		    LYShowColor = SHOW_COLOR_OFF;#endif /* COLOR_CURSES */	    }	/*	 *  Select popups.	 */	} else if ((cp = LYstrstr(line_buffer, "select_popups")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char * )strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "off", 3))		LYSelectPopups = FALSE;	    else		LYSelectPopups = TRUE;	/*	 *  Show cursor.	 */	} else if ((cp = LYstrstr(line_buffer, "show_cursor")) != NULL &&		   cp-line_buffer < number_sign) {	    if ((cp2 = (char * )strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    if (!strncasecomp(cp, "off", 3))		LYShowCursor = FALSE;	    else		LYShowCursor = TRUE;	/*	 *  Keypad mode.	 */	} else if ((cp = LYstrstr(line_buffer, "keypad_mode")) != 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, "LINKS_ARE_NUMBERED"))		keypad_mode = LINKS_ARE_NUMBERED;	    else if (LYstrstr(cp, "LINKS_AND_FORM_FIELDS_ARE_NUMBERED"))		keypad_mode = LINKS_AND_FORM_FIELDS_ARE_NUMBERED;	    else		keypad_mode = NUMBERS_AS_ARROWS;	/*	 *  Linedit mode.	 */	} else if ((cp = LYstrstr(line_buffer, "lineedit_mode")) != NULL &&		   cp-line_buffer < number_sign) {	    int i = 0;	    if ((cp2 = (char *)strchr(cp, '=')) != NULL)		cp = cp2 + 1;	    while (isspace(*cp))		cp++;  /* get rid of spaces */	    for (; LYLineeditNames[i]; i++) {		if (!strncmp(cp, LYLineeditNames[i], strlen(cp))) {		    current_lineedit = i;		    break;		}	    }#ifdef DIRED_SUPPORT	/*	 *  List directory style.	 */	} else if ((cp = LYstrstr(line_buffer, "dir_list_style")) != 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, "FILES_FIRST") != NULL) {		dir_list_style = FILES_FIRST;	    } else if (LYstrstr(cp,"DIRECTORIES_FIRST") != NULL) {		dir_list_style = 0;	    } else {		dir_list_style = MIXED_STYLE;	    }#endif /* DIRED_SUPPORT */	/*	 *  User mode.	 */	} else if ((cp = LYstrstr(line_buffer, "user_mode")) != 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, "ADVANCED") != NULL) {		user_mode = ADVANCED_MODE;	    } else if (LYstrstr(cp,"INTERMEDIATE") != NULL) {		user_mode = INTERMEDIATE_MODE;	    } else {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -