3
#include <HTTP.h> /* 'reloading' flag */
8
#include <LYGlobalDefs.h>
10
#include <LYOptions.h>
13
#include <LYCharSets.h>
19
#include <LYBookmark.h>
21
#include <LYGetFile.h>
22
#include <LYReadCFG.h>
23
#include <LYPrettySrc.h>
30
PRIVATE int LYChosenShowColor = SHOW_COLOR_UNKNOWN; /* whether to show and save */
32
PRIVATE void terminate_options PARAMS((int sig));
34
#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES)))
35
#define COL_OPTION_VALUES 36 /* display column where option values start */
38
#if defined(USE_SLANG) || defined(COLOR_CURSES)
39
PRIVATE BOOLEAN can_do_colors = FALSE;
42
PUBLIC BOOLEAN LYCheckUserAgent NOARGS
44
if (LYUserAgent && *LYUserAgent) {
45
if (strstr(LYUserAgent, "Lynx") == 0
46
&& strstr(LYUserAgent, "lynx") == 0
47
&& strstr(LYUserAgent, "L_y_n_x") == 0
48
&& strstr(LYUserAgent, "l_y_n_x") == 0) {
55
PRIVATE void SetupChosenShowColor NOARGS
57
#if defined(USE_SLANG) || defined(COLOR_CURSES)
59
#if defined(COLOR_CURSES)
60
if (LYCursesON) /* could crash if called before initialization */
61
can_do_colors = (BOOL) has_colors();
63
if (!no_option_save) {
64
if (LYChosenShowColor == SHOW_COLOR_UNKNOWN) {
65
switch (LYrcShowColor) {
66
case SHOW_COLOR_NEVER:
68
(LYShowColor >= SHOW_COLOR_ON) ?
69
SHOW_COLOR_ON : SHOW_COLOR_NEVER;
71
case SHOW_COLOR_ALWAYS:
73
LYChosenShowColor = SHOW_COLOR_ALWAYS;
76
(LYShowColor >= SHOW_COLOR_ON) ?
77
SHOW_COLOR_ALWAYS : SHOW_COLOR_OFF;
81
(LYShowColor >= SHOW_COLOR_ON) ?
82
SHOW_COLOR_ON : SHOW_COLOR_OFF;
86
#endif /* USE_SLANG || COLOR_CURSES */
89
PRIVATE void validate_x_display NOPARAMS
92
if ((cp = LYgetXDisplay()) != NULL) {
93
StrAllocCopy(x_display, cp);
99
PRIVATE void summarize_x_display ARGS1(
100
char *, display_option)
102
if ((x_display == NULL && *display_option == '\0') ||
103
(x_display != NULL && !strcmp(x_display, display_option))) {
104
if (x_display == NULL && LYisConfiguredForX == TRUE) {
105
_statusline(VALUE_ACCEPTED_WARNING_X);
106
} else if (x_display != NULL && LYisConfiguredForX == FALSE) {
107
_statusline(VALUE_ACCEPTED_WARNING_NONX);
109
_statusline(VALUE_ACCEPTED);
112
if (*display_option) {
113
_statusline(FAILED_TO_SET_DISPLAY);
115
_statusline(FAILED_CLEAR_SET_DISPLAY);
121
#ifndef NO_OPTION_MENU
122
PRIVATE int boolean_choice PARAMS((
126
CONST char ** choices));
127
#define LYChooseBoolean(status, line, column, choices) \
128
boolean_choice(status, line, column, (CONST char **)choices)
130
#define MAXCHOICES 10
133
* Values for the options menu. - FM
135
* L_foo values are the Y coordinates for the menu item.
136
* B_foo values are the X coordinates for the item's prompt string.
137
* C_foo values are the X coordinates for the item's value string.
148
#define L_MAIL_ADDRESS 6
151
#define L_PREF_CHARSET 9
152
#define L_ASSUME_CHARSET (L_PREF_CHARSET + 1)
156
#define L_COLOR L_RAWMODE
163
#define B_EMACSKEYS 22
164
#define C_EMACSKEYS 36
165
#define B_SHOW_DOTFILES 44
166
#define C_SHOW_DOTFILES 62
169
#define B_SELECT_POPUPS 5
170
#define C_SELECT_POPUPS 36
171
#define B_SHOW_CURSOR 44
172
#define C_SHOW_CURSOR 62
180
#define L_USER_MODE 18
181
#define L_USER_AGENT 19
184
#define L_USER_MODE 17
185
#define L_USER_AGENT 18
187
#endif /* DIRED_SUPPORT */
189
#define L_VERBOSE_IMAGES L_USER_MODE
190
#define B_VERBOSE_IMAGES 50
191
#define C_VERBOSE_IMAGES (B_VERBOSE_IMAGES + 21)
193
/* a kludge to add assume_charset only in ADVANCED mode... */
194
#define L_Bool_A (use_assume_charset ? L_BOOL_A + 1 : L_BOOL_A)
195
#define L_Bool_B (use_assume_charset ? L_BOOL_B + 1 : L_BOOL_B)
196
#define L_Exec (use_assume_charset ? L_EXEC + 1 : L_EXEC)
197
#define L_Rawmode (use_assume_charset ? L_RAWMODE + 1 : L_RAWMODE)
198
#define L_Charset (use_assume_charset ? L_CHARSET + 1 : L_CHARSET)
199
#define L_Color (use_assume_charset ? L_COLOR + 1 : L_COLOR)
200
#define L_Keypad (use_assume_charset ? L_KEYPAD + 1 : L_KEYPAD)
201
#define L_Lineed (use_assume_charset ? L_LINEED + 1 : L_LINEED)
202
#define L_Layout (use_assume_charset ? L_LAYOUT + 1 : L_LAYOUT)
203
#define L_Dired (use_assume_charset ? L_DIRED + 1 : L_DIRED)
204
#define L_User_Mode (use_assume_charset ? L_USER_MODE + 1 : L_USER_MODE)
205
#define L_User_Agent (use_assume_charset ? L_USER_AGENT + 1 : L_USER_AGENT)
210
PRIVATE int add_it ARGS2(char *, text, int, len)
220
* addlbl() is used instead of plain LYaddstr() in old-style options menu
221
* to show hot keys in bold.
223
PRIVATE void addlbl ARGS1(CONST char *, text)
229
for (s = d = 0; text[s]; s++) {
230
actual[d++] = text[s];
231
if (text[s] == LPAREN) {
232
d = add_it(actual, d-1);
235
actual[d++] = text[s];
236
} else if (text[s] == RPAREN) {
237
d = add_it(actual, d);
247
#if !defined(VMS) || defined(USE_SLANG)
248
#define HANDLE_LYOPTIONS \
249
if (term_options) { \
250
term_options = FALSE; \
252
AddValueAccepted = TRUE; \
256
#define HANDLE_LYOPTIONS \
257
term_options = FALSE; \
258
if (use_assume_charset != old_use_assume_charset) \
260
#endif /* !VMS || USE_SLANG */
262
PUBLIC void LYoptions NOARGS
264
#define ShowBool(value) LYaddstr((value) ? "ON " : "OFF")
265
static char *bool_choices[] = {
270
static char *caseless_choices[] = {
275
static char *dirList_choices[] = {
281
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
282
static char *exec_choices[] = {
284
"FOR LOCAL FILES ONLY",
285
#ifndef NEVER_ALLOW_REMOTE_EXEC
287
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
291
static char *fileSort_choices[] = {
298
static char *keypad_choices[] = {
299
"Numbers act as arrows",
300
"Links are numbered",
301
"Links and form fields are numbered",
304
static char *mbm_choices[] = {
310
static char *userMode_choices[] = {
316
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
318
#endif /* ENABLE_OPTS_CHANGE_EXEC */
321
* If the user changes the display we need memory to put it in.
323
char display_option[256];
324
char *choices[MAXCHOICES];
325
int CurrentCharSet = current_char_set;
326
int CurrentAssumeCharSet = UCLYhndl_for_unspec;
327
int CurrentShowColor = LYShowColor;
328
BOOLEAN CurrentRawMode = LYRawMode;
329
BOOLEAN AddValueAccepted = FALSE;
331
BOOL use_assume_charset, old_use_assume_charset;
334
#ifdef ENABLE_OPTS_CHANGE_EXEC
336
HTAlert(OPTION_SCREEN_NEEDS_24);
341
HTAlert(OPTION_SCREEN_NEEDS_23);
344
#endif /* ENABLE_OPTS_CHANGE_EXEC */
346
#ifdef ENABLE_OPTS_CHANGE_EXEC
348
HTAlert(OPTION_SCREEN_NEEDS_23);
353
HTAlert(OPTION_SCREEN_NEEDS_22);
356
#endif /* ENABLE_OPTS_CHANGE_EXEC */
357
#endif /* DIRED_SUPPORT */
359
term_options = FALSE;
360
LYStatusLine = (LYlines - 1); /* screen is otherwise too crowded */
361
signal(SIGINT, terminate_options);
362
if (no_option_save) {
363
if (LYShowColor == SHOW_COLOR_NEVER) {
364
LYShowColor = SHOW_COLOR_OFF;
365
} else if (LYShowColor == SHOW_COLOR_ALWAYS) {
366
LYShowColor = SHOW_COLOR_ON;
368
#if defined(USE_SLANG) || defined(COLOR_CURSES)
370
SetupChosenShowColor();
371
#endif /* USE_SLANG || COLOR_CURSES */
374
old_use_assume_charset =
375
use_assume_charset = (BOOL) (user_mode == ADVANCED_MODE);
379
old_use_assume_charset = use_assume_charset;
381
* NOTE that printw() should be avoided for strings that
382
* might have non-ASCII or multibyte/CJK characters. - FM
384
#if defined(FANCY_CURSES) || defined (USE_SLANG)
385
if (enable_scrollback) {
392
#endif /* FANCY_CURSES || USE_SLANG */
395
lynx_start_h1_color ();
396
LYaddstr(" Options Menu (");
398
LYaddstr(" Version ");
399
LYaddstr(LYNX_VERSION);
401
lynx_stop_h1_color ();
403
addlbl("(E)ditor : ");
404
LYaddstr((editor && *editor) ? editor : "NONE");
406
LYmove(L_DISPLAY, 5);
407
addlbl("(D)ISPLAY variable : ");
408
LYaddstr((x_display && *x_display) ? x_display : "NONE");
411
addlbl("mu(L)ti-bookmarks: ");
412
LYaddstr(mbm_choices[LYMultiBookmarks]);
413
LYmove(L_HOME, B_BOOK);
414
if (LYMultiBookmarks != MBM_OFF) {
415
addlbl("review/edit (B)ookmarks files");
417
addlbl("(B)ookmark file: ");
418
LYaddstr((bookmark_page && *bookmark_page) ? bookmark_page : "NONE");
421
LYmove(L_FTPSTYPE, 5);
422
addlbl("(F)TP sort criteria : ");
423
LYaddstr((HTfileSortMethod == FILE_BY_NAME ? "By Filename" :
424
(HTfileSortMethod == FILE_BY_SIZE ? "By Size " :
425
(HTfileSortMethod == FILE_BY_TYPE ? "By Type " :
428
LYmove(L_MAIL_ADDRESS, 5);
429
addlbl("(P)ersonal mail address : ");
430
LYaddstr((personal_mail_address && *personal_mail_address) ?
431
personal_mail_address : "NONE");
433
LYmove(L_SSEARCH, 5);
434
addlbl("(S)earching type : ");
435
LYaddstr(case_sensitive ? "CASE SENSITIVE " : "CASE INSENSITIVE");
437
LYmove(L_Charset, 5);
438
addlbl("display (C)haracter set : ");
439
LYaddstr(LYchar_set_names[current_char_set]);
441
LYmove(L_LANGUAGE, 5);
442
addlbl("preferred document lan(G)uage: ");
443
LYaddstr((language && *language) ? language : "NONE");
445
LYmove(L_PREF_CHARSET, 5);
446
addlbl("preferred document c(H)arset : ");
447
LYaddstr((pref_charset && *pref_charset) ? pref_charset : "NONE");
449
if (use_assume_charset) {
450
LYmove(L_ASSUME_CHARSET, 5);
451
addlbl("(^A)ssume charset if unknown : ");
452
if (UCAssume_MIMEcharset)
453
LYaddstr(UCAssume_MIMEcharset);
455
LYaddstr((UCLYhndl_for_unspec >= 0) ?
456
LYCharSet_UC[UCLYhndl_for_unspec].MIMEname
460
LYmove(L_Rawmode, 5);
461
addlbl("Raw 8-bit or CJK m(O)de : ");
464
#if defined(USE_SLANG) || defined(COLOR_CURSES)
465
LYmove(L_Color, B_COLOR);
466
addlbl("show color (&) : ");
467
if (no_option_save) {
468
ShowBool(LYShowColor == SHOW_COLOR_OFF);
470
switch (LYChosenShowColor) {
471
case SHOW_COLOR_NEVER:
480
case SHOW_COLOR_ALWAYS:
481
#if defined(COLOR_CURSES)
483
LYaddstr("Always try");
489
#endif /* USE_SLANG || COLOR_CURSES */
491
LYmove(L_Bool_A, B_VIKEYS);
492
addlbl("(V)I keys: ");
495
LYmove(L_Bool_A, B_EMACSKEYS);
496
addlbl("e(M)acs keys: ");
497
ShowBool(emacs_keys);
499
LYmove(L_Bool_A, B_SHOW_DOTFILES);
500
addlbl("sho(W) dot files: ");
501
ShowBool(!no_dotfiles && show_dotfiles);
503
LYmove(L_Bool_B, B_SELECT_POPUPS);
504
addlbl("popups for selec(T) fields : ");
505
ShowBool(LYSelectPopups);
507
LYmove(L_Bool_B, B_SHOW_CURSOR);
508
addlbl("show cursor (@) : ");
509
ShowBool(LYShowCursor);
512
addlbl("(K)eypad mode : ");
513
LYaddstr(fields_are_numbered() && links_are_numbered()
514
? "Links and form fields are numbered"
515
: links_are_numbered()
516
? "Links are numbered "
517
: fields_are_numbered()
518
? "Form fields are numbered "
519
: "Numbers act as arrows ");
522
addlbl("li(N)e edit style : ");
523
LYaddstr(LYLineeditNames[current_lineedit]);
525
#ifdef EXP_KEYBOARD_LAYOUT
527
addlbl("Ke(Y)board layout : ");
528
LYaddstr(LYKbLayoutNames[current_layout]);
533
addlbl("l(I)st directory style : ");
534
LYaddstr((dir_list_style == FILES_FIRST) ? "Files first " :
535
((dir_list_style == MIXED_STYLE) ? "Mixed style " :
536
"Directories first"));
537
#endif /* DIRED_SUPPORT */
539
LYmove(L_User_Mode, 5);
540
addlbl("(U)ser mode : ");
541
LYaddstr( (user_mode == NOVICE_MODE) ? "Novice " :
542
((user_mode == INTERMEDIATE_MODE) ? "Intermediate" :
545
addlbl(" verbose images (!) : ");
546
ShowBool( verbose_img);
548
LYmove(L_User_Agent, 5);
549
addlbl("user (A)gent : ");
550
LYaddstr((LYUserAgent && *LYUserAgent) ? LYUserAgent : "NONE");
552
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
554
addlbl("local e(X)ecution links : ");
555
#ifndef NEVER_ALLOW_REMOTE_EXEC
556
LYaddstr( local_exec ? "ALWAYS ON " :
557
(local_exec_on_local_files ? "FOR LOCAL FILES ONLY" :
560
LYaddstr(local_exec_on_local_files ? "FOR LOCAL FILES ONLY" :
562
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
563
#endif /* ENABLE_OPTS_CHANGE_EXEC */
565
LYmove(LYlines-3, 2);
566
LYaddstr(SELECT_SEGMENT);
568
LYaddstr(CAP_LETT_SEGMENT);
570
LYaddstr(OF_OPT_LINE_SEGMENT);
571
if (!no_option_save) {
577
LYaddstr(TO_SAVE_SEGMENT);
579
LYaddstr(OR_SEGMENT);
585
LYaddstr(TO_RETURN_SEGMENT);
588
while (response != 'R' &&
589
!LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
590
response != '>' && !term_options &&
591
!LYCharIsINTERRUPT_NO_letter(response)) {
592
if (AddValueAccepted == TRUE) {
593
_statusline(VALUE_ACCEPTED);
594
AddValueAccepted = FALSE;
596
LYmove((LYlines - 2), 0);
597
lynx_start_prompt_color ();
598
LYaddstr(COMMAND_PROMPT);
599
lynx_stop_prompt_color ();
602
response = LYgetch_single();
603
if (term_options || LYCharIsINTERRUPT_NO_letter(response))
605
if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
606
lynx_force_repaint();
610
case 'E': /* Change the editor. */
612
_statusline(EDIT_DISABLED);
613
} else if (system_editor ) {
614
_statusline(EDITOR_LOCKED);
616
if (editor && *editor)
617
LYstrncpy(display_option, editor, sizeof(display_option) - 1);
618
else { /* clear the NONE */
619
LYmove(L_EDITOR, COL_OPTION_VALUES);
621
*display_option = '\0';
623
_statusline(ACCEPT_DATA);
624
LYmove(L_EDITOR, COL_OPTION_VALUES);
626
ch = LYgetstr(display_option, VISIBLE,
627
sizeof(display_option), NORECALL);
629
LYmove(L_EDITOR, COL_OPTION_VALUES);
630
if (term_options || ch == -1) {
631
LYaddstr((editor && *editor) ?
633
} else if (*display_option == '\0') {
637
StrAllocCopy(editor, display_option);
638
LYaddstr(display_option);
642
HTInfoMsg(CANCELLED);
645
_statusline(VALUE_ACCEPTED);
651
case 'D': /* Change the display. */
652
if (x_display && *x_display) {
653
LYstrncpy(display_option, x_display, sizeof(display_option) - 1);
654
} else { /* clear the NONE */
655
LYmove(L_DISPLAY, COL_OPTION_VALUES);
657
*display_option = '\0';
659
_statusline(ACCEPT_DATA);
660
LYmove(L_DISPLAY, COL_OPTION_VALUES);
662
ch = LYgetstr(display_option, VISIBLE,
663
sizeof(display_option), NORECALL);
665
LYmove(L_DISPLAY, COL_OPTION_VALUES);
668
#define CompareEnvVars(a,b) strcasecomp(a, b)
670
#define CompareEnvVars(a,b) strcmp(a, b)
673
if ((term_options || ch == -1) ||
674
(x_display != NULL &&
675
!CompareEnvVars(x_display, display_option))) {
677
* Cancelled, or a non-NULL display string
678
* wasn't changed. - FM
680
LYaddstr((x_display && *x_display) ? x_display : "NONE");
683
HTInfoMsg(CANCELLED);
686
_statusline(VALUE_ACCEPTED);
690
} else if (*display_option == '\0') {
691
if ((x_display == NULL) ||
692
(x_display != NULL && *x_display == '\0')) {
694
* NULL or zero-length display string
695
* wasn't changed. - FM
699
_statusline(VALUE_ACCEPTED);
705
* Set the new DISPLAY variable. - FM
707
LYsetXDisplay(display_option);
708
validate_x_display();
710
LYaddstr(x_display ? x_display : "NONE");
712
summarize_x_display(display_option);
716
case 'L': /* Change multibookmarks option. */
718
_statusline(MULTIBOOKMARKS_DISALLOWED);
722
if (!LYSelectPopups) {
723
LYMultiBookmarks = LYChooseBoolean(LYMultiBookmarks,
727
LYMultiBookmarks = LYChoosePopup(LYMultiBookmarks,
728
L_HOME, (C_MULTI - 1),
732
#if defined(VMS) || defined(USE_SLANG)
733
if (LYSelectPopups) {
734
LYmove(L_HOME, C_MULTI);
736
LYaddstr(mbm_choices[LYMultiBookmarks]);
738
#endif /* VMS || USE_SLANG */
739
#if !defined(VMS) && !defined(USE_SLANG)
741
#endif /* !VMS && !USE_SLANG */
743
LYmove(L_HOME, B_BOOK);
745
if (LYMultiBookmarks != MBM_OFF) {
746
LYaddstr(gettext("review/edit B)ookmarks files"));
748
LYaddstr(gettext("B)ookmark file: "));
749
LYaddstr((bookmark_page && *bookmark_page) ?
750
bookmark_page : "NONE");
754
if (LYSelectPopups) {
759
case 'B': /* Change the bookmark page location. */
761
* Anonymous users should not be allowed to
762
* change the bookmark page.
765
if (LYMultiBookmarks != MBM_OFF) {
767
signal(SIGINT, terminate_options);
770
if (bookmark_page && *bookmark_page) {
771
LYstrncpy(display_option, bookmark_page, sizeof(display_option) - 1);
772
} else { /* clear the NONE */
773
LYmove(L_HOME, C_DEFAULT);
775
*display_option = '\0';
777
_statusline(ACCEPT_DATA);
778
LYmove(L_HOME, C_DEFAULT);
780
ch = LYgetstr(display_option, VISIBLE,
781
sizeof(display_option), NORECALL);
783
LYmove(L_HOME, C_DEFAULT);
785
ch == -1 || *display_option == '\0') {
786
LYaddstr((bookmark_page && *bookmark_page) ?
787
bookmark_page : "NONE");
788
} else if (!LYPathOffHomeOK(display_option,
789
sizeof(display_option))) {
790
LYaddstr((bookmark_page && *bookmark_page) ?
791
bookmark_page : "NONE");
793
_statusline(USE_PATH_OFF_HOME);
797
StrAllocCopy(bookmark_page, display_option);
798
StrAllocCopy(MBM_A_subbookmark[0], bookmark_page);
799
LYaddstr(bookmark_page);
803
HTInfoMsg(CANCELLED);
806
_statusline(VALUE_ACCEPTED);
808
} else { /* anonymous */
809
_statusline(BOOKMARK_CHANGE_DISALLOWED);
814
case 'F': /* Change ftp directory sorting. */
815
if (!LYSelectPopups) {
816
HTfileSortMethod = LYChooseBoolean(HTfileSortMethod,
820
HTfileSortMethod = LYChoosePopup(HTfileSortMethod,
824
#if defined(VMS) || defined(USE_SLANG)
825
LYmove(L_FTPSTYPE, COL_OPTION_VALUES);
827
LYaddstr(fileSort_choices[HTfileSortMethod]);
828
#endif /* VMS || USE_SLANG */
831
if (LYSelectPopups) {
836
case 'P': /* Change personal mail address for From headers. */
837
if (personal_mail_address && *personal_mail_address) {
838
LYstrncpy(display_option, personal_mail_address, sizeof(display_option) - 1);
839
} else { /* clear the NONE */
840
LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
842
*display_option = '\0';
844
_statusline(ACCEPT_DATA);
845
LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
847
ch = LYgetstr(display_option, VISIBLE,
848
sizeof(display_option), NORECALL);
850
LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
851
if (term_options || ch == -1) {
852
LYaddstr((personal_mail_address &&
853
*personal_mail_address) ?
854
personal_mail_address : "NONE");
855
} else if (*display_option == '\0') {
856
FREE(personal_mail_address);
859
StrAllocCopy(personal_mail_address, display_option);
860
LYaddstr(display_option);
864
HTInfoMsg(CANCELLED);
867
_statusline(VALUE_ACCEPTED);
872
case 'S': /* Change case sensitivity for searches. */
873
case_sensitive = LYChooseBoolean(case_sensitive,
879
case '\001': /* Change assume_charset setting. */
880
if (use_assume_charset) {
882
CONST char ** assume_list;
883
assume_list = typecallocn(CONST char *,(LYNumCharsets + 1));
885
outofmem(__FILE__, "options");
887
for (i = 0; i < LYNumCharsets; i++) {
888
assume_list[i] = LYCharSet_UC[i].MIMEname;
890
curval = UCLYhndl_for_unspec;
891
if (curval == current_char_set && UCAssume_MIMEcharset) {
892
curval = UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
895
curval = LYRawMode ? current_char_set : 0;
896
if (!LYSelectPopups) {
897
#ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
898
UCLYhndl_for_unspec = assumed_doc_charset_map[
899
LYChooseBoolean(charset_subsets[curval].assumed_idx,
900
L_ASSUME_CHARSET, -1,
901
assumed_charset_choices)
905
UCLYhndl_for_unspec = LYChooseBoolean(curval,
906
L_ASSUME_CHARSET, -1,
910
#ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
911
UCLYhndl_for_unspec = assumed_doc_charset_map[
912
LYChoosePopup(charset_subsets[curval].assumed_idx,
913
L_ASSUME_CHARSET, -1,
914
assumed_charset_choices,
919
UCLYhndl_for_unspec = LYChoosePopup(curval,
920
L_ASSUME_CHARSET, -1,
924
#if defined(VMS) || defined(USE_SLANG)
925
LYmove(L_ASSUME_CHARSET, COL_OPTION_VALUES);
927
if (UCLYhndl_for_unspec >= 0)
928
LYaddstr(LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);
929
#endif /* VMS || USE_SLANG */
933
* Set the raw 8-bit or CJK mode defaults and
934
* character set if changed. - FM
936
if (CurrentAssumeCharSet != UCLYhndl_for_unspec ||
937
UCLYhndl_for_unspec != curval) {
938
if (UCLYhndl_for_unspec != CurrentAssumeCharSet) {
939
StrAllocCopy(UCAssume_MIMEcharset,
940
LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);
942
if (HTCJK != JAPANESE)
943
LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set);
944
HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
945
HTMLSetCharacterHandling(current_char_set);
946
CurrentAssumeCharSet = UCLYhndl_for_unspec;
947
CurrentRawMode = LYRawMode;
948
#if !defined(VMS) && !defined(USE_SLANG)
950
#endif /* !VMS && !USE_SLANG */
952
LYmove(L_Rawmode, COL_OPTION_VALUES);
959
if (LYSelectPopups) {
963
_statusline(NEED_ADVANCED_USER_MODE);
964
AddValueAccepted = FALSE;
968
case 'C': /* Change display charset setting. */
969
if (!LYSelectPopups) {
970
#ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
971
displayed_display_charset_idx = LYChooseBoolean(displayed_display_charset_idx,
973
display_charset_choices);
974
current_char_set = display_charset_map[displayed_display_charset_idx];
976
current_char_set = LYChooseBoolean(current_char_set,
981
#ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
982
displayed_display_charset_idx = LYChoosePopup(displayed_display_charset_idx,
984
display_charset_choices,
986
current_char_set = display_charset_map[displayed_display_charset_idx];
988
current_char_set = LYChoosePopup(current_char_set,
994
#if defined(VMS) || defined(USE_SLANG)
995
LYmove(L_Charset, COL_OPTION_VALUES);
997
LYaddstr(LYchar_set_names[current_char_set]);
998
#endif /* VMS || USE_SLANG */
1001
* Set the raw 8-bit or CJK mode defaults and
1002
* character set if changed. - FM
1004
if (CurrentCharSet != current_char_set) {
1005
LYUseDefaultRawMode = TRUE;
1006
HTMLUseCharacterSet(current_char_set);
1007
CurrentCharSet = current_char_set;
1008
CurrentRawMode = LYRawMode;
1009
#if !defined(VMS) && !defined(USE_SLANG)
1010
if (!LYSelectPopups)
1011
#endif /* !VMS && !USE_SLANG */
1013
LYmove(L_Rawmode, COL_OPTION_VALUES);
1015
ShowBool(LYRawMode);
1017
#ifdef CAN_SWITCH_DISPLAY_CHARSET
1018
/* Deduce whether the user wants autoswitch: */
1019
switch_display_charsets =
1020
(current_char_set == auto_display_charset
1021
|| current_char_set == auto_other_display_charset);
1025
if (LYSelectPopups) {
1030
case 'O': /* Change raw mode setting. */
1031
LYRawMode = LYChooseBoolean(LYRawMode, L_Rawmode, -1, bool_choices);
1033
* Set the LYUseDefaultRawMode value and character
1034
* handling if LYRawMode was changed. - FM
1036
if (CurrentRawMode != LYRawMode) {
1037
HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
1038
HTMLSetCharacterHandling(current_char_set);
1039
CurrentRawMode = LYRawMode;
1044
case 'G': /* Change language preference. */
1045
if (language && *language) {
1046
LYstrncpy(display_option, language, sizeof(display_option) - 1);
1047
} else { /* clear the NONE */
1048
LYmove(L_LANGUAGE, COL_OPTION_VALUES);
1050
*display_option = '\0';
1052
_statusline(ACCEPT_DATA);
1053
LYmove(L_LANGUAGE, COL_OPTION_VALUES);
1055
ch = LYgetstr(display_option, VISIBLE,
1056
sizeof(display_option), NORECALL);
1058
LYmove(L_LANGUAGE, COL_OPTION_VALUES);
1059
if (term_options || ch == -1) {
1060
LYaddstr((language && *language) ?
1062
} else if (*display_option == '\0') {
1066
StrAllocCopy(language, display_option);
1067
LYaddstr(display_option);
1071
HTInfoMsg(CANCELLED);
1074
_statusline(VALUE_ACCEPTED);
1079
case 'H': /* Change charset preference. */
1080
if (pref_charset && *pref_charset) {
1081
LYstrncpy(display_option, pref_charset, sizeof(display_option) - 1);
1082
} else { /* clear the NONE */
1083
LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
1085
*display_option = '\0';
1087
_statusline(ACCEPT_DATA);
1088
LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
1090
ch = LYgetstr(display_option, VISIBLE,
1091
sizeof(display_option), NORECALL);
1093
LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
1094
if (term_options || ch == -1) {
1095
LYaddstr((pref_charset && *pref_charset) ?
1096
pref_charset : "NONE");
1097
} else if (*display_option == '\0') {
1101
StrAllocCopy(pref_charset, display_option);
1102
LYaddstr(display_option);
1106
HTInfoMsg(CANCELLED);
1109
_statusline(VALUE_ACCEPTED);
1114
case 'V': /* Change VI keys setting. */
1115
vi_keys = LYChooseBoolean(vi_keys,
1126
case 'M': /* Change emacs keys setting. */
1127
emacs_keys = LYChooseBoolean(emacs_keys,
1128
L_Bool_A, C_EMACSKEYS,
1138
case 'W': /* Change show dotfiles setting. */
1140
_statusline(DOTFILE_ACCESS_DISABLED);
1142
show_dotfiles = LYChooseBoolean(show_dotfiles,
1150
case 'T': /* Change select popups setting. */
1151
LYSelectPopups = LYChooseBoolean(LYSelectPopups,
1158
#if defined(USE_SLANG) || defined(COLOR_CURSES)
1159
case '&': /* Change show color setting. */
1160
if (no_option_save) {
1161
#if defined(COLOR_CURSES)
1162
if (!has_colors()) {
1163
char * terminal = LYGetEnv("TERM");
1166
COLOR_TOGGLE_DISABLED_FOR_TERM,
1169
HTUserMsg(COLOR_TOGGLE_DISABLED);
1173
LYShowColor = LYChooseBoolean((LYShowColor - 1),
1177
if (LYShowColor == 0) {
1178
LYShowColor = SHOW_COLOR_OFF;
1180
LYShowColor = SHOW_COLOR_ON;
1182
} else { /* !no_option_save */
1183
BOOLEAN again = FALSE;
1186
* Copy strings into choice array.
1189
StrAllocCopy(choices[0], "NEVER ");
1191
StrAllocCopy(choices[1], "OFF ");
1193
StrAllocCopy(choices[2], "ON ");
1195
#if defined(COLOR_CURSES)
1197
StrAllocCopy(choices[3], "Always try");
1200
StrAllocCopy(choices[3], "ALWAYS ");
1203
if (!LYSelectPopups) {
1204
chosen = LYChooseBoolean(LYChosenShowColor,
1209
chosen = LYChoosePopup(LYChosenShowColor,
1212
choices, 4, FALSE, FALSE);
1214
#if defined(COLOR_CURSES)
1215
again = (BOOL) (chosen == SHOW_COLOR_ON && !has_colors());
1217
char * terminal = LYGetEnv("TERM");
1220
COLOR_TOGGLE_DISABLED_FOR_TERM,
1223
HTUserMsg(COLOR_TOGGLE_DISABLED);
1227
LYChosenShowColor = chosen;
1229
if (LYSelectPopups) {
1230
LYmove(L_Color, C_COLOR);
1232
LYaddstr(choices[LYChosenShowColor]);
1235
#if defined(COLOR_CURSES)
1238
LYShowColor = chosen;
1244
if (CurrentShowColor != LYShowColor) {
1245
lynx_force_repaint();
1247
CurrentShowColor = LYShowColor;
1249
SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
1252
if (LYSelectPopups && !no_option_save) {
1256
#endif /* USE_SLANG or COLOR_CURSES */
1258
case '@': /* Change show cursor setting. */
1259
LYShowCursor = LYChooseBoolean(LYShowCursor,
1266
case 'K': /* Change keypad mode. */
1267
if (!LYSelectPopups) {
1268
keypad_mode = LYChooseBoolean(keypad_mode,
1272
keypad_mode = LYChoosePopup(keypad_mode,
1276
#if defined(VMS) || defined(USE_SLANG)
1277
LYmove(L_Keypad, COL_OPTION_VALUES);
1279
LYaddstr(keypad_choices[keypad_mode]);
1280
#endif /* VMS || USE_SLANG */
1282
if (keypad_mode == NUMBERS_AS_ARROWS) {
1283
set_numbers_as_arrows();
1285
reset_numbers_as_arrows();
1288
if (LYSelectPopups) {
1293
case 'N': /* Change line editor key bindings. */
1294
if (!LYSelectPopups) {
1295
current_lineedit = LYChooseBoolean(current_lineedit,
1299
current_lineedit = LYChoosePopup(current_lineedit,
1303
#if defined(VMS) || defined(USE_SLANG)
1304
LYmove(L_Lineed, COL_OPTION_VALUES);
1306
LYaddstr(LYLineeditNames[current_lineedit]);
1307
#endif /* VMS || USE_SLANG */
1310
if (LYSelectPopups) {
1315
#ifdef EXP_KEYBOARD_LAYOUT
1316
case 'Y': /* Change keyboard layout */
1317
if (!LYSelectPopups) {
1318
current_layout = LYChooseBoolean(current_layout,
1322
current_layout = LYChoosePopup(current_layout,
1326
#if defined(VMS) || defined(USE_SLANG)
1327
LYmove(L_Layout, COL_OPTION_VALUES);
1329
LYaddstr(LYKbLayoutNames[current_layout]);
1330
#endif /* VMS || USE_SLANG */
1333
if (LYSelectPopups) {
1337
#endif /* EXP_KEYBOARD_LAYOUT */
1339
#ifdef DIRED_SUPPORT
1340
case 'I': /* Change local directory sorting. */
1341
if (!LYSelectPopups) {
1342
dir_list_style = LYChooseBoolean(dir_list_style,
1346
dir_list_style = LYChoosePopup(dir_list_style,
1350
#if defined(VMS) || defined(USE_SLANG)
1351
LYmove(L_Dired, COL_OPTION_VALUES);
1353
LYaddstr(dirList_choices[dir_list_style]);
1354
#endif /* VMS || USE_SLANG */
1357
if (LYSelectPopups) {
1361
#endif /* DIRED_SUPPORT */
1363
case 'U': /* Change user mode. */
1364
if (!LYSelectPopups) {
1365
user_mode = LYChooseBoolean(user_mode,
1368
use_assume_charset = (BOOL) (user_mode >= 2);
1370
user_mode = LYChoosePopup(user_mode,
1374
use_assume_charset = (BOOL) (user_mode >= 2);
1375
#if defined(VMS) || defined(USE_SLANG)
1376
if (use_assume_charset == old_use_assume_charset) {
1377
LYmove(L_User_Mode, COL_OPTION_VALUES);
1379
LYaddstr(userMode_choices[user_mode]);
1381
#endif /* VMS || USE_SLANG */
1383
if (user_mode == NOVICE_MODE) {
1384
display_lines = (LYlines - 4);
1386
display_lines = LYlines-2;
1389
if (LYSelectPopups) {
1395
if (!LYSelectPopups) {
1396
verbose_img = LYChooseBoolean(verbose_img,
1401
verbose_img = LYChoosePopup(verbose_img,
1408
if (LYSelectPopups) {
1413
case 'A': /* Change user agent string. */
1414
if (!no_useragent) {
1415
if (LYUserAgent && *LYUserAgent) {
1416
LYstrncpy(display_option, LYUserAgent, sizeof(display_option) - 1);
1417
} else { /* clear the NONE */
1418
LYmove(L_HOME, COL_OPTION_VALUES);
1420
*display_option = '\0';
1422
_statusline(ACCEPT_DATA_OR_DEFAULT);
1423
LYmove(L_User_Agent, COL_OPTION_VALUES);
1425
ch = LYgetstr(display_option, VISIBLE,
1426
sizeof(display_option), NORECALL);
1428
LYmove(L_User_Agent, COL_OPTION_VALUES);
1429
if (term_options || ch == -1) {
1430
LYaddstr((LYUserAgent &&
1432
LYUserAgent : "NONE");
1433
} else if (*display_option == '\0') {
1434
StrAllocCopy(LYUserAgent, LYUserAgentDefault);
1435
LYaddstr((LYUserAgent &&
1437
LYUserAgent : "NONE");
1439
StrAllocCopy(LYUserAgent, display_option);
1440
LYaddstr(display_option);
1444
HTInfoMsg(CANCELLED);
1446
} else if (!LYCheckUserAgent()) {
1447
_statusline(UA_PLEASE_USE_LYNX);
1449
_statusline(VALUE_ACCEPTED);
1451
} else { /* disallowed */
1452
_statusline(UA_CHANGE_DISABLED);
1457
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
1458
case 'X': /* Change local exec restriction. */
1459
if (exec_frozen && !LYSelectPopups) {
1460
_statusline(CHANGE_OF_SETTING_DISALLOWED);
1464
#ifndef NEVER_ALLOW_REMOTE_EXEC
1468
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
1470
if (local_exec_on_local_files) {
1476
if (!LYSelectPopups) {
1477
itmp = LYChooseBoolean(itmp,
1481
itmp = LYChoosePopup(itmp,
1484
0, (exec_frozen ? TRUE : FALSE),
1486
#if defined(VMS) || defined(USE_SLANG)
1487
LYmove(L_Exec, COL_OPTION_VALUES);
1489
LYaddstr(exec_choices[itmp]);
1490
#endif /* VMS || USE_SLANG */
1496
local_exec_on_local_files = FALSE;
1500
local_exec_on_local_files = TRUE;
1502
#ifndef NEVER_ALLOW_REMOTE_EXEC
1505
local_exec_on_local_files = FALSE;
1507
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
1511
if (LYSelectPopups) {
1515
#endif /* ENABLE_OPTS_CHANGE_EXEC */
1517
case '>': /* Save current options to RC file. */
1518
if (!no_option_save) {
1519
HTInfoMsg(SAVING_OPTIONS);
1520
LYrcShowColor = LYChosenShowColor;
1521
if (save_rc(NULL)) {
1522
HTInfoMsg(OPTIONS_SAVED);
1524
HTAlert(OPTIONS_NOT_SAVED);
1527
HTInfoMsg(R_TO_RETURN_TO_LYNX);
1529
* Change response so that we don't exit
1536
case 'R': /* Return to document (quit options menu). */
1540
if (!no_option_save) {
1541
HTInfoMsg(SAVE_OR_R_TO_RETURN_TO_LYNX);
1543
HTInfoMsg(R_TO_RETURN_TO_LYNX);
1548
term_options = FALSE;
1549
LYStatusLine = -1; /* let user_mode have some of the screen */
1550
signal(SIGINT, cleanup_sig);
1553
PRIVATE int widest_choice ARGS1(
1554
CONST char **, choices)
1557
for (n = 0; choices[n] != NULL; ++n) {
1558
int len = strlen(choices[n]);
1565
PRIVATE void show_choice ARGS2(
1566
CONST char *, choice,
1569
int len = strlen(choice);
1571
while (len++ < width)
1576
* Take a status code, prompt the user for a new status, and return it.
1578
PRIVATE int boolean_choice ARGS4(
1582
CONST char **, choices)
1587
int col = (column >= 0 ? column : COL_OPTION_VALUES);
1588
int orig_choice = cur_choice;
1589
int width = widest_choice(choices);
1592
* Get the number of choices and then make
1593
* number zero-based.
1595
for (number = 0; choices[number] != NULL; number++)
1596
; /* empty loop body */
1600
* Update the statusline.
1602
_statusline(ANY_KEY_CHANGE_RET_ACCEPT);
1605
* Highlight the current choice.
1608
lynx_start_reverse();
1609
show_choice(choices[cur_choice], width);
1611
LYmove(line, (col - 1));
1615
* Get the keyboard entry, and leave the
1616
* cursor at the choice, to indicate that
1617
* it can be changed, until the user accepts
1618
* the current choice.
1620
term_options = FALSE;
1623
if (term_options == FALSE) {
1624
response = LYgetch_single();
1626
if (term_options || LYCharIsINTERRUPT_NO_letter(response)) {
1628
* Control-C or Control-G.
1631
term_options = TRUE;
1632
cur_choice = orig_choice;
1635
if (HadVMSInterrupt) {
1636
HadVMSInterrupt = FALSE;
1638
term_options = TRUE;
1639
cur_choice = orig_choice;
1642
if ((response != '\n' && response != '\r') &&
1643
(cmd = LKC_TO_LAC(keymap,response)) != LYK_ACTIVATE) {
1650
cur_choice = number;
1654
lynx_force_repaint();
1661
cur_choice = orig_choice;
1662
term_options = TRUE;
1669
case LYK_LPOS_PREV_LINK:
1670
case LYK_FASTBACKW_LINK:
1673
if (cur_choice == 0)
1674
cur_choice = number; /* go back to end */
1688
if((cmd - LYK_1 + 1) <= number) {
1689
cur_choice = cmd -LYK_1 + 1;
1691
} /* else fall through! */
1693
if (cur_choice == number)
1694
cur_choice = 0; /* go over the top and around */
1697
} /* end of switch */
1698
show_choice(choices[cur_choice], width);
1700
LYmove(line, (col - 1));
1704
* Unhighlight choice.
1707
lynx_stop_reverse();
1708
show_choice(choices[cur_choice], width);
1711
term_options = FALSE;
1712
HTInfoMsg(CANCELLED);
1715
_statusline(VALUE_ACCEPTED);
1721
#endif /* !NO_OPTION_MENU */
1723
PRIVATE void terminate_options ARGS1(
1724
int, sig GCC_UNUSED)
1726
term_options = TRUE;
1730
signal(SIGINT, terminate_options);
1733
* Refresh the screen to get rid of the "interrupt" message.
1735
if (!dump_output_immediately) {
1736
lynx_force_repaint();
1743
* Multi-Bookmark On-Line editing support. - FMG & FM
1745
PUBLIC void edit_bookmarks NOARGS
1747
int response = 0, def_response = 0, ch;
1748
int MBM_current = 1;
1749
#define MULTI_OFFSET 8
1750
int a; /* misc counter */
1751
char MBM_tmp_line[256]; /* buffer for LYgetstr */
1752
char ehead_buffer[265];
1755
* We need (MBM_V_MAXFILES + MULTI_OFFSET) lines to display
1756
* the whole list at once. Otherwise break it up into two
1757
* segments. We know it won't be less than that because
1758
* 'o'ptions needs 23-24 at LEAST.
1760
term_options = FALSE;
1761
signal(SIGINT, terminate_options);
1765
* Display menu of bookmarks. NOTE that we avoid printw()'s
1766
* to increase the chances that any non-ASCII or multibyte/CJK
1767
* characters will be handled properly. - FM
1769
#if defined(FANCY_CURSES) || defined (USE_SLANG)
1770
if (enable_scrollback) {
1777
#endif /* FANCY_CURSES || USE_SLANG */
1779
lynx_start_h1_color ();
1780
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
1781
sprintf(ehead_buffer, MULTIBOOKMARKS_EHEAD_MASK, MBM_current);
1782
LYaddstr(ehead_buffer);
1784
LYaddstr(MULTIBOOKMARKS_EHEAD);
1786
lynx_stop_h1_color ();
1788
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
1789
for (a = ((MBM_V_MAXFILES/2 + 1) * (MBM_current - 1));
1790
a <= (MBM_current * MBM_V_MAXFILES/2 ); a++) {
1791
LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 5);
1792
LYaddch(UCH(LYindex2MBM(a)));
1794
if (MBM_A_subdescript[a])
1795
LYaddstr(MBM_A_subdescript[a]);
1796
LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 35);
1798
if (MBM_A_subbookmark[a]) {
1799
LYaddstr(MBM_A_subbookmark[a]);
1803
for (a = 0; a <= MBM_V_MAXFILES; a++) {
1805
LYaddch(UCH(LYindex2MBM(a)));
1807
if (MBM_A_subdescript[a])
1808
LYaddstr(MBM_A_subdescript[a]);
1811
if (MBM_A_subbookmark[a]) {
1812
LYaddstr(MBM_A_subbookmark[a]);
1818
* Only needed when we have 2 screens.
1820
if (LYlines < MBM_V_MAXFILES + MULTI_OFFSET) {
1821
LYmove((LYlines - 4), 0);
1833
LYaddstr(NEXT_SCREEN);
1836
LYmove((LYlines - 3), 0);
1837
if (!no_option_save) {
1843
LYaddstr(TO_SAVE_SEGMENT);
1845
LYaddstr(OR_SEGMENT);
1851
LYaddstr(TO_RETURN_SEGMENT);
1853
while (!term_options &&
1854
!LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
1855
!LYCharIsINTERRUPT_NO_letter(response) && response != '>') {
1857
LYmove((LYlines - 2), 0);
1858
lynx_start_prompt_color ();
1859
LYaddstr(MULTIBOOKMARKS_LETTER);
1860
lynx_stop_prompt_color ();
1863
response = (def_response ? def_response : LYgetch_single());
1867
* Check for a cancel.
1869
if (term_options || LYCharIsINTERRUPT_NO_letter(response) ||
1870
LYisNonAlnumKeyname(response, LYK_PREV_DOC))
1876
if (response == '>') {
1877
if (!no_option_save) {
1878
HTInfoMsg(SAVING_OPTIONS);
1880
HTInfoMsg(OPTIONS_SAVED);
1882
HTAlert(OPTIONS_NOT_SAVED);
1884
HTInfoMsg(R_TO_RETURN_TO_LYNX);
1886
* Change response so that we don't exit
1895
* Check for a refresh.
1897
if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
1898
lynx_force_repaint();
1903
* Move between the screens - if we can't show it all at once.
1905
if ((response == ']' ||
1906
LYisNonAlnumKeyname(response, LYK_NEXT_PAGE)) &&
1907
LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
1909
if (MBM_current >= 3)
1911
goto draw_bookmark_list;
1913
if ((response == '[' ||
1914
LYisNonAlnumKeyname(response, LYK_PREV_PAGE)) &&
1915
LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
1917
if (MBM_current <= 0)
1919
goto draw_bookmark_list;
1923
* Instead of using 26 case statements, we set up
1924
* a scan through the letters and edit the lines
1927
for (a = 0; a <= MBM_V_MAXFILES; a++) {
1928
if (LYMBM2index(response) == a) {
1929
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
1930
if (MBM_current == 1 && a > (MBM_V_MAXFILES/2)) {
1932
def_response = response;
1933
goto draw_bookmark_list;
1935
if (MBM_current == 2 && a < (MBM_V_MAXFILES/2)) {
1937
def_response = response;
1938
goto draw_bookmark_list;
1941
_statusline(ACCEPT_DATA);
1945
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
1947
(3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
1951
LYstrncpy(MBM_tmp_line,
1952
(!MBM_A_subdescript[a] ?
1953
"" : MBM_A_subdescript[a]),
1954
sizeof(MBM_tmp_line) - 1);
1955
ch = LYgetstr(MBM_tmp_line, VISIBLE,
1956
sizeof(MBM_tmp_line), NORECALL);
1959
if (strlen(MBM_tmp_line) < 1) {
1960
FREE(MBM_A_subdescript[a]);
1962
StrAllocCopy(MBM_A_subdescript[a], MBM_tmp_line);
1964
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
1966
(3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
1970
LYaddch(UCH(LYindex2MBM(a)));
1972
if (MBM_A_subdescript[a])
1973
LYaddstr(MBM_A_subdescript[a]);
1978
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
1979
LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
1982
LYmove((3 + a), 35);
1986
LYstrncpy(MBM_tmp_line,
1987
NonNull(MBM_A_subbookmark[a]),
1988
sizeof(MBM_tmp_line) - 1);
1989
ch = LYgetstr(MBM_tmp_line, VISIBLE,
1990
sizeof(MBM_tmp_line), NORECALL);
1993
if (*MBM_tmp_line == '\0') {
1995
StrAllocCopy(MBM_A_subbookmark[a], bookmark_page);
1997
FREE(MBM_A_subbookmark[a]);
1998
} else if (!LYPathOffHomeOK(MBM_tmp_line,
1999
sizeof(MBM_tmp_line))) {
2000
LYMBM_statusline(USE_PATH_OFF_HOME);
2003
StrAllocCopy(MBM_A_subbookmark[a], MBM_tmp_line);
2005
StrAllocCopy(bookmark_page, MBM_A_subbookmark[a]);
2008
if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
2009
LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current-1)),
2012
LYmove((3 + a), 35);
2014
if (MBM_A_subbookmark[a])
2015
LYaddstr(MBM_A_subbookmark[a]);
2017
LYmove(LYlines-1, 0);
2024
term_options = FALSE;
2025
signal(SIGINT, cleanup_sig);
2028
#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES)))
2031
* This function offers the choices for values of an
2032
* option via a popup window which functions like
2033
* that for selection of options in a form. - FM
2035
* Also used for mouse popups with ncurses; this is indicated
2038
PUBLIC int popup_choice ARGS7(
2042
CONST char **, choices,
2048
column = (COL_OPTION_VALUES - 1);
2050
term_options = FALSE;
2051
cur_choice = LYhandlePopupList(cur_choice,
2054
(CONST char **)choices,
2060
switch (cur_choice) {
2064
term_options = TRUE;
2066
HTUserMsg(CANCELLED);
2071
if (disabled || term_options) {
2073
} else if (!for_mouse) {
2074
_statusline(VALUE_ACCEPTED);
2079
#endif /* !NO_OPTION_MENU */
2080
#ifndef NO_OPTION_FORMS
2083
* I'm paranoid about mistyping strings. Also, this way they get combined
2084
* so we don't have to worry about the intelligence of the compiler.
2085
* We don't need to burn memory like it's cheap. We're better than that.
2087
#define SELECTED(flag) (flag) ? selected_string : ""
2088
#define DISABLED(flag) (flag) ? disabled_string : ""
2092
CONST char *LongName;
2093
CONST char *HtmlName;
2101
static CONST char selected_string[] = "selected";
2102
static CONST char disabled_string[] = "disabled";
2103
static CONST char on_string[] = N_("ON");
2104
static CONST char off_string[] = N_("OFF");
2105
static CONST char never_string[] = N_("NEVER");
2106
static CONST char always_string[] = N_("ALWAYS");
2107
static OptValues bool_values[] = {
2108
{ FALSE, N_("OFF"), "OFF" },
2109
{ TRUE, N_("ON"), "ON" },
2112
static char * secure_string = "secure";
2113
static char * secure_value = NULL;
2114
static char * save_options_string = "save_options";
2117
* Personal Preferences
2119
static char * cookies_string = RC_SET_COOKIES;
2120
static char * cookies_ignore_all_string = N_("ignore");
2121
static char * cookies_up_to_user_string = N_("ask user");
2122
static char * cookies_accept_all_string = N_("accept all");
2123
static char * x_display_string = RC_DISPLAY;
2124
static char * editor_string = RC_FILE_EDITOR;
2125
static char * emacs_keys_string = RC_EMACS_KEYS;
2127
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
2128
#define EXEC_ALWAYS 2
2129
#define EXEC_LOCAL 1
2130
#define EXEC_NEVER 0
2131
static char * exec_links_string = RC_RUN_ALL_EXECUTION_LINKS;
2132
static OptValues exec_links_values[] = {
2133
{ EXEC_NEVER, N_("ALWAYS OFF"), "ALWAYS OFF" },
2134
{ EXEC_LOCAL, N_("FOR LOCAL FILES ONLY"), "FOR LOCAL FILES ONLY" },
2135
#ifndef NEVER_ALLOW_REMOTE_EXEC
2136
{ EXEC_ALWAYS, N_("ALWAYS ON"), "ALWAYS ON" },
2139
#endif /* ENABLE_OPTS_CHANGE_EXEC */
2141
#ifdef EXP_KEYBOARD_LAYOUT
2142
static char * kblayout_string = RC_KBLAYOUT;
2144
static char * keypad_mode_string = RC_KEYPAD_MODE;
2145
static OptValues keypad_mode_values[] = {
2146
{ NUMBERS_AS_ARROWS, N_("Numbers act as arrows"),
2148
{ LINKS_ARE_NUMBERED, N_("Links are numbered"),
2150
{ LINKS_AND_FIELDS_ARE_NUMBERED,
2151
N_("Links and form fields are numbered"),
2152
"links_and_forms" },
2153
{ FIELDS_ARE_NUMBERED,
2154
N_("Form fields are numbered"),
2157
static char * lineedit_mode_string = RC_LINEEDIT_MODE;
2158
static char * mail_address_string = RC_PERSONAL_MAIL_ADDRESS;
2159
static char * search_type_string = RC_CASE_SENSITIVE_SEARCHING;
2160
static OptValues search_type_values[] = {
2161
{ FALSE, N_("Case insensitive"), "case_insensitive" },
2162
{ TRUE, N_("Case sensitive"), "case_sensitive" },
2165
#if defined(USE_SLANG) || defined(COLOR_CURSES)
2166
static char * show_color_string = RC_SHOW_COLOR;
2167
static OptValues show_color_values[] = {
2168
{ SHOW_COLOR_NEVER, never_string, never_string },
2169
{ SHOW_COLOR_OFF, off_string, off_string },
2170
{ SHOW_COLOR_ON, on_string, on_string },
2171
{ SHOW_COLOR_ALWAYS, always_string, always_string },
2175
static char * show_cursor_string = RC_SHOW_CURSOR;
2177
static char * underline_links_string = RC_UNDERLINE_LINKS;
2179
#ifdef USE_SCROLLBAR
2180
static char * show_scrollbar_string = RC_SCROLLBAR;
2183
static CONST char prompt_dft_string[] = N_("prompt normally");
2184
static CONST char prompt_yes_string[] = N_("force yes-response");
2185
static CONST char prompt_no_string[] = N_("force no-response");
2186
static OptValues prompt_values[] = {
2187
{ FORCE_PROMPT_DFT, prompt_dft_string, prompt_dft_string },
2188
{ FORCE_PROMPT_YES, prompt_yes_string, prompt_yes_string },
2189
{ FORCE_PROMPT_NO, prompt_no_string, prompt_no_string },
2192
static char * cookie_prompt_string = RC_FORCE_COOKIE_PROMPT;
2195
static char * ssl_prompt_string = RC_FORCE_SSL_PROMPT;
2198
static char * user_mode_string = RC_USER_MODE;
2199
static OptValues user_mode_values[] = {
2200
{ NOVICE_MODE, N_("Novice"), "Novice" },
2201
{ INTERMEDIATE_MODE, N_("Intermediate"), "Intermediate" },
2202
{ ADVANCED_MODE, N_("Advanced"), "Advanced" },
2205
static char * vi_keys_string = RC_VI_KEYS;
2207
static char * visited_links_string = RC_VISITED_LINKS;
2208
static OptValues visited_links_values[] = {
2209
{ VISITED_LINKS_AS_FIRST_V, N_("By First Visit"), "first_visited" },
2210
{ VISITED_LINKS_AS_FIRST_V | VISITED_LINKS_REVERSE,
2211
N_("By First Visit Reversed"), "first_visited_reversed" },
2212
{ VISITED_LINKS_AS_TREE, N_("As Visit Tree"), "visit_tree" },
2213
{ VISITED_LINKS_AS_LATEST, N_("By Last Visit"), "last_visited" },
2214
{ VISITED_LINKS_AS_LATEST | VISITED_LINKS_REVERSE,
2215
N_("By Last Visit Reversed"), "last_visited_reversed" },
2221
static char * DTD_recovery_string = RC_TAGSOUP;
2222
static OptValues DTD_type_values[] = {
2223
/* Old_DTD variable */
2224
{ TRUE, N_("relaxed (TagSoup mode)"), "tagsoup" },
2225
{ FALSE, N_("strict (SortaSGML mode)"), "sortasgml" },
2228
static char * select_popups_string = RC_SELECT_POPUPS;
2229
static char * images_string = "images";
2230
static char * images_ignore_all_string = N_("ignore");
2231
static char * images_use_label_string = N_("as labels");
2232
static char * images_use_links_string = N_("as links");
2234
static char * verbose_images_string = RC_VERBOSE_IMAGES;
2235
static OptValues verbose_images_type_values[] = {
2236
/* verbose_img variable */
2237
{ FALSE, N_("OFF"), "OFF" },
2238
{ TRUE, N_("show filename"), "ON" },
2244
static char * mbm_string = RC_MULTI_BOOKMARK;
2245
static OptValues mbm_values[] = {
2246
{ MBM_OFF, N_("OFF"), "OFF" },
2247
{ MBM_STANDARD, N_("STANDARD"), "STANDARD" },
2248
{ MBM_ADVANCED, N_("ADVANCED"), "ADVANCED" },
2251
static char * single_bookmark_string = RC_BOOKMARK_FILE;
2254
* Character Set Options
2256
static char * assume_char_set_string = RC_ASSUME_CHARSET;
2257
static char * display_char_set_string = RC_CHARACTER_SET;
2258
static char * raw_mode_string = RC_RAW_MODE;
2260
#ifdef EXP_LOCALE_CHARSET
2261
static char * locale_charset_string = RC_LOCALE_CHARSET;
2265
* File Management Options
2267
static char * show_dotfiles_string = RC_SHOW_DOTFILES;
2269
#ifdef DIRED_SUPPORT
2270
static char * dired_list_string = RC_DIR_LIST_STYLE;
2271
static OptValues dired_list_values[] = {
2272
{ DIRS_FIRST, N_("Directories first"), "dired_dir" },
2273
{ FILES_FIRST, N_("Files first"), "dired_files" },
2274
{ MIXED_STYLE, N_("Mixed style"), "dired_mixed" },
2277
static char * dired_sort_string = RC_DIR_LIST_ORDER;
2278
static OptValues dired_sort_values[] = {
2279
{ ORDER_BY_NAME, N_("By Name"), "dired_by_name" },
2280
{ ORDER_BY_TYPE, N_("By Type"), "dired_by_type" },
2281
{ ORDER_BY_SIZE, N_("By Size"), "dired_by_size" },
2282
{ ORDER_BY_DATE, N_("By Date"), "dired_by_date" },
2283
{ ORDER_BY_MODE, N_("By Mode"), "dired_by_mode" },
2285
{ ORDER_BY_USER, N_("By User"), "dired_by_user" },
2286
{ ORDER_BY_GROUP, N_("By Group"), "dired_by_group" },
2289
#endif /* LONG_LIST */
2290
#endif /* DIRED_SUPPORT */
2292
static char * ftp_sort_string = RC_FILE_SORTING_METHOD;
2293
static OptValues ftp_sort_values[] = {
2294
{ FILE_BY_NAME, N_("By Name"), "ftp_by_name" },
2295
{ FILE_BY_TYPE, N_("By Type"), "ftp_by_type" },
2296
{ FILE_BY_SIZE, N_("By Size"), "ftp_by_size" },
2297
{ FILE_BY_DATE, N_("By Date"), "ftp_by_date" },
2300
#ifdef USE_READPROGRESS
2301
static char * show_rate_string = RC_SHOW_KB_RATE;
2302
static OptValues rate_values[] = {
2303
{ rateOFF, N_("Do not show rate"), "rate_off" },
2304
{ rateBYTES, N_("Show %s/sec rate"), "rate_bytes" },
2305
{ rateKB, N_("Show %s/sec rate"), "rate_kb" },
2306
#ifdef USE_READPROGRESS
2307
{ rateEtaBYTES, N_("Show %s/sec, ETA"), "rate_eta_bytes" },
2308
{ rateEtaKB, N_("Show %s/sec, ETA"), "rate_eta_kb" },
2311
#endif /* USE_READPROGRESS */
2314
* Headers transferred to remote server
2316
static char * preferred_doc_char_string = RC_PREFERRED_CHARSET;
2317
static char * preferred_doc_lang_string = RC_PREFERRED_LANGUAGE;
2318
static char * user_agent_string = RC_USERAGENT;
2320
#define PutTextInput(fp, Name, Value, Size, disable) \
2322
"<input size=%d type=\"text\" name=\"%s\" value=\"%s\" %s>\n",\
2323
(int) Size, Name, Value, disable_all?disabled_string:disable)
2325
#define PutOption(fp, flag, html, name) \
2326
fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), gettext(name))
2328
#define BeginSelect(fp, text) \
2329
fprintf(fp,"<select name=\"%s\" %s>\n", text, disable_all?disabled_string:"")
2331
#define MaybeSelect(fp, flag, text) \
2332
fprintf(fp,"<select name=\"%s\" %s>\n", text, disable_all?disabled_string:DISABLED(flag))
2334
#define EndSelect(fp)\
2335
fprintf(fp,"</select>\n")
2337
PRIVATE void PutOptValues ARGS3(
2342
while (table->LongName != 0) {
2343
if (table->HtmlName) {
2345
value == table->value,
2353
PRIVATE BOOLEAN GetOptValues ARGS3(
2358
while (table->LongName != 0) {
2359
if (table->HtmlName && !strcmp(value, table->HtmlName)) {
2360
*result = table->value;
2369
* Break cgi line into array of pairs of pointers. Don't bother trying to
2370
* be efficient. We're not called all that often.
2371
* We come in with a string looking like:
2372
* tag1=value1&tag2=value2&...&tagN=valueN
2373
* We leave with an array of post_pairs. The last element in the array
2374
* will have a tag pointing to NULL.
2375
* Not pretty, but works. Hey, if strings can be null terminate arrays...
2378
PRIVATE PostPair * break_data ARGS1(
2382
PostPair * q = NULL;
2389
CTRACE((tfp, "break_data %s\n", p));
2391
q = typecalloc(PostPair);
2393
outofmem(__FILE__, "break_data(calloc)");
2397
* First, break up on '&', sliding 'p' on down the line.
2399
q[count].value = LYstrsep(&p, "&");
2401
* Then break up on '=', sliding value down, and setting tag.
2403
q[count].tag = LYstrsep(&(q[count].value), "=");
2406
* Clean them up a bit, in case user entered a funky string.
2408
HTUnEscape(q[count].tag);
2410
/* In the value field we have '+' instead of ' '. So do a simple
2411
* find&replace on the value field before UnEscaping() - SKY
2415
len = strlen(q[count].value);
2416
for (i = 0; i < len; i++) {
2417
if (q[count].value[i] == '+') {
2420
* Allow for special case of options which begin with a "+" on
2424
&& q[count].value[i+1] == '+'
2425
&& isalnum(UCH(q[count].value[i+2]))) {
2426
q[count].value[i++] = ' ';
2431
q[count].value[i] = ' ';
2435
HTUnEscape(q[count].value);
2436
CTRACE((tfp, "...item[%d] tag=%s, value=%s\n", count, q[count].tag, q[count].value));
2440
* Like I said, screw efficiency. Sides, realloc is fast on
2443
q = realloc(q, sizeof(PostPair)*(count+1));
2445
outofmem(__FILE__, "break_data(realloc)");
2446
q[count].tag = NULL;
2447
} while (p != NULL && p[0] != '\0');
2451
PRIVATE int gen_options PARAMS((char **newfile));
2454
* Handle options from the pseudo-post. I think we really only need
2455
* post_data here, but bring along everything just in case. It's only a
2458
* Options are processed in order according to gen_options(), we should not
2459
* depend on it and add boolean flags where the order is essential (save,
2460
* character sets...)
2462
* Security: some options are disabled in gen_options() under certain
2463
* conditions. We *should* duplicate the same conditions here in postoptions()
2464
* to prevent user with a limited access from editing HTML options code
2465
* manually (e.g., doing 'e'dit in 'o'ptions) and submit it to access the
2466
* restricted items. Prevent spoofing attempts from index overrun. - LP
2468
* Exit status: NULLFILE (reload) or NORMAL (use HText cache).
2470
* On exit, got the document which was current before the Options menu:
2472
* (from cache) nothing changed or no visual effect supposed:
2473
* editor name, e-mail, etc.
2475
* (reload locally) to see the effect of certain changes:
2476
* display_char_set, assume_charset, etc.
2477
* (use 'need_reload' flag where necessary).
2479
* (reload from remote server and uncache on a proxy)
2480
* few options changes should be transferred to remote server:
2481
* preferred language, fake browser name, etc.
2482
* (use 'need_end_reload' flag).
2485
PUBLIC int postoptions ARGS1(
2489
DocAddress WWWDoc; /* need on exit */
2492
BOOLEAN save_all = FALSE;
2493
int display_char_set_old = current_char_set;
2494
BOOLEAN raw_mode_old = LYRawMode;
2495
BOOLEAN assume_char_set_changed = FALSE;
2496
BOOLEAN need_reload = FALSE;
2497
BOOLEAN need_end_reload = FALSE;
2498
#if defined(USE_SLANG) || defined(COLOR_CURSES)
2499
int CurrentShowColor = LYShowColor;
2502
/*-------------------------------------------------
2503
* kludge a link from mbm_menu, the URL was:
2504
* "<a href=\"LYNXOPTIONS://MBM_MENU\">Goto multi-bookmark menu</a>\n"
2505
*--------------------------------------------------*/
2507
if (strstr(newdoc->address, "LYNXOPTIONS://MBM_MENU")) {
2508
FREE(newdoc->post_data);
2510
HTAlert(BOOKMARK_CHANGE_DISALLOWED); /* anonymous */
2512
} else if (dump_output_immediately) {
2520
data = break_data(newdoc->post_data);
2525
/*-------------------------------------------------
2526
* kludge gen_options() call:
2527
*--------------------------------------------------*/
2528
status = gen_options(&newdoc->address);
2529
if (status != NORMAL) {
2530
HTAlwaysAlert("Unexpected way of accessing", newdoc->address);
2531
FREE(newdoc->address);
2535
/* exit to getfile() cycle */
2536
WWWDoc.address = newdoc->address;
2537
WWWDoc.post_data = newdoc->post_data;
2538
WWWDoc.post_content_type = newdoc->post_content_type;
2539
WWWDoc.bookmark = newdoc->bookmark;
2540
WWWDoc.isHEAD = newdoc->isHEAD;
2541
WWWDoc.safe = newdoc->safe;
2543
if (!HTLoadAbsolute(&WWWDoc))
2545
LYRegisterUIPage(newdoc->address, UIP_OPTIONS_MENU);
2546
#ifdef DIRED_SUPPORT
2547
lynx_edit_mode = FALSE;
2548
#endif /* DIRED_SUPPORT */
2552
if (!LYIsUIPage3(HTLoadedDocumentURL(), UIP_OPTIONS_MENU, 0) &&
2553
!LYIsUIPage3(HTLoadedDocumentURL(), UIP_VLINKS, 0)) {
2556
/* We may have been spoofed? */
2558
gettext("Use %s to invoke the Options menu!"),
2559
key_for_func_ext(LYK_OPTIONS, FOR_PANEL));
2566
for (i = 0; data[i].tag != NULL; i++) {
2568
* This isn't really for security, but rather for avoiding that
2569
* the user may revisit an older instance from the history stack
2570
* and submit stuff which accidentally undoes changes that had
2571
* been done from a newer instance. - kw
2573
if (!strcmp(data[i].tag, secure_string)) {
2574
if (!secure_value || strcmp(data[i].value, secure_value)) {
2578
* We probably came from an older instance of the Options
2579
* page that had been on the history stack. - kw
2582
gettext("Use %s to invoke the Options menu!"),
2583
key_for_func_ext(LYK_OPTIONS, FOR_PANEL));
2592
if (!strcmp(data[i].tag, save_options_string) && (!no_option_save)) {
2596
/* Cookies: SELECT */
2597
if (!strcmp(data[i].tag, cookies_string)) {
2598
if (!strcmp(data[i].value, cookies_ignore_all_string)) {
2599
LYSetCookies = FALSE;
2600
} else if (!strcmp(data[i].value, cookies_up_to_user_string)) {
2601
LYSetCookies = TRUE;
2602
LYAcceptAllCookies = FALSE;
2603
} else if (!strcmp(data[i].value, cookies_accept_all_string)) {
2604
LYSetCookies = TRUE;
2605
LYAcceptAllCookies = TRUE;
2609
/* X Display: INPUT */
2610
if (!strcmp(data[i].tag, x_display_string)) {
2611
LYsetXDisplay(data[i].value);
2612
validate_x_display();
2613
summarize_x_display(data[i].value);
2617
if (!strcmp(data[i].tag, editor_string)) {
2619
StrAllocCopy(editor, data[i].value);
2622
/* Emacs keys: ON/OFF */
2623
if (!strcmp(data[i].tag, emacs_keys_string)
2624
&& GetOptValues(bool_values, data[i].value, &code)) {
2625
if ((emacs_keys = (BOOL) code) != FALSE) {
2632
/* Execution links: SELECT */
2633
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
2634
if (!strcmp(data[i].tag, exec_links_string)
2635
&& GetOptValues(exec_links_values, data[i].value, &code)) {
2636
#ifndef NEVER_ALLOW_REMOTE_EXEC
2637
local_exec = (code == EXEC_ALWAYS);
2638
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
2639
local_exec_on_local_files = (code == EXEC_LOCAL);
2641
#endif /* ENABLE_OPTS_CHANGE_EXEC */
2643
/* Keypad Mode: SELECT */
2644
if (!strcmp(data[i].tag, keypad_mode_string)) {
2646
if (GetOptValues(keypad_mode_values, data[i].value, &newval)
2647
&& keypad_mode != newval) {
2648
keypad_mode = newval;
2650
if (keypad_mode == NUMBERS_AS_ARROWS) {
2651
set_numbers_as_arrows();
2653
reset_numbers_as_arrows();
2658
/* Line edit style: SELECT */
2659
if (!strcmp(data[i].tag, lineedit_mode_string)) {
2660
int newval = atoi(data[i].value);
2662
/* prevent spoofing attempt */
2663
for (j = 0; LYLineeditNames[j]; j++) {
2664
if (j==newval) current_lineedit = newval;
2668
#ifdef EXP_KEYBOARD_LAYOUT
2669
/* Keyboard layout: SELECT */
2670
if (!strcmp(data[i].tag, kblayout_string)) {
2671
int newval = atoi(data[i].value);
2673
/* prevent spoofing attempt */
2674
for (j = 0; LYKbLayoutNames[j]; j++) {
2675
if (j==newval) current_layout = newval;
2678
#endif /* EXP_KEYBOARD_LAYOUT */
2680
/* Mail Address: INPUT */
2681
if (!strcmp(data[i].tag, mail_address_string)) {
2682
FREE(personal_mail_address);
2683
StrAllocCopy(personal_mail_address, data[i].value);
2686
/* Search Type: SELECT */
2687
if (!strcmp(data[i].tag, search_type_string)
2688
&& GetOptValues(search_type_values, data[i].value, &code)) {
2689
case_sensitive = (BOOL) code;
2692
/* HTML error tolerance: SELECT */
2693
if (!strcmp(data[i].tag, DTD_recovery_string)
2694
&& GetOptValues(DTD_type_values, data[i].value, &code)) {
2695
if (Old_DTD != code) {
2697
HTSwitchDTD(!Old_DTD);
2702
/* Select Popups: ON/OFF */
2703
if (!strcmp(data[i].tag, select_popups_string)
2704
&& GetOptValues(bool_values, data[i].value, &code)) {
2705
LYSelectPopups = (BOOL) code;
2708
#if defined(USE_SLANG) || defined(COLOR_CURSES)
2709
/* Show Color: SELECT */
2710
if (!strcmp(data[i].tag, show_color_string)
2711
&& GetOptValues(show_color_values, data[i].value,
2712
&LYChosenShowColor)) {
2714
LYShowColor = LYChosenShowColor;
2715
if (CurrentShowColor != LYShowColor) {
2716
lynx_force_repaint();
2718
CurrentShowColor = LYShowColor;
2720
SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
2723
#endif /* USE_SLANG || COLOR_CURSES */
2725
/* Show Cursor: ON/OFF */
2726
if (!strcmp(data[i].tag, show_cursor_string)
2727
&& GetOptValues(bool_values, data[i].value, &code)) {
2728
LYShowCursor = (BOOL) code;
2731
/* Underline links: ON/OFF */
2732
if (!strcmp(data[i].tag, underline_links_string)
2733
&& GetOptValues(bool_values, data[i].value, &code)) {
2734
LYUnderlineLinks = (BOOL) code;
2737
#ifdef USE_SCROLLBAR
2738
/* Show Scrollbar: ON/OFF */
2739
if (!strcmp(data[i].tag, show_scrollbar_string)
2740
&& GetOptValues(bool_values, data[i].value, &code)) {
2741
LYShowScrollbar = (BOOL) code;
2745
/* Cookie Prompting: SELECT */
2746
if (!strcmp(data[i].tag, cookie_prompt_string))
2747
GetOptValues(prompt_values, data[i].value, &cookie_noprompt);
2750
/* SSL Prompting: SELECT */
2751
if (!strcmp(data[i].tag, ssl_prompt_string))
2752
GetOptValues(prompt_values, data[i].value, &ssl_noprompt);
2755
/* User Mode: SELECT */
2756
if (!strcmp(data[i].tag, user_mode_string)
2757
&& GetOptValues(user_mode_values, data[i].value, &user_mode)) {
2758
if (user_mode == NOVICE_MODE) {
2759
display_lines = (LYlines - 4);
2761
display_lines = LYlines-2;
2765
/* Type of visited pages page: SELECT */
2766
if (!strcmp(data[i].tag, visited_links_string))
2767
GetOptValues(visited_links_values, data[i].value, &Visited_Links_As);
2769
/* Show Images: SELECT */
2770
if (!strcmp(data[i].tag, images_string)) {
2771
if (!strcmp(data[i].value, images_ignore_all_string)
2772
&& !(pseudo_inline_alts == FALSE && clickable_images == FALSE)) {
2773
pseudo_inline_alts = FALSE;
2774
clickable_images = FALSE;
2776
} else if (!strcmp(data[i].value, images_use_label_string)
2777
&& !(pseudo_inline_alts == TRUE && clickable_images == FALSE)) {
2778
pseudo_inline_alts = TRUE;
2779
clickable_images = FALSE;
2781
} else if (!strcmp(data[i].value, images_use_links_string)
2782
&& !(clickable_images == TRUE)) {
2783
clickable_images = TRUE;
2788
/* Verbose Images: ON/OFF */
2789
if (!strcmp(data[i].tag, verbose_images_string)
2790
&& GetOptValues(verbose_images_type_values, data[i].value, &code)) {
2791
if (verbose_img != code) {
2792
verbose_img = (BOOL) code;
2797
/* VI Keys: ON/OFF */
2798
if (!strcmp(data[i].tag, vi_keys_string)
2799
&& GetOptValues(bool_values, data[i].value, &code)) {
2800
if ((vi_keys = (BOOL) code) != FALSE) {
2807
/* Bookmarks File Menu: SELECT */
2808
if (!strcmp(data[i].tag, mbm_string) && (!LYMBMBlocked)) {
2809
GetOptValues(mbm_values, data[i].value, &LYMultiBookmarks);
2812
/* Default Bookmarks filename: INPUT */
2813
if (!strcmp(data[i].tag, single_bookmark_string) && (!no_bookmark)) {
2814
if (strcmp(data[i].value, "")) {
2815
FREE(bookmark_page);
2816
StrAllocCopy(bookmark_page, data[i].value);
2820
/* Assume Character Set: SELECT */
2821
if (!strcmp(data[i].tag, assume_char_set_string)) {
2822
int newval = UCGetLYhndl_byMIME(data[i].value);
2825
&& ((raw_mode_old &&
2826
newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset))
2827
|| (!raw_mode_old &&
2828
newval != UCLYhndl_for_unspec)
2831
UCLYhndl_for_unspec = newval;
2832
StrAllocCopy(UCAssume_MIMEcharset, data[i].value);
2833
assume_char_set_changed = TRUE;
2837
#ifdef EXP_LOCALE_CHARSET
2838
/* Use locale-based character set: ON/OFF */
2839
if (!strcmp(data[i].tag, locale_charset_string)
2840
&& GetOptValues(bool_values, data[i].value, &code)) {
2841
LYLocaleCharset = (BOOL) code;
2845
/* Display Character Set: SELECT */
2846
if (!strcmp(data[i].tag, display_char_set_string)) {
2847
int newval = atoi(data[i].value);
2849
/* prevent spoofing attempt */
2850
for (j = 0; LYchar_set_names[j]; j++) {
2851
if (j==newval) current_char_set = newval;
2855
/* Raw Mode: ON/OFF */
2856
if (!strcmp(data[i].tag, raw_mode_string)
2857
&& GetOptValues(bool_values, data[i].value, &code)) {
2858
LYRawMode = (BOOL) code;
2864
if (!strcmp(data[i].tag, ftp_sort_string)) {
2865
GetOptValues(ftp_sort_values, data[i].value, &HTfileSortMethod);
2868
#ifdef DIRED_SUPPORT
2869
/* Local Directory Style: SELECT */
2870
if (!strcmp(data[i].tag, dired_list_string)) {
2871
GetOptValues(dired_list_values, data[i].value, &dir_list_style);
2874
/* Local Directory Order: SELECT */
2875
if (!strcmp(data[i].tag, dired_sort_string)) {
2876
GetOptValues(dired_sort_values, data[i].value, &dir_list_order);
2878
#endif /* LONG_LIST */
2879
#endif /* DIRED_SUPPORT */
2881
/* Show dot files: ON/OFF */
2882
if (!strcmp(data[i].tag, show_dotfiles_string) && (!no_dotfiles)
2883
&& GetOptValues(bool_values, data[i].value, &code)) {
2884
show_dotfiles = (BOOL) code;
2887
#ifdef USE_READPROGRESS
2888
/* Show Transfer Rate: enumerated value */
2889
if (!strcmp(data[i].tag, show_rate_string)
2890
&& GetOptValues(rate_values, data[i].value, &code)) {
2891
LYTransferRate = code;
2893
#endif /* USE_READPROGRESS */
2895
/* Preferred Document Character Set: INPUT */
2896
if (!strcmp(data[i].tag, preferred_doc_char_string)) {
2897
if (strcmp(pref_charset, data[i].value)) {
2899
StrAllocCopy(pref_charset, data[i].value);
2900
need_end_reload = TRUE;
2904
/* Preferred Document Language: INPUT */
2905
if (!strcmp(data[i].tag, preferred_doc_lang_string)) {
2906
if (strcmp(language, data[i].value)) {
2908
StrAllocCopy(language, data[i].value);
2909
need_end_reload = TRUE;
2913
/* User Agent: INPUT */
2914
if (!strcmp(data[i].tag, user_agent_string) && (!no_useragent)) {
2915
if (strcmp(LYUserAgent, data[i].value)) {
2916
need_end_reload = TRUE;
2918
/* ignore Copyright warning ? */
2919
StrAllocCopy(LYUserAgent,
2922
: LYUserAgentDefault);
2923
if (!LYCheckUserAgent()) {
2924
HTAlert(UA_PLEASE_USE_LYNX);
2931
* Process the flags:
2933
#ifdef EXP_LOCALE_CHARSET
2934
LYFindLocaleCharset();
2936
if ( display_char_set_old != current_char_set ||
2937
raw_mode_old != LYRawMode ||
2938
assume_char_set_changed ) {
2940
* charset settings: the order is essential here.
2942
if (display_char_set_old != current_char_set) {
2944
* Set the LYUseDefaultRawMode value and character
2945
* handling if LYRawMode was changed. - FM
2947
LYUseDefaultRawMode = TRUE;
2948
HTMLUseCharacterSet(current_char_set);
2949
#ifdef CAN_SWITCH_DISPLAY_CHARSET
2950
/* Deduce whether the user wants autoswitch: */
2951
switch_display_charsets =
2952
(current_char_set == auto_display_charset
2953
|| current_char_set == auto_other_display_charset);
2956
if (assume_char_set_changed && HTCJK != JAPANESE) {
2957
LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set);
2959
if (raw_mode_old != LYRawMode || assume_char_set_changed) {
2961
* Set the raw 8-bit or CJK mode defaults and
2962
* character set if changed. - FM
2964
HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
2965
HTMLSetCharacterHandling(current_char_set);
2968
} /* end of charset settings */
2971
* FIXME: Golly gee, we need to write all of this out now, don't we?
2973
BStrFree(newdoc->post_data);
2976
HTInfoMsg(SAVING_OPTIONS);
2977
LYrcShowColor = LYChosenShowColor;
2978
if (save_rc(NULL)) {
2979
HTInfoMsg(OPTIONS_SAVED);
2981
HTAlert(OPTIONS_NOT_SAVED);
2986
* Exit: working around the previous document.
2987
* Being out of mainloop()/getfile() cycle, do things manually.
2989
CTRACE((tfp, "\nLYOptions.c/postoptions(): exiting...\n"));
2990
CTRACE((tfp, " need_reload = %s\n",
2991
need_reload ? "TRUE" : "FALSE"));
2992
CTRACE((tfp, " need_end_reload = %s\n",
2993
need_end_reload ? "TRUE" : "FALSE"));
2995
/* Options menu was pushed before postoptions(), so pop-up. */
2997
WWWDoc.address = newdoc->address;
2998
WWWDoc.post_data = newdoc->post_data;
2999
WWWDoc.post_content_type = newdoc->post_content_type;
3000
WWWDoc.bookmark = newdoc->bookmark;
3001
WWWDoc.isHEAD = newdoc->isHEAD;
3002
WWWDoc.safe = newdoc->safe;
3003
LYforce_no_cache = FALSE; /* ! */
3004
LYoverride_no_cache = TRUE; /* ! */
3006
* Working out of getfile() cycle we reset *no_cache manually here so
3007
* HTLoadAbsolute() will return "Document already in memory": it was
3008
* forced reloading Options Menu again without this (overhead).
3010
* Probably *no_cache was set in a wrong position because of
3011
* the internal page...
3013
if (!HTLoadAbsolute(&WWWDoc))
3016
HTuncache_current_document(); /* will never use again */
3019
* Return to previous doc, not to options menu!
3020
* Reload the document we had before the options menu
3021
* but uncache only when necessary (Hurrah, user!):
3024
WWWDoc.address = newdoc->address;
3025
WWWDoc.post_data = newdoc->post_data;
3026
WWWDoc.post_content_type = newdoc->post_content_type;
3027
WWWDoc.bookmark = newdoc->bookmark;
3028
WWWDoc.isHEAD = newdoc->isHEAD;
3029
WWWDoc.safe = newdoc->safe;
3030
LYforce_no_cache = FALSE; /* see below */
3031
LYoverride_no_cache = TRUE; /* see below */
3033
* Re-setting of *no_cache is probably not required here but this is a
3034
* guarantee against _double_ reloading over the net in case prev document
3035
* has its own "no cache" attribute and options menu set "need_reload"
3036
* also. Force this HTLoadAbsolute() to return "Document already in
3039
if (!HTLoadAbsolute(&WWWDoc))
3043
* Now most interesting part: reload document when necessary.
3044
* **********************************************************
3047
reloading = FALSE; /* set manually */
3048
/* force end-to-end reload from remote server if change LYUserAgent
3049
* or language or pref_charset (marked by need_end_reload flag above),
3050
* from old-style LYK_OPTIONS (mainloop):
3052
if ((need_end_reload == TRUE &&
3053
(strncmp(newdoc->address, "http", 4) == 0 ||
3054
isLYNXCGI(newdoc->address) == 0))) {
3056
* An option has changed which may influence
3057
* content negotiation, and the resource is from
3058
* a http or https or lynxcgi URL (the only protocols
3059
* which currently do anything with this information).
3060
* Set reloading = TRUE so that proxy caches will be
3061
* flushed, which is necessary until the time when
3062
* all proxies understand HTTP 1.1 Vary: and all
3063
* Servers properly use it... Treat like
3064
* case LYK_RELOAD (see comments there). - KW
3066
reloading = TRUE; /* global flag */
3067
need_reload = TRUE; /* this was probably already TRUE, don't worry */
3070
if (need_reload == FALSE) {
3071
/* no uncache, already loaded */
3072
CTRACE((tfp, "LYOptions.c/postoptions(): now really exit.\n\n"));
3075
/* update HText cache */
3078
* see LYK_RELOAD & LYK_OPTIONS in mainloop for details...
3080
if (HTisDocumentSource()) {
3081
srcmode_for_next_retrieval(1);
3083
#ifdef USE_SOURCE_CACHE
3084
if (reloading == FALSE) {
3085
/* one more attempt to be smart enough: */
3086
if (HTcan_reparse_document()) {
3087
if (!HTreparse_document())
3088
srcmode_for_next_retrieval(0);
3089
CTRACE((tfp, "LYOptions.c/postoptions(): now really exit.\n\n"));
3094
if (newdoc->post_data != NULL && !newdoc->safe &&
3095
confirm_post_resub(newdoc->address, newdoc->title, 2, 1) == FALSE) {
3096
HTInfoMsg(WILL_NOT_RELOAD_DOC);
3097
if (HTisDocumentSource()) {
3098
srcmode_for_next_retrieval(0);
3103
HEAD_request = HTLoadedDocumentIsHEAD();
3104
/* uncache and load again */
3105
HTuncache_current_document();
3106
LYpush(newdoc, FALSE);
3107
CTRACE((tfp, "LYOptions.c/postoptions(): now really exit.\n\n"));
3111
/******** Done! **************************************************/
3114
PRIVATE char *NewSecureValue NOARGS
3117
if ((secure_value = malloc(80)) != 0) {
3118
#if defined(RAND_MAX)
3119
long key = lynx_rand();
3121
long key = (long)secure_value + (long)time(0);
3123
sprintf(secure_value, "%ld", key);
3124
return secure_value;
3129
#define LABEL_LEN 33
3132
* Note: the 'value' we are passing here is a local copy of the "same" string
3133
* as is used in LYrcFile.c to index the savable options.
3135
PRIVATE void PutLabel ARGS3(
3140
if (will_save_rc(value) && !no_option_save) {
3141
fprintf(fp, " %-*s: ", LABEL_LEN, name);
3143
int l = strlen(name);
3144
fprintf(fp, " %s", name);
3145
fprintf(fp, "%s%-*s: ",
3146
(l < (LABEL_LEN-3)) ? " " : "",
3147
(l < (LABEL_LEN-3)) ? (LABEL_LEN-1) - l : 3, "(!)");
3152
* For given a list of the .lynxrc names for boolean flags that make up a
3153
* composite setting, check if any are not writable for the .lynxrc file. If
3154
* so, return that name, so the subsequence will_save_rc() check in PutLabel()
3155
* will flag the composite as not-saved.
3157
PRIVATE char *check_if_write_lynxrc ARGS1(char **, table)
3160
char *result = NULL;
3162
for (n = 0; table[n] != 0; ++n) {
3164
if (!will_save_rc(result))
3171
* The options menu treats "Cookies" as a single enumeration, but it is read
3172
* from lynx.cfg (and perhaps .lynxrc) as a set of booleans. Check if any are
3173
* not writable to .lynxrc, so we can show the user.
3175
PRIVATE char *will_save_cookies NOARGS
3177
static char *table[] = {
3178
RC_SET_COOKIES, /* LYSetCookies */
3179
RC_ACCEPT_ALL_COOKIES, /* LYAcceptAllCookies */
3182
return check_if_write_lynxrc(table);
3186
* The options menu treats "Show images" as a single enumeration, but it is
3187
* read from lynx.cfg (and perhaps .lynxrc) as a set of booleans. Check if any
3188
* are not writable to .lynxrc, so we can show the user.
3190
PRIVATE char *will_save_images NOARGS
3192
static char *table[] = {
3193
RC_MAKE_PSEUDO_ALTS_FOR_INLINES, /* pseudo_inline_alts */
3194
RC_MAKE_LINKS_FOR_ALL_IMAGES, /* clickable_images */
3197
return check_if_write_lynxrc(table);
3201
* The visited-links menu is used from the visited-links page as well as the
3204
PUBLIC void LYMenuVisitedLinks ARGS2(
3208
BeginSelect(fp0, visited_links_string);
3209
PutOptValues(fp0, Visited_Links_As, visited_links_values);
3214
* Okay, someone wants to change options. So, let's gen up a form for them
3215
* and pass it around. Gor, this is ugly. Be a lot easier in Bourne with
3216
* "here" documents. :->
3217
* Basic Strategy: For each option, throw up the appropriate type of
3218
* control, giving defaults as appropriate. If nothing else, we're
3219
* probably going to test every control there is. MRC
3221
* This function is synchronized with postoptions(). Read the comments in
3222
* postoptions() header if you change something in gen_options().
3224
PRIVATE int gen_options ARGS1(
3228
static char tempfile[LY_MAXPATH] = "\0";
3229
BOOLEAN disable_all = FALSE;
3231
size_t cset_len = 0;
3232
size_t text_len = LYscreenWidth() > 45 ? LYscreenWidth() - 38 : 7; /* cf: PutLabel */
3234
if ((fp0 = InternalPageFP(tempfile, TRUE)) == 0)
3237
LYLocalFileToURL(newfile, tempfile);
3239
/* This should not be needed if we regenerate the temp file every
3240
time with a new name, which just happened above in the case
3241
LYReuseTempfiles==FALSE. Even for LYReuseTempfiles=TRUE, code
3242
at the end of postoptions() may remove an older cached version
3243
from memory if that version of the page was left by submitting
3244
changes. - kw 1999-11-27
3245
If access to the actual file via getfile() later fails
3246
(maybe because of some restrictions), mainloop may leave
3247
this flag on after popping the previous doc which is then
3248
unnecessarily reloaded. But I changed mainloop to reset
3249
the flag. - kw 1999-05-24 */
3250
LYforce_no_cache = TRUE;
3253
* Without LYUseFormsOptions set we should maybe not even get here.
3254
* However, it's possible we do; disable the form in that case. - kw
3256
#ifndef NO_OPTION_MENU
3257
if (!LYUseFormsOptions)
3261
BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */
3264
* I do C, not HTML. Feel free to pretty this up.
3266
fprintf(fp0, "<form action=\"%s\" method=\"post\">\n", STR_LYNXOPTIONS);
3268
* use following with some sort of one shot secret key akin to NCSA
3269
* (or was it CUTE?) telnet one shot password to allow ftp to self.
3270
* to prevent spoofing.
3272
fprintf(fp0, "<input name=\"%s\" type=\"hidden\" value=\"%s\">\n",
3273
secure_string, NewSecureValue());
3276
* visible text begins here
3279
/* Submit/Reset/Help */
3280
fprintf(fp0,"<p align=center>\n");
3282
fprintf(fp0,"<input type=\"submit\" value=\"%s\"> - \n", ACCEPT_CHANGES);
3283
fprintf(fp0,"<input type=\"reset\" value=\"%s\"> - \n", RESET_CHANGES);
3284
fprintf(fp0,"%s - \n", CANCEL_CHANGES);
3286
fprintf(fp0, "<a href=\"%s%s\">%s</a>\n",
3287
helpfilepath, OPTIONS_HELP, TO_HELP);
3290
if (!no_option_save) {
3292
fprintf(fp0, "<p align=center>%s: ", SAVE_OPTIONS);
3293
fprintf(fp0, "<input type=\"checkbox\" name=\"%s\">\n",
3294
save_options_string);
3296
fprintf(fp0, "<br>%s\n",
3297
gettext("(options marked with (!) will not be saved)"));
3301
* preformatted text follows
3303
fprintf(fp0,"<pre>\n");
3305
fprintf(fp0,"\n <em>%s</em>\n", gettext("General Preferences"));
3306
/*****************************************************************/
3308
/* User Mode: SELECT */
3309
PutLabel(fp0, gettext("User mode"), user_mode_string);
3310
BeginSelect(fp0, user_mode_string);
3311
PutOptValues(fp0, user_mode, user_mode_values);
3315
PutLabel(fp0, gettext("Editor"), editor_string);
3316
PutTextInput(fp0, editor_string, NonNull(editor), text_len,
3317
DISABLED(no_editor || system_editor));
3319
/* Search Type: SELECT */
3320
PutLabel(fp0, gettext("Type of Search"), search_type_string);
3321
BeginSelect(fp0, search_type_string);
3322
PutOptValues(fp0, case_sensitive, search_type_values);
3325
fprintf(fp0,"\n <em>%s</em>\n", gettext("Security and Privacy"));
3326
/*****************************************************************/
3328
/* Cookies: SELECT */
3329
PutLabel(fp0, gettext("Cookies"), will_save_cookies());
3330
BeginSelect(fp0, cookies_string);
3331
PutOption(fp0, !LYSetCookies,
3332
cookies_ignore_all_string,
3333
cookies_ignore_all_string);
3334
PutOption(fp0, LYSetCookies && !LYAcceptAllCookies,
3335
cookies_up_to_user_string,
3336
cookies_up_to_user_string);
3337
PutOption(fp0, LYSetCookies && LYAcceptAllCookies,
3338
cookies_accept_all_string,
3339
cookies_accept_all_string);
3342
/* Cookie Prompting: SELECT */
3343
PutLabel(fp0, gettext("Invalid-Cookie Prompting"), cookie_prompt_string);
3344
BeginSelect(fp0, cookie_prompt_string);
3345
PutOptValues(fp0, cookie_noprompt, prompt_values);
3349
/* SSL Prompting: SELECT */
3350
PutLabel(fp0, gettext("SSL Prompting"), ssl_prompt_string);
3351
BeginSelect(fp0, ssl_prompt_string);
3352
PutOptValues(fp0, ssl_noprompt, prompt_values);
3356
fprintf(fp0,"\n <em>%s</em>\n", gettext("Keyboard Input"));
3357
/*****************************************************************/
3359
/* Keypad Mode: SELECT */
3360
PutLabel(fp0, gettext("Keypad mode"), keypad_mode_string);
3361
BeginSelect(fp0, keypad_mode_string);
3362
PutOptValues(fp0, keypad_mode, keypad_mode_values);
3365
/* Emacs keys: ON/OFF */
3366
PutLabel(fp0, gettext("Emacs keys"), emacs_keys_string);
3367
BeginSelect(fp0, emacs_keys_string);
3368
PutOptValues(fp0, emacs_keys, bool_values);
3371
/* VI Keys: ON/OFF */
3372
PutLabel(fp0, gettext("VI keys"), vi_keys_string);
3373
BeginSelect(fp0, vi_keys_string);
3374
PutOptValues(fp0, vi_keys, bool_values);
3377
/* Line edit style: SELECT */
3378
if (LYLineeditNames[1]) { /* well, at least 2 line edit styles available */
3379
PutLabel(fp0, gettext("Line edit style"), lineedit_mode_string);
3380
BeginSelect(fp0, lineedit_mode_string);
3381
for (i = 0; LYLineeditNames[i]; i++) {
3383
sprintf(temp, "%d", i);
3384
PutOption(fp0, i==current_lineedit, temp, LYLineeditNames[i]);
3389
#ifdef EXP_KEYBOARD_LAYOUT
3390
/* Keyboard layout: SELECT */
3391
PutLabel(fp0, gettext("Keyboard layout"), kblayout_string);
3392
BeginSelect(fp0, kblayout_string);
3393
for (i = 0; LYKbLayoutNames[i]; i++) {
3395
sprintf(temp, "%d", i);
3396
PutOption(fp0, i == current_layout, temp, LYKbLayoutNames[i]);
3399
#endif /* EXP_KEYBOARD_LAYOUT */
3402
* Display and Character Set
3404
fprintf(fp0,"\n <em>%s</em>\n", gettext("Display and Character Set"));
3405
/*****************************************************************/
3407
#ifdef EXP_LOCALE_CHARSET
3408
/* Use locale-based character set: ON/OFF */
3409
PutLabel(fp0, gettext("Use locale-based character set"), locale_charset_string);
3410
BeginSelect(fp0, locale_charset_string);
3411
PutOptValues(fp0, LYLocaleCharset, bool_values);
3414
#define LYLocaleCharset FALSE
3417
/* Display Character Set: SELECT */
3418
PutLabel(fp0, gettext("Display character set"), display_char_set_string);
3419
MaybeSelect(fp0, LYLocaleCharset, display_char_set_string);
3420
for (i = 0; LYchar_set_names[i]; i++) {
3422
size_t len = strlen(LYchar_set_names[i]);
3425
sprintf(temp, "%d", i);
3426
#ifdef EXP_CHARSET_CHOICE
3427
if (!charset_subsets[i].hide_display)
3429
PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]);
3433
/* Assume Character Set: SELECT */
3436
curval = UCLYhndl_for_unspec;
3439
* FIXME: If bogus value in lynx.cfg, then in old way, that is the
3440
* string that was displayed. Now, user will never see that. Good
3441
* or bad? I don't know. MRC
3443
if (curval == current_char_set) {
3444
/* ok, LYRawMode, so use UCAssume_MIMEcharset */
3445
curval = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);
3447
PutLabel(fp0, gettext("Assumed document character set"), assume_char_set_string);
3448
BeginSelect(fp0, assume_char_set_string);
3449
for (i = 0; i < LYNumCharsets; i++) {
3450
#ifdef EXP_CHARSET_CHOICE
3451
if (!charset_subsets[i].hide_assumed)
3453
PutOption(fp0, i == curval,
3454
LYCharSet_UC[i].MIMEname,
3455
LYCharSet_UC[i].MIMEname);
3460
/* Raw Mode: ON/OFF */
3461
if (LYHaveCJKCharacterSet) {
3463
* Since CJK people hardly mixed with other world
3464
* we split the header to make it more readable:
3465
* "CJK mode" for CJK display charsets, and "Raw 8-bit" for others.
3467
PutLabel(fp0, gettext("CJK mode"), raw_mode_string);
3469
PutLabel(fp0, gettext("Raw 8-bit"), raw_mode_string);
3472
BeginSelect(fp0, raw_mode_string);
3473
PutOptValues(fp0, LYRawMode, bool_values);
3476
/* X Display: INPUT */
3477
PutLabel(fp0, gettext("X Display"), x_display_string);
3478
PutTextInput(fp0, x_display_string, NonNull(x_display), text_len, "");
3481
* Document Appearance
3483
fprintf(fp0,"\n <em>%s</em>\n", gettext("Document Appearance"));
3484
/*****************************************************************/
3486
/* Show Color: SELECT */
3487
#if defined(USE_SLANG) || defined(COLOR_CURSES)
3488
SetupChosenShowColor();
3489
PutLabel(fp0, gettext("Show color"), show_color_string);
3490
if (no_option_save) {
3491
MaybeSelect(fp0, !can_do_colors, show_color_string);
3492
if (LYShowColor == SHOW_COLOR_NEVER) {
3493
LYShowColor = SHOW_COLOR_OFF;
3494
} else if (LYShowColor == SHOW_COLOR_ALWAYS) {
3495
LYShowColor = SHOW_COLOR_ON;
3497
PutOptValues(fp0, LYShowColor - SHOW_COLOR_OFF, bool_values);
3499
BeginSelect(fp0, show_color_string);
3500
if (can_do_colors) {
3501
show_color_values[2].HtmlName = on_string;
3502
show_color_values[3].LongName = always_string;
3504
show_color_values[2].HtmlName = NULL; /* suppress "ON" - kw */
3505
show_color_values[3].LongName = "Always try";
3507
PutOptValues(fp0, LYChosenShowColor, show_color_values);
3510
#endif /* USE_SLANG || COLOR_CURSES */
3512
/* Show cursor: ON/OFF */
3513
PutLabel(fp0, gettext("Show cursor"), show_cursor_string);
3514
BeginSelect(fp0, show_cursor_string);
3515
PutOptValues(fp0, LYShowCursor, bool_values);
3518
/* Underline links: ON/OFF */
3519
PutLabel(fp0, gettext("Underline links"), underline_links_string);
3520
BeginSelect(fp0, underline_links_string);
3521
PutOptValues(fp0, LYUnderlineLinks, bool_values);
3524
#ifdef USE_SCROLLBAR
3525
/* Show scrollbar: ON/OFF */
3526
PutLabel(fp0, gettext("Show scrollbar"), show_scrollbar_string);
3527
BeginSelect(fp0, show_scrollbar_string);
3528
PutOptValues(fp0, LYShowScrollbar, bool_values);
3532
/* Select Popups: ON/OFF */
3533
PutLabel(fp0, gettext("Popups for select fields"), select_popups_string);
3534
BeginSelect(fp0, select_popups_string);
3535
PutOptValues(fp0, LYSelectPopups, bool_values);
3538
/* HTML error recovery: SELECT */
3539
PutLabel(fp0, gettext("HTML error recovery"), DTD_recovery_string);
3540
BeginSelect(fp0, DTD_recovery_string);
3541
PutOptValues(fp0, Old_DTD, DTD_type_values);
3544
/* Show Images: SELECT */
3545
PutLabel(fp0, gettext("Show images"), will_save_images());
3546
BeginSelect(fp0, images_string);
3547
PutOption(fp0, !pseudo_inline_alts && !clickable_images,
3548
images_ignore_all_string,
3549
images_ignore_all_string);
3550
PutOption(fp0, pseudo_inline_alts && !clickable_images,
3551
images_use_label_string,
3552
images_use_label_string);
3553
PutOption(fp0, clickable_images,
3554
images_use_links_string,
3555
images_use_links_string);
3558
/* Verbose Images: ON/OFF */
3559
PutLabel(fp0, gettext("Verbose images"), verbose_images_string);
3560
BeginSelect(fp0, verbose_images_string);
3561
PutOptValues(fp0, verbose_img, verbose_images_type_values);
3565
* Headers Transferred to Remote Servers
3567
fprintf(fp0,"\n <em>%s</em>\n", gettext("Headers Transferred to Remote Servers"));
3568
/*****************************************************************/
3570
/* Mail Address: INPUT */
3571
PutLabel(fp0, gettext("Personal mail address"), mail_address_string);
3572
PutTextInput(fp0, mail_address_string,
3573
NonNull(personal_mail_address), text_len, "");
3575
/* Preferred Document Character Set: INPUT */
3576
PutLabel(fp0, gettext("Preferred document character set"), preferred_doc_char_string);
3577
PutTextInput(fp0, preferred_doc_char_string,
3578
NonNull(pref_charset), cset_len+2, "");
3580
/* Preferred Document Language: INPUT */
3581
PutLabel(fp0, gettext("Preferred document language"), preferred_doc_lang_string);
3582
PutTextInput(fp0, preferred_doc_lang_string,
3583
NonNull(language), cset_len+2, "");
3585
/* User Agent: INPUT */
3586
if (!no_useragent) {
3587
PutLabel(fp0, gettext("User-Agent header"), user_agent_string);
3588
PutTextInput(fp0, user_agent_string,
3589
NonNull(LYUserAgent), text_len, "");
3593
* Listing and Accessing Files
3595
fprintf(fp0,"\n <em>%s</em>\n", gettext("Listing and Accessing Files"));
3596
/*****************************************************************/
3598
/* FTP sort: SELECT */
3599
PutLabel(fp0, gettext("FTP sort criteria"), ftp_sort_string);
3600
BeginSelect(fp0, ftp_sort_string);
3601
PutOptValues(fp0, HTfileSortMethod, ftp_sort_values);
3604
#ifdef DIRED_SUPPORT
3605
/* Local Directory Sort: SELECT */
3606
PutLabel(fp0, gettext("Local directory sort criteria"), dired_list_string);
3607
BeginSelect(fp0, dired_list_string);
3608
PutOptValues(fp0, dir_list_style, dired_list_values);
3611
/* Local Directory Order: SELECT */
3612
PutLabel(fp0, gettext("Local directory sort order"), dired_sort_string);
3613
BeginSelect(fp0, dired_sort_string);
3614
PutOptValues(fp0, dir_list_order, dired_sort_values);
3616
#endif /* LONG_LIST */
3617
#endif /* DIRED_SUPPORT */
3619
/* Show dot files: ON/OFF */
3621
PutLabel(fp0, gettext("Show dot files"), show_dotfiles_string);
3622
BeginSelect(fp0, show_dotfiles_string);
3623
PutOptValues(fp0, show_dotfiles, bool_values);
3627
/* Execution links: SELECT */
3628
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
3629
PutLabel(fp0, gettext("Execution links"), exec_links_string);
3630
BeginSelect(fp0, exec_links_string);
3631
#ifndef NEVER_ALLOW_REMOTE_EXEC
3632
PutOptValues(fp0, local_exec
3634
: (local_exec_on_local_files
3639
PutOptValues(fp0, local_exec_on_local_files
3643
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
3645
#endif /* ENABLE_OPTS_CHANGE_EXEC */
3647
#ifdef USE_READPROGRESS
3648
/* Show transfer rate: SELECT */
3649
PutLabel(fp0, gettext("Show transfer rate"), show_rate_string);
3650
BeginSelect(fp0, show_rate_string);
3651
for (i = 0; rate_values[i].LongName != 0; ++i) {
3652
char *message = NULL;
3653
HTSprintf0(&message,
3654
rate_values[i].LongName,
3655
HTProgressUnits(rate_values[i].value));
3657
LYTransferRate == rate_values[i].value,
3658
rate_values[i].HtmlName,
3663
#endif /* USE_READPROGRESS */
3666
* Special Files and Screens
3668
fprintf(fp0,"\n <em>%s</em>\n", gettext("Special Files and Screens"));
3669
/*****************************************************************/
3671
/* Multi-Bookmark Mode: SELECT */
3672
if (!LYMBMBlocked) {
3673
PutLabel(fp0, gettext("Multi-bookmarks"), mbm_string);
3674
BeginSelect(fp0, mbm_string);
3675
PutOptValues(fp0, LYMultiBookmarks, mbm_values);
3679
/* Bookmarks File Menu: LINK/INPUT */
3680
if (LYMultiBookmarks) {
3681
PutLabel(fp0, gettext("Review/edit Bookmarks files"), mbm_string);
3682
fprintf(fp0, "<a href=\"%s//MBM_MENU\">%s</a>\n",
3683
STR_LYNXOPTIONS, gettext("Goto multi-bookmark menu"));
3685
PutLabel(fp0, gettext("Bookmarks file"), single_bookmark_string);
3686
PutTextInput(fp0, single_bookmark_string,
3687
NonNull(bookmark_page), text_len, "");
3690
/* Visited Pages: SELECT */
3691
PutLabel(fp0, gettext("Visited Pages"), visited_links_string);
3692
LYMenuVisitedLinks(fp0, disable_all);
3694
if (!no_lynxcfg_info) {
3695
fprintf(fp0, "\n %s<a href=\"%s\">lynx.cfg</a>.\n",
3696
gettext("View the file "),
3700
fprintf(fp0,"\n</pre>\n");
3704
fprintf(fp0,"<p align=center>\n");
3705
fprintf(fp0,"<input type=\"submit\" value=\"%s\"> - \n", ACCEPT_CHANGES);
3706
fprintf(fp0,"<input type=\"reset\" value=\"%s\"> - \n", RESET_CHANGES);
3707
fprintf(fp0,"%s\n", CANCEL_CHANGES);
3713
fprintf(fp0,"</form>\n");
3714
EndInternalPage(fp0);
3719
#endif /* !NO_OPTION_FORMS */