int i; static char tempfile[LY_MAXPATH] = "\0"; BOOLEAN disable_all = FALSE; FILE *fp0; size_t cset_len = 0; size_t text_len = LYscreenWidth() > 45 ? LYscreenWidth() - 38 : 7;	  if ((fp0 = InternalPageFP(tempfile, TRUE)) == 0) return(NOT_FOUND);  LYLocalFileToURL(newfile, tempfile);   LYforce_no_cache = TRUE;   #ifndef NO_OPTION_MENU if (!LYUseFormsOptions) disable_all = TRUE; #endif  BeginInternalPage(fp0, OPTIONS_TITLE, NULL);    fprintf(fp0, "<form action=\"%s\" method=\"post\">\n", STR_LYNXOPTIONS);  fprintf(fp0, "<input name=\"%s\" type=\"hidden\" value=\"%s\">\n", secure_string, NewSecureValue());     fprintf(fp0,"<p align=center>\n"); if (!disable_all) { fprintf(fp0,"<input type=\"submit\" value=\"%s\"> - \n", ACCEPT_CHANGES); fprintf(fp0,"<input type=\"reset\" value=\"%s\"> - \n", RESET_CHANGES); fprintf(fp0,"%s - \n", CANCEL_CHANGES);
if ((x_display == NULL && *display_option == '\0') || (x_display != NULL && !strcmp(x_display, display_option))) { if (x_display == NULL && LYisConfiguredForX == TRUE) { _statusline(VALUE_ACCEPTED_WARNING_X); } else if (x_display != NULL && LYisConfiguredForX == FALSE) { _statusline(VALUE_ACCEPTED_WARNING_NONX); } else { _statusline(VALUE_ACCEPTED); } } else { if (*display_option) { _statusline(FAILED_TO_SET_DISPLAY); } else { _statusline(FAILED_CLEAR_SET_DISPLAY); }
PRIVATE int gen_options ARGS1(	char **,	newfile){    int i;    static char tempfile[LY_MAXPATH] = "\0";    BOOLEAN disable_all = FALSE;    FILE *fp0;    size_t cset_len = 0;    size_t text_len = LYscreenWidth() > 45 ? LYscreenWidth() - 38 : 7;	/* cf: PutLabel */    if ((fp0 = InternalPageFP(tempfile, TRUE)) == 0)	return(NOT_FOUND);    LYLocalFileToURL(newfile, tempfile);    /* This should not be needed if we regenerate the temp file every       time with a new name, which just happened above in the case       LYReuseTempfiles==FALSE.  Even for LYReuseTempfiles=TRUE, code       at the end of postoptions() may remove an older cached version       from memory if that version of the page was left by submitting       changes. - kw 1999-11-27       If access to the actual file via getfile() later fails       (maybe because of some restrictions), mainloop may leave       this flag on after popping the previous doc which is then       unnecessarily reloaded.  But I changed mainloop to reset       the flag. - kw 1999-05-24 */    LYforce_no_cache = TRUE;    /*     * Without LYUseFormsOptions set we should maybe not even get here.     * However, it's possible we do; disable the form in that case. - kw     */#ifndef NO_OPTION_MENU    if (!LYUseFormsOptions)	disable_all = TRUE;#endif    BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */    /*     * I do C, not HTML.  Feel free to pretty this up.     */    fprintf(fp0, "<form action=\"%s\" method=\"post\">\n", STR_LYNXOPTIONS);    /*     * use following with some sort of one shot secret key akin to NCSA     * (or was it CUTE?) telnet one shot password to allow ftp to self.     * to prevent spoofing.     */    fprintf(fp0, "<input name=\"%s\" type=\"hidden\" value=\"%s\">\n",		 secure_string, NewSecureValue());    /*     * visible text begins here     */    /* Submit/Reset/Help */    fprintf(fp0,"<p align=center>\n");    if (!disable_all) {	fprintf(fp0,"<input type=\"submit\" value=\"%s\"> - \n", ACCEPT_CHANGES);	fprintf(fp0,"<input type=\"reset\" value=\"%s\"> - \n", RESET_CHANGES);	fprintf(fp0,"%s - \n", CANCEL_CHANGES);    }    fprintf(fp0, "<a href=\"%s%s\">%s</a>\n",		 helpfilepath, OPTIONS_HELP, TO_HELP);    /* Save options */    if (!no_option_save) {	if (!disable_all) {	    fprintf(fp0, "<p align=center>%s: ", SAVE_OPTIONS);	    fprintf(fp0, "<input type=\"checkbox\" name=\"%s\">\n",			 save_options_string);	}	fprintf(fp0, "<br>%s\n",			gettext("(options marked with (!) will not be saved)"));    }    /*     * preformatted text follows     */    fprintf(fp0,"<pre>\n");    fprintf(fp0,"\n  <em>%s</em>\n", gettext("General Preferences"));    /*****************************************************************/    /* User Mode: SELECT */    PutLabel(fp0, gettext("User mode"), user_mode_string);    BeginSelect(fp0, user_mode_string);    PutOptValues(fp0, user_mode, user_mode_values);    EndSelect(fp0);    /* Editor: INPUT */    PutLabel(fp0, gettext("Editor"), editor_string);    PutTextInput(fp0, editor_string, NonNull(editor), text_len,		      DISABLED(no_editor || system_editor));    /* Search Type: SELECT */    PutLabel(fp0, gettext("Type of Search"), search_type_string);    BeginSelect(fp0, search_type_string);    PutOptValues(fp0, case_sensitive, search_type_values);    EndSelect(fp0);    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Security and Privacy"));    /*****************************************************************/    /* Cookies: SELECT */    PutLabel(fp0, gettext("Cookies"), will_save_cookies());    BeginSelect(fp0, cookies_string);    PutOption(fp0, !LYSetCookies,		   cookies_ignore_all_string,		   cookies_ignore_all_string);    PutOption(fp0, LYSetCookies && !LYAcceptAllCookies,		   cookies_up_to_user_string,		   cookies_up_to_user_string);    PutOption(fp0, LYSetCookies && LYAcceptAllCookies,		   cookies_accept_all_string,		   cookies_accept_all_string);    EndSelect(fp0);    /* Cookie Prompting: SELECT */    PutLabel(fp0, gettext("Invalid-Cookie Prompting"), cookie_prompt_string);    BeginSelect(fp0, cookie_prompt_string);    PutOptValues(fp0, cookie_noprompt, prompt_values);    EndSelect(fp0);#ifdef USE_SSL    /* SSL Prompting: SELECT */    PutLabel(fp0, gettext("SSL Prompting"), ssl_prompt_string);    BeginSelect(fp0, ssl_prompt_string);    PutOptValues(fp0, ssl_noprompt, prompt_values);    EndSelect(fp0);#endif    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Keyboard Input"));    /*****************************************************************/    /* Keypad Mode: SELECT */    PutLabel(fp0, gettext("Keypad mode"), keypad_mode_string);    BeginSelect(fp0, keypad_mode_string);    PutOptValues(fp0, keypad_mode, keypad_mode_values);    EndSelect(fp0);    /* Emacs keys: ON/OFF */    PutLabel(fp0, gettext("Emacs keys"), emacs_keys_string);    BeginSelect(fp0, emacs_keys_string);    PutOptValues(fp0, emacs_keys, bool_values);    EndSelect(fp0);    /* VI Keys: ON/OFF */    PutLabel(fp0, gettext("VI keys"), vi_keys_string);    BeginSelect(fp0, vi_keys_string);    PutOptValues(fp0, vi_keys, bool_values);    EndSelect(fp0);    /* Line edit style: SELECT */    if (LYLineeditNames[1]) { /* well, at least 2 line edit styles available */	PutLabel(fp0, gettext("Line edit style"), lineedit_mode_string);	BeginSelect(fp0, lineedit_mode_string);	for (i = 0; LYLineeditNames[i]; i++) {	    char temp[16];	    sprintf(temp, "%d", i);	    PutOption(fp0, i==current_lineedit, temp, LYLineeditNames[i]);	}	EndSelect(fp0);    }#ifdef EXP_KEYBOARD_LAYOUT    /* Keyboard layout: SELECT */    PutLabel(fp0, gettext("Keyboard layout"), kblayout_string);    BeginSelect(fp0, kblayout_string);    for (i = 0; LYKbLayoutNames[i]; i++) {	char temp[16];	sprintf(temp, "%d", i);	PutOption(fp0, i == current_layout, temp, LYKbLayoutNames[i]);    }    EndSelect(fp0);#endif /* EXP_KEYBOARD_LAYOUT */    /*     * Display and Character Set     */    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Display and Character Set"));    /*****************************************************************/#ifdef EXP_LOCALE_CHARSET    /* Use locale-based character set: ON/OFF */    PutLabel(fp0, gettext("Use locale-based character set"), locale_charset_string);    BeginSelect(fp0, locale_charset_string);    PutOptValues(fp0, LYLocaleCharset, bool_values);    EndSelect(fp0);#else#define LYLocaleCharset FALSE#endif    /* Display Character Set: SELECT */    PutLabel(fp0, gettext("Display character set"), display_char_set_string);    MaybeSelect(fp0, LYLocaleCharset, display_char_set_string);    for (i = 0; LYchar_set_names[i]; i++) {	char temp[10];	size_t len = strlen(LYchar_set_names[i]);	if (len > cset_len)	    cset_len = len;	sprintf(temp, "%d", i);#ifdef EXP_CHARSET_CHOICE	if (!charset_subsets[i].hide_display)#endif	PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]);    }    EndSelect(fp0);    /* Assume Character Set: SELECT */    {	int curval;	curval = UCLYhndl_for_unspec;	/*	 * FIXME: If bogus value in lynx.cfg, then in old way, that is the	 * string that was displayed.  Now, user will never see that.  Good	 * or bad?  I don't know.  MRC	 */	if (curval == current_char_set) {		/* ok, LYRawMode, so use UCAssume_MIMEcharset */	    curval = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);	}	PutLabel(fp0, gettext("Assumed document character set"), assume_char_set_string);	BeginSelect(fp0, assume_char_set_string);	for (i = 0; i < LYNumCharsets; i++) {#ifdef EXP_CHARSET_CHOICE	    if (!charset_subsets[i].hide_assumed)#endif	    PutOption(fp0, i == curval,			   LYCharSet_UC[i].MIMEname,			   LYCharSet_UC[i].MIMEname);	}	EndSelect(fp0);    }    /* Raw Mode: ON/OFF */    if (LYHaveCJKCharacterSet) {	/*	 * Since CJK people hardly mixed with other world	 * we split the header to make it more readable:	 * "CJK mode" for CJK display charsets, and "Raw 8-bit" for others.	 */	PutLabel(fp0, gettext("CJK mode"), raw_mode_string);    } else {	PutLabel(fp0, gettext("Raw 8-bit"), raw_mode_string);    }    BeginSelect(fp0, raw_mode_string);    PutOptValues(fp0, LYRawMode, bool_values);    EndSelect(fp0);    /* X Display: INPUT */    PutLabel(fp0, gettext("X Display"),	x_display_string);    PutTextInput(fp0, x_display_string, NonNull(x_display), text_len, "");    /*     * Document Appearance     */    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Document Appearance"));    /*****************************************************************/    /* Show Color: SELECT */#if defined(USE_SLANG) || defined(COLOR_CURSES)    SetupChosenShowColor();    PutLabel(fp0, gettext("Show color"), show_color_string);    if (no_option_save) {	MaybeSelect(fp0, !can_do_colors, show_color_string);	if (LYShowColor == SHOW_COLOR_NEVER) {	   LYShowColor = SHOW_COLOR_OFF;	} else if (LYShowColor == SHOW_COLOR_ALWAYS) {	   LYShowColor = SHOW_COLOR_ON;	}	PutOptValues(fp0, LYShowColor - SHOW_COLOR_OFF, bool_values);    } else {	BeginSelect(fp0, show_color_string);	if (can_do_colors) {	   show_color_values[2].HtmlName = on_string;	   show_color_values[3].LongName = always_string;	} else {	   show_color_values[2].HtmlName = NULL; /* suppress "ON" - kw */	   show_color_values[3].LongName = "Always try";	}	PutOptValues(fp0, LYChosenShowColor, show_color_values);    }    EndSelect(fp0);#endif /* USE_SLANG || COLOR_CURSES */    /* Show cursor: ON/OFF */    PutLabel(fp0, gettext("Show cursor"), show_cursor_string);    BeginSelect(fp0, show_cursor_string);    PutOptValues(fp0, LYShowCursor, bool_values);    EndSelect(fp0);    /* Underline links: ON/OFF */    PutLabel(fp0, gettext("Underline links"), underline_links_string);    BeginSelect(fp0, underline_links_string);    PutOptValues(fp0, LYUnderlineLinks, bool_values);    EndSelect(fp0);#ifdef USE_SCROLLBAR    /* Show scrollbar: ON/OFF */    PutLabel(fp0, gettext("Show scrollbar"), show_scrollbar_string);    BeginSelect(fp0, show_scrollbar_string);    PutOptValues(fp0, LYShowScrollbar, bool_values);    EndSelect(fp0);#endif    /* Select Popups: ON/OFF */    PutLabel(fp0, gettext("Popups for select fields"), select_popups_string);    BeginSelect(fp0, select_popups_string);    PutOptValues(fp0, LYSelectPopups, bool_values);    EndSelect(fp0);    /* HTML error recovery: SELECT */    PutLabel(fp0, gettext("HTML error recovery"), DTD_recovery_string);    BeginSelect(fp0, DTD_recovery_string);    PutOptValues(fp0, Old_DTD, DTD_type_values);    EndSelect(fp0);    /* Show Images: SELECT */    PutLabel(fp0, gettext("Show images"), will_save_images());    BeginSelect(fp0, images_string);    PutOption(fp0, !pseudo_inline_alts && !clickable_images,		   images_ignore_all_string,		   images_ignore_all_string);    PutOption(fp0, pseudo_inline_alts && !clickable_images,		   images_use_label_string,		   images_use_label_string);    PutOption(fp0, clickable_images,		   images_use_links_string,		   images_use_links_string);    EndSelect(fp0);    /* Verbose Images: ON/OFF */    PutLabel(fp0, gettext("Verbose images"), verbose_images_string);    BeginSelect(fp0, verbose_images_string);    PutOptValues(fp0, verbose_img, verbose_images_type_values);    EndSelect(fp0);    /*     * Headers Transferred to Remote Servers     */    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Headers Transferred to Remote Servers"));    /*****************************************************************/    /* Mail Address: INPUT */    PutLabel(fp0, gettext("Personal mail address"), mail_address_string);    PutTextInput(fp0, mail_address_string,		      NonNull(personal_mail_address), text_len, "");    /* Preferred Document Character Set: INPUT */    PutLabel(fp0, gettext("Preferred document character set"), preferred_doc_char_string);    PutTextInput(fp0, preferred_doc_char_string,		      NonNull(pref_charset), cset_len+2, "");    /* Preferred Document Language: INPUT */    PutLabel(fp0, gettext("Preferred document language"), preferred_doc_lang_string);    PutTextInput(fp0, preferred_doc_lang_string,		      NonNull(language), cset_len+2, "");    /* User Agent: INPUT */    if (!no_useragent) {	PutLabel(fp0, gettext("User-Agent header"), user_agent_string);	PutTextInput(fp0, user_agent_string,			  NonNull(LYUserAgent), text_len, "");    }    /*     * Listing and Accessing Files     */    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Listing and Accessing Files"));    /*****************************************************************/    /* FTP sort: SELECT */    PutLabel(fp0, gettext("FTP sort criteria"),	ftp_sort_string);    BeginSelect(fp0, ftp_sort_string);    PutOptValues(fp0, HTfileSortMethod, ftp_sort_values);    EndSelect(fp0);#ifdef DIRED_SUPPORT    /* Local Directory Sort: SELECT */    PutLabel(fp0, gettext("Local directory sort criteria"), dired_list_string);    BeginSelect(fp0, dired_list_string);    PutOptValues(fp0, dir_list_style, dired_list_values);    EndSelect(fp0);#ifdef LONG_LIST    /* Local Directory Order: SELECT */    PutLabel(fp0, gettext("Local directory sort order"), dired_sort_string);    BeginSelect(fp0, dired_sort_string);    PutOptValues(fp0, dir_list_order, dired_sort_values);    EndSelect(fp0);#endif /* LONG_LIST */#endif /* DIRED_SUPPORT */    /* Show dot files: ON/OFF */    if (!no_dotfiles) {	PutLabel(fp0, gettext("Show dot files"), show_dotfiles_string);	BeginSelect(fp0, show_dotfiles_string);	PutOptValues(fp0, show_dotfiles, bool_values);	EndSelect(fp0);    }    /* Execution links: SELECT */#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))    PutLabel(fp0, gettext("Execution links"), exec_links_string);    BeginSelect(fp0, exec_links_string);#ifndef NEVER_ALLOW_REMOTE_EXEC    PutOptValues(fp0, local_exec		      ? EXEC_ALWAYS		      : (local_exec_on_local_files			  ? EXEC_LOCAL			  : EXEC_NEVER),		      exec_links_values);#else    PutOptValues(fp0, local_exec_on_local_files		      ? EXEC_LOCAL		      : EXEC_NEVER,		      exec_links_values);#endif /* !NEVER_ALLOW_REMOTE_EXEC */    EndSelect(fp0);#endif /* ENABLE_OPTS_CHANGE_EXEC */#ifdef USE_READPROGRESS    /* Show transfer rate: SELECT */    PutLabel(fp0, gettext("Show transfer rate"), show_rate_string);    BeginSelect(fp0, show_rate_string);    for (i = 0; rate_values[i].LongName != 0; ++i) {	char *message = NULL;	HTSprintf0(&message,		   rate_values[i].LongName,		   HTProgressUnits(rate_values[i].value));	PutOption(fp0,		  LYTransferRate == rate_values[i].value,		  rate_values[i].HtmlName,		  message);        FREE(message);    }    EndSelect(fp0);#endif /* USE_READPROGRESS */    /*     * Special Files and Screens     */    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Special Files and Screens"));    /*****************************************************************/    /* Multi-Bookmark Mode: SELECT */    if (!LYMBMBlocked) {	PutLabel(fp0, gettext("Multi-bookmarks"), mbm_string);	BeginSelect(fp0, mbm_string);	PutOptValues(fp0, LYMultiBookmarks, mbm_values);	EndSelect(fp0);    }    /* Bookmarks File Menu: LINK/INPUT */    if (LYMultiBookmarks) {	PutLabel(fp0, gettext("Review/edit Bookmarks files"), mbm_string);	fprintf(fp0, "<a href=\"%s//MBM_MENU\">%s</a>\n",		    STR_LYNXOPTIONS, gettext("Goto multi-bookmark menu"));    } else {	PutLabel(fp0, gettext("Bookmarks file"), single_bookmark_string);	PutTextInput(fp0, single_bookmark_string,			 NonNull(bookmark_page), text_len, "");    }    /* Visited Pages: SELECT */    PutLabel(fp0, gettext("Visited Pages"), visited_links_string);    LYMenuVisitedLinks(fp0, disable_all);    if (!no_lynxcfg_info) {	fprintf(fp0, "\n  %s<a href=\"%s\">lynx.cfg</a>.\n",		     gettext("View the file "),		     STR_LYNXCFG);    }    fprintf(fp0,"\n</pre>\n");    /* Submit/Reset */    if (!disable_all) {	fprintf(fp0,"<p align=center>\n");	fprintf(fp0,"<input type=\"submit\" value=\"%s\"> - \n", ACCEPT_CHANGES);	fprintf(fp0,"<input type=\"reset\" value=\"%s\"> - \n", RESET_CHANGES);	fprintf(fp0,"%s\n", CANCEL_CHANGES);    }    /*     * close HTML     */    fprintf(fp0,"</form>\n");    EndInternalPage(fp0);    LYCloseTempFP(fp0);    return(NORMAL);}