~ubuntu-branches/ubuntu/edgy/lynx/edgy

« back to all changes in this revision

Viewing changes to src/LYOptions.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-16 12:14:10 UTC
  • Revision ID: james.westby@ubuntu.com-20040916121410-cz1gu92c4nqfeyrg
Tags: upstream-2.8.5
ImportĀ upstreamĀ versionĀ 2.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <HTUtils.h>
 
2
#include <HTFTP.h>
 
3
#include <HTTP.h>  /* 'reloading' flag */
 
4
#include <HTML.h>
 
5
#include <LYCurses.h>
 
6
#include <LYUtils.h>
 
7
#include <LYStrings.h>
 
8
#include <LYGlobalDefs.h>
 
9
#include <LYHistory.h>
 
10
#include <LYOptions.h>
 
11
#include <LYSignal.h>
 
12
#include <LYClean.h>
 
13
#include <LYCharSets.h>
 
14
#include <UCMap.h>
 
15
#include <UCAux.h>
 
16
#include <LYKeymap.h>
 
17
#include <LYrcFile.h>
 
18
#include <HTAlert.h>
 
19
#include <LYBookmark.h>
 
20
#include <GridText.h>
 
21
#include <LYGetFile.h>
 
22
#include <LYReadCFG.h>
 
23
#include <LYPrettySrc.h>
 
24
#include <HTFile.h>
 
25
 
 
26
#include <LYLeaks.h>
 
27
 
 
28
BOOLEAN term_options;
 
29
 
 
30
PRIVATE int LYChosenShowColor = SHOW_COLOR_UNKNOWN; /* whether to show and save */
 
31
 
 
32
PRIVATE void terminate_options  PARAMS((int sig));
 
33
 
 
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 */
 
36
#endif
 
37
 
 
38
#if defined(USE_SLANG) || defined(COLOR_CURSES)
 
39
PRIVATE BOOLEAN can_do_colors = FALSE;
 
40
#endif
 
41
 
 
42
PUBLIC BOOLEAN LYCheckUserAgent NOARGS
 
43
{
 
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) {
 
49
            return FALSE;
 
50
        }
 
51
    }
 
52
    return TRUE;
 
53
}
 
54
 
 
55
PRIVATE void SetupChosenShowColor NOARGS
 
56
{
 
57
#if defined(USE_SLANG) || defined(COLOR_CURSES)
 
58
    can_do_colors = TRUE;
 
59
#if defined(COLOR_CURSES)
 
60
    if (LYCursesON)     /* could crash if called before initialization */
 
61
        can_do_colors = (BOOL) has_colors();
 
62
#endif
 
63
    if (!no_option_save) {
 
64
        if (LYChosenShowColor == SHOW_COLOR_UNKNOWN) {
 
65
            switch (LYrcShowColor) {
 
66
            case SHOW_COLOR_NEVER:
 
67
                LYChosenShowColor =
 
68
                    (LYShowColor >= SHOW_COLOR_ON) ?
 
69
                        SHOW_COLOR_ON : SHOW_COLOR_NEVER;
 
70
                break;
 
71
            case SHOW_COLOR_ALWAYS:
 
72
                if (!can_do_colors)
 
73
                    LYChosenShowColor = SHOW_COLOR_ALWAYS;
 
74
                else
 
75
                    LYChosenShowColor =
 
76
                        (LYShowColor >= SHOW_COLOR_ON) ?
 
77
                                SHOW_COLOR_ALWAYS : SHOW_COLOR_OFF;
 
78
                break;
 
79
            default:
 
80
                LYChosenShowColor =
 
81
                    (LYShowColor >= SHOW_COLOR_ON) ?
 
82
                        SHOW_COLOR_ON : SHOW_COLOR_OFF;
 
83
            }
 
84
        }
 
85
    }
 
86
#endif /* USE_SLANG || COLOR_CURSES */
 
87
}
 
88
 
 
89
PRIVATE void validate_x_display NOPARAMS
 
90
{
 
91
    char *cp;
 
92
    if ((cp = LYgetXDisplay()) != NULL) {
 
93
        StrAllocCopy(x_display, cp);
 
94
    } else {
 
95
        FREE(x_display);
 
96
    }
 
97
}
 
98
 
 
99
PRIVATE void summarize_x_display ARGS1(
 
100
    char *,     display_option)
 
101
{
 
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);
 
108
        } else {
 
109
            _statusline(VALUE_ACCEPTED);
 
110
        }
 
111
    } else {
 
112
        if (*display_option) {
 
113
            _statusline(FAILED_TO_SET_DISPLAY);
 
114
        } else {
 
115
            _statusline(FAILED_CLEAR_SET_DISPLAY);
 
116
        }
 
117
    }
 
118
}
 
119
 
 
120
 
 
121
#ifndef NO_OPTION_MENU
 
122
PRIVATE int boolean_choice PARAMS((
 
123
        int             status,
 
124
        int             line,
 
125
        int             column,
 
126
        CONST char **   choices));
 
127
#define LYChooseBoolean(status, line, column, choices) \
 
128
        boolean_choice(status, line, column, (CONST char **)choices)
 
129
 
 
130
#define MAXCHOICES 10
 
131
 
 
132
/*
 
133
 *  Values for the options menu. - FM
 
134
 *
 
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.
 
138
 */
 
139
#define L_EDITOR         2
 
140
#define L_DISPLAY        3
 
141
 
 
142
#define L_HOME           4
 
143
#define C_MULTI         24
 
144
#define B_BOOK          34
 
145
#define C_DEFAULT       50
 
146
 
 
147
#define L_FTPSTYPE       5
 
148
#define L_MAIL_ADDRESS   6
 
149
#define L_SSEARCH        7
 
150
#define L_LANGUAGE       8
 
151
#define L_PREF_CHARSET   9
 
152
#define L_ASSUME_CHARSET (L_PREF_CHARSET + 1)
 
153
#define L_CHARSET       10
 
154
#define L_RAWMODE       11
 
155
 
 
156
#define L_COLOR         L_RAWMODE
 
157
#define B_COLOR         44
 
158
#define C_COLOR         62
 
159
 
 
160
#define L_BOOL_A        12
 
161
#define B_VIKEYS        5
 
162
#define C_VIKEYS        15
 
163
#define B_EMACSKEYS     22
 
164
#define C_EMACSKEYS     36
 
165
#define B_SHOW_DOTFILES 44
 
166
#define C_SHOW_DOTFILES 62
 
167
 
 
168
#define L_BOOL_B        13
 
169
#define B_SELECT_POPUPS 5
 
170
#define C_SELECT_POPUPS 36
 
171
#define B_SHOW_CURSOR   44
 
172
#define C_SHOW_CURSOR   62
 
173
 
 
174
#define L_KEYPAD        14
 
175
#define L_LINEED        15
 
176
#define L_LAYOUT        16
 
177
 
 
178
#ifdef DIRED_SUPPORT
 
179
#define L_DIRED         17
 
180
#define L_USER_MODE     18
 
181
#define L_USER_AGENT    19
 
182
#define L_EXEC          20
 
183
#else
 
184
#define L_USER_MODE     17
 
185
#define L_USER_AGENT    18
 
186
#define L_EXEC          19
 
187
#endif /* DIRED_SUPPORT */
 
188
 
 
189
#define L_VERBOSE_IMAGES L_USER_MODE
 
190
#define B_VERBOSE_IMAGES 50
 
191
#define C_VERBOSE_IMAGES (B_VERBOSE_IMAGES + 21)
 
192
 
 
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)
 
206
 
 
207
#define LPAREN '('
 
208
#define RPAREN ')'
 
209
 
 
210
PRIVATE int add_it ARGS2(char *, text, int, len)
 
211
{
 
212
    if (len) {
 
213
        text[len] = '\0';
 
214
        LYaddstr(text);
 
215
    }
 
216
    return 0;
 
217
}
 
218
 
 
219
/*
 
220
 * addlbl() is used instead of plain LYaddstr() in old-style options menu
 
221
 * to show hot keys in bold.
 
222
 */
 
223
PRIVATE void addlbl ARGS1(CONST char *, text)
 
224
{
 
225
    char actual[80];
 
226
    int s, d;
 
227
    BOOL b = FALSE;
 
228
 
 
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);
 
233
            lynx_start_bold();
 
234
            b = TRUE;
 
235
            actual[d++] = text[s];
 
236
        } else if (text[s] == RPAREN) {
 
237
            d = add_it(actual, d);
 
238
            lynx_stop_bold();
 
239
            b = FALSE;
 
240
        }
 
241
    }
 
242
    add_it(actual, d);
 
243
    if (b)
 
244
        lynx_stop_bold();
 
245
}
 
246
 
 
247
#if !defined(VMS) || defined(USE_SLANG)
 
248
#define HANDLE_LYOPTIONS \
 
249
                    if (term_options) { \
 
250
                        term_options = FALSE; \
 
251
                    } else { \
 
252
                        AddValueAccepted = TRUE; \
 
253
                    } \
 
254
                    goto draw_options
 
255
#else
 
256
#define HANDLE_LYOPTIONS \
 
257
                    term_options = FALSE; \
 
258
                    if (use_assume_charset != old_use_assume_charset) \
 
259
                        goto draw_options
 
260
#endif /* !VMS || USE_SLANG */
 
261
 
 
262
PUBLIC void LYoptions NOARGS
 
263
{
 
264
#define ShowBool(value) LYaddstr((value) ? "ON " : "OFF")
 
265
    static char *bool_choices[] = {
 
266
        "OFF",
 
267
        "ON",
 
268
        NULL
 
269
    };
 
270
    static char *caseless_choices[] = {
 
271
        "CASE INSENSITIVE",
 
272
        "CASE SENSITIVE",
 
273
        NULL
 
274
    };
 
275
    static char *dirList_choices[] = {
 
276
        "Directories first",
 
277
        "Files first",
 
278
        "Mixed style",
 
279
        NULL
 
280
    };
 
281
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
 
282
    static char *exec_choices[] = {
 
283
        "ALWAYS OFF",
 
284
        "FOR LOCAL FILES ONLY",
 
285
#ifndef NEVER_ALLOW_REMOTE_EXEC
 
286
        "ALWAYS ON",
 
287
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
 
288
        NULL
 
289
    };
 
290
#endif
 
291
    static char *fileSort_choices[] = {
 
292
        "By Filename",
 
293
        "By Type",
 
294
        "By Size",
 
295
        "By Date",
 
296
        NULL
 
297
    };
 
298
    static char *keypad_choices[] = {
 
299
        "Numbers act as arrows",
 
300
        "Links are numbered",
 
301
        "Links and form fields are numbered",
 
302
        NULL
 
303
    };
 
304
    static char *mbm_choices[] = {
 
305
        "OFF     ",
 
306
        "STANDARD",
 
307
        "ADVANCED",
 
308
        NULL
 
309
    };
 
310
    static char *userMode_choices[] = {
 
311
        "Novice",
 
312
        "Intermediate",
 
313
        "Advanced",
 
314
        NULL
 
315
    };
 
316
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
 
317
    int itmp;
 
318
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
319
    int response, ch;
 
320
    /*
 
321
     *  If the user changes the display we need memory to put it in.
 
322
     */
 
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;
 
330
    char *cp = NULL;
 
331
    BOOL use_assume_charset, old_use_assume_charset;
 
332
 
 
333
#ifdef DIRED_SUPPORT
 
334
#ifdef ENABLE_OPTS_CHANGE_EXEC
 
335
    if (LYlines < 24) {
 
336
        HTAlert(OPTION_SCREEN_NEEDS_24);
 
337
        return;
 
338
    }
 
339
#else
 
340
    if (LYlines < 23) {
 
341
        HTAlert(OPTION_SCREEN_NEEDS_23);
 
342
        return;
 
343
    }
 
344
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
345
#else
 
346
#ifdef ENABLE_OPTS_CHANGE_EXEC
 
347
    if (LYlines < 23) {
 
348
        HTAlert(OPTION_SCREEN_NEEDS_23);
 
349
        return;
 
350
    }
 
351
#else
 
352
    if (LYlines < 22) {
 
353
        HTAlert(OPTION_SCREEN_NEEDS_22);
 
354
        return;
 
355
    }
 
356
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
357
#endif /* DIRED_SUPPORT */
 
358
 
 
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;
 
367
        }
 
368
#if defined(USE_SLANG) || defined(COLOR_CURSES)
 
369
    } else {
 
370
        SetupChosenShowColor();
 
371
#endif /* USE_SLANG || COLOR_CURSES */
 
372
    }
 
373
 
 
374
    old_use_assume_charset =
 
375
        use_assume_charset = (BOOL) (user_mode == ADVANCED_MODE);
 
376
 
 
377
draw_options:
 
378
 
 
379
    old_use_assume_charset = use_assume_charset;
 
380
    /*
 
381
     *  NOTE that printw() should be avoided for strings that
 
382
     *  might have non-ASCII or multibyte/CJK characters. - FM
 
383
     */
 
384
#if defined(FANCY_CURSES) || defined (USE_SLANG)
 
385
    if (enable_scrollback) {
 
386
        LYclear();
 
387
    } else {
 
388
        LYerase();
 
389
    }
 
390
#else
 
391
    LYclear();
 
392
#endif /* FANCY_CURSES || USE_SLANG */
 
393
    LYmove(0, 5);
 
394
 
 
395
    lynx_start_h1_color ();
 
396
    LYaddstr("         Options Menu (");
 
397
    LYaddstr(LYNX_NAME);
 
398
    LYaddstr(" Version ");
 
399
    LYaddstr(LYNX_VERSION);
 
400
    LYaddch(')');
 
401
    lynx_stop_h1_color ();
 
402
    LYmove(L_EDITOR, 5);
 
403
    addlbl("(E)ditor                     : ");
 
404
    LYaddstr((editor && *editor) ? editor : "NONE");
 
405
 
 
406
    LYmove(L_DISPLAY, 5);
 
407
    addlbl("(D)ISPLAY variable           : ");
 
408
    LYaddstr((x_display && *x_display) ? x_display : "NONE");
 
409
 
 
410
    LYmove(L_HOME, 5);
 
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");
 
416
    } else {
 
417
        addlbl("(B)ookmark file: ");
 
418
        LYaddstr((bookmark_page && *bookmark_page) ? bookmark_page : "NONE");
 
419
    }
 
420
 
 
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    " :
 
426
                                               "By Date    "))));
 
427
 
 
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");
 
432
 
 
433
    LYmove(L_SSEARCH, 5);
 
434
    addlbl("(S)earching type             : ");
 
435
    LYaddstr(case_sensitive ? "CASE SENSITIVE  " : "CASE INSENSITIVE");
 
436
 
 
437
    LYmove(L_Charset, 5);
 
438
    addlbl("display (C)haracter set      : ");
 
439
    LYaddstr(LYchar_set_names[current_char_set]);
 
440
 
 
441
    LYmove(L_LANGUAGE, 5);
 
442
    addlbl("preferred document lan(G)uage: ");
 
443
    LYaddstr((language && *language) ? language : "NONE");
 
444
 
 
445
    LYmove(L_PREF_CHARSET, 5);
 
446
    addlbl("preferred document c(H)arset : ");
 
447
    LYaddstr((pref_charset && *pref_charset) ? pref_charset : "NONE");
 
448
 
 
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);
 
454
        else
 
455
            LYaddstr((UCLYhndl_for_unspec >= 0) ?
 
456
                     LYCharSet_UC[UCLYhndl_for_unspec].MIMEname
 
457
                                              : "NONE");
 
458
    }
 
459
 
 
460
    LYmove(L_Rawmode, 5);
 
461
    addlbl("Raw 8-bit or CJK m(O)de      : ");
 
462
    ShowBool(LYRawMode);
 
463
 
 
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);
 
469
    } else {
 
470
        switch (LYChosenShowColor) {
 
471
        case SHOW_COLOR_NEVER:
 
472
                LYaddstr("NEVER     ");
 
473
                break;
 
474
        case SHOW_COLOR_OFF:
 
475
                LYaddstr("OFF");
 
476
                break;
 
477
        case SHOW_COLOR_ON:
 
478
                LYaddstr("ON ");
 
479
                break;
 
480
        case SHOW_COLOR_ALWAYS:
 
481
#if defined(COLOR_CURSES)
 
482
                if (!has_colors())
 
483
                    LYaddstr("Always try");
 
484
                else
 
485
#endif
 
486
                    LYaddstr("ALWAYS    ");
 
487
        }
 
488
    }
 
489
#endif /* USE_SLANG || COLOR_CURSES */
 
490
 
 
491
    LYmove(L_Bool_A, B_VIKEYS);
 
492
    addlbl("(V)I keys: ");
 
493
    ShowBool(vi_keys);
 
494
 
 
495
    LYmove(L_Bool_A, B_EMACSKEYS);
 
496
    addlbl("e(M)acs keys: ");
 
497
    ShowBool(emacs_keys);
 
498
 
 
499
    LYmove(L_Bool_A, B_SHOW_DOTFILES);
 
500
    addlbl("sho(W) dot files: ");
 
501
    ShowBool(!no_dotfiles && show_dotfiles);
 
502
 
 
503
    LYmove(L_Bool_B, B_SELECT_POPUPS);
 
504
    addlbl("popups for selec(T) fields   : ");
 
505
    ShowBool(LYSelectPopups);
 
506
 
 
507
    LYmove(L_Bool_B, B_SHOW_CURSOR);
 
508
    addlbl("show cursor (@) : ");
 
509
    ShowBool(LYShowCursor);
 
510
 
 
511
    LYmove(L_Keypad, 5);
 
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             ");
 
520
 
 
521
    LYmove(L_Lineed, 5);
 
522
    addlbl("li(N)e edit style            : ");
 
523
    LYaddstr(LYLineeditNames[current_lineedit]);
 
524
 
 
525
#ifdef EXP_KEYBOARD_LAYOUT
 
526
    LYmove(L_Layout, 5);
 
527
    addlbl("Ke(Y)board layout            : ");
 
528
    LYaddstr(LYKbLayoutNames[current_layout]);
 
529
#endif
 
530
 
 
531
#ifdef DIRED_SUPPORT
 
532
    LYmove(L_Dired, 5);
 
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 */
 
538
 
 
539
    LYmove(L_User_Mode, 5);
 
540
    addlbl("(U)ser mode                  : ");
 
541
    LYaddstr(  (user_mode == NOVICE_MODE) ? "Novice      " :
 
542
      ((user_mode == INTERMEDIATE_MODE) ? "Intermediate" :
 
543
                                          "Advanced    "));
 
544
 
 
545
    addlbl("  verbose images (!) : ");
 
546
    ShowBool( verbose_img);
 
547
 
 
548
    LYmove(L_User_Agent, 5);
 
549
    addlbl("user (A)gent                 : ");
 
550
    LYaddstr((LYUserAgent && *LYUserAgent) ? LYUserAgent : "NONE");
 
551
 
 
552
#if defined(ENABLE_OPTS_CHANGE_EXEC) && (defined(EXEC_LINKS) || defined(EXEC_SCRIPTS))
 
553
    LYmove(L_Exec, 5);
 
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" :
 
558
                                       "ALWAYS OFF          "));
 
559
#else
 
560
    LYaddstr(local_exec_on_local_files ? "FOR LOCAL FILES ONLY" :
 
561
                                       "ALWAYS OFF          ");
 
562
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
 
563
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
564
 
 
565
    LYmove(LYlines-3, 2);
 
566
    LYaddstr(SELECT_SEGMENT);
 
567
    lynx_start_bold();
 
568
    LYaddstr(CAP_LETT_SEGMENT);
 
569
    lynx_stop_bold();
 
570
    LYaddstr(OF_OPT_LINE_SEGMENT);
 
571
    if (!no_option_save) {
 
572
        LYaddstr(" '");
 
573
        lynx_start_bold();
 
574
        LYaddstr(">");
 
575
        lynx_stop_bold();
 
576
        LYaddstr("'");
 
577
        LYaddstr(TO_SAVE_SEGMENT);
 
578
    }
 
579
    LYaddstr(OR_SEGMENT);
 
580
    LYaddstr("'");
 
581
    lynx_start_bold();
 
582
    LYaddstr("r");
 
583
    lynx_stop_bold();
 
584
    LYaddstr("'");
 
585
    LYaddstr(TO_RETURN_SEGMENT);
 
586
 
 
587
    response = 0;
 
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;
 
595
        }
 
596
        LYmove((LYlines - 2), 0);
 
597
        lynx_start_prompt_color ();
 
598
        LYaddstr(COMMAND_PROMPT);
 
599
        lynx_stop_prompt_color ();
 
600
 
 
601
        LYrefresh();
 
602
        response = LYgetch_single();
 
603
        if (term_options || LYCharIsINTERRUPT_NO_letter(response))
 
604
            response = 'R';
 
605
        if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
 
606
            lynx_force_repaint();
 
607
            goto draw_options;
 
608
        }
 
609
        switch (response) {
 
610
            case 'E':   /* Change the editor. */
 
611
                if (no_editor) {
 
612
                    _statusline(EDIT_DISABLED);
 
613
                } else if (system_editor ) {
 
614
                    _statusline(EDITOR_LOCKED);
 
615
                } else {
 
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);
 
620
                        LYaddstr("    ");
 
621
                        *display_option = '\0';
 
622
                    }
 
623
                    _statusline(ACCEPT_DATA);
 
624
                    LYmove(L_EDITOR, COL_OPTION_VALUES);
 
625
                    lynx_start_bold();
 
626
                    ch = LYgetstr(display_option, VISIBLE,
 
627
                                  sizeof(display_option), NORECALL);
 
628
                    lynx_stop_bold();
 
629
                    LYmove(L_EDITOR, COL_OPTION_VALUES);
 
630
                    if (term_options || ch == -1) {
 
631
                        LYaddstr((editor && *editor) ?
 
632
                                            editor : "NONE");
 
633
                    } else if (*display_option == '\0') {
 
634
                        FREE(editor);
 
635
                        LYaddstr("NONE");
 
636
                    } else {
 
637
                        StrAllocCopy(editor, display_option);
 
638
                        LYaddstr(display_option);
 
639
                    }
 
640
                    LYclrtoeol();
 
641
                    if (ch == -1) {
 
642
                        HTInfoMsg(CANCELLED);
 
643
                        HTInfoMsg("");
 
644
                    } else {
 
645
                        _statusline(VALUE_ACCEPTED);
 
646
                    }
 
647
                }
 
648
                response = ' ';
 
649
                break;
 
650
 
 
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);
 
656
                    LYaddstr("    ");
 
657
                    *display_option = '\0';
 
658
                }
 
659
                _statusline(ACCEPT_DATA);
 
660
                LYmove(L_DISPLAY, COL_OPTION_VALUES);
 
661
                lynx_start_bold();
 
662
                ch = LYgetstr(display_option, VISIBLE,
 
663
                              sizeof(display_option), NORECALL);
 
664
                lynx_stop_bold();
 
665
                LYmove(L_DISPLAY, COL_OPTION_VALUES);
 
666
 
 
667
#ifdef VMS
 
668
#define CompareEnvVars(a,b) strcasecomp(a, b)
 
669
#else
 
670
#define CompareEnvVars(a,b) strcmp(a, b)
 
671
#endif /* VMS */
 
672
 
 
673
                if ((term_options || ch == -1) ||
 
674
                    (x_display != NULL &&
 
675
                     !CompareEnvVars(x_display, display_option))) {
 
676
                    /*
 
677
                     *  Cancelled, or a non-NULL display string
 
678
                     *  wasn't changed. - FM
 
679
                     */
 
680
                    LYaddstr((x_display && *x_display) ? x_display : "NONE");
 
681
                    LYclrtoeol();
 
682
                    if (ch == -1) {
 
683
                        HTInfoMsg(CANCELLED);
 
684
                        HTInfoMsg("");
 
685
                    } else {
 
686
                        _statusline(VALUE_ACCEPTED);
 
687
                    }
 
688
                    response = ' ';
 
689
                    break;
 
690
                } else if (*display_option == '\0') {
 
691
                    if ((x_display == NULL) ||
 
692
                        (x_display != NULL && *x_display == '\0')) {
 
693
                        /*
 
694
                         *  NULL or zero-length display string
 
695
                         *  wasn't changed. - FM
 
696
                         */
 
697
                        LYaddstr("NONE");
 
698
                        LYclrtoeol();
 
699
                        _statusline(VALUE_ACCEPTED);
 
700
                        response = ' ';
 
701
                        break;
 
702
                    }
 
703
                }
 
704
                /*
 
705
                 *  Set the new DISPLAY variable. - FM
 
706
                 */
 
707
                LYsetXDisplay(display_option);
 
708
                validate_x_display();
 
709
                cp = NULL;
 
710
                LYaddstr(x_display ? x_display : "NONE");
 
711
                LYclrtoeol();
 
712
                summarize_x_display(display_option);
 
713
                response = ' ';
 
714
                break;
 
715
 
 
716
            case 'L':   /* Change multibookmarks option. */
 
717
                if (LYMBMBlocked) {
 
718
                    _statusline(MULTIBOOKMARKS_DISALLOWED);
 
719
                    response = ' ';
 
720
                    break;
 
721
                }
 
722
                if (!LYSelectPopups) {
 
723
                    LYMultiBookmarks = LYChooseBoolean(LYMultiBookmarks,
 
724
                                                      L_HOME, C_MULTI,
 
725
                                                      mbm_choices);
 
726
                } else {
 
727
                    LYMultiBookmarks = LYChoosePopup(LYMultiBookmarks,
 
728
                                                    L_HOME, (C_MULTI - 1),
 
729
                                                    mbm_choices,
 
730
                                                    3, FALSE, FALSE);
 
731
                }
 
732
#if defined(VMS) || defined(USE_SLANG)
 
733
                if (LYSelectPopups) {
 
734
                    LYmove(L_HOME, C_MULTI);
 
735
                    LYclrtoeol();
 
736
                    LYaddstr(mbm_choices[LYMultiBookmarks]);
 
737
                }
 
738
#endif /* VMS || USE_SLANG */
 
739
#if !defined(VMS) && !defined(USE_SLANG)
 
740
                if (!LYSelectPopups)
 
741
#endif /* !VMS && !USE_SLANG */
 
742
                {
 
743
                    LYmove(L_HOME, B_BOOK);
 
744
                    LYclrtoeol();
 
745
                    if (LYMultiBookmarks != MBM_OFF) {
 
746
                        LYaddstr(gettext("review/edit B)ookmarks files"));
 
747
                    } else {
 
748
                        LYaddstr(gettext("B)ookmark file: "));
 
749
                        LYaddstr((bookmark_page && *bookmark_page) ?
 
750
                                                   bookmark_page : "NONE");
 
751
                    }
 
752
                }
 
753
                response = ' ';
 
754
                if (LYSelectPopups) {
 
755
                    HANDLE_LYOPTIONS;
 
756
                }
 
757
                break;
 
758
 
 
759
            case 'B':   /* Change the bookmark page location. */
 
760
                /*
 
761
                 *  Anonymous users should not be allowed to
 
762
                 *  change the bookmark page.
 
763
                 */
 
764
                if (!no_bookmark) {
 
765
                    if (LYMultiBookmarks != MBM_OFF) {
 
766
                        edit_bookmarks();
 
767
                        signal(SIGINT, terminate_options);
 
768
                        goto draw_options;
 
769
                    }
 
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);
 
774
                        LYclrtoeol();
 
775
                        *display_option = '\0';
 
776
                    }
 
777
                    _statusline(ACCEPT_DATA);
 
778
                    LYmove(L_HOME, C_DEFAULT);
 
779
                    lynx_start_bold();
 
780
                    ch = LYgetstr(display_option, VISIBLE,
 
781
                                  sizeof(display_option), NORECALL);
 
782
                    lynx_stop_bold();
 
783
                    LYmove(L_HOME, C_DEFAULT);
 
784
                    if (term_options ||
 
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");
 
792
                        LYclrtoeol();
 
793
                        _statusline(USE_PATH_OFF_HOME);
 
794
                        response = ' ';
 
795
                        break;
 
796
                    } else {
 
797
                        StrAllocCopy(bookmark_page, display_option);
 
798
                        StrAllocCopy(MBM_A_subbookmark[0], bookmark_page);
 
799
                        LYaddstr(bookmark_page);
 
800
                    }
 
801
                    LYclrtoeol();
 
802
                    if (ch == -1) {
 
803
                        HTInfoMsg(CANCELLED);
 
804
                        HTInfoMsg("");
 
805
                    } else {
 
806
                        _statusline(VALUE_ACCEPTED);
 
807
                    }
 
808
                } else { /* anonymous */
 
809
                    _statusline(BOOKMARK_CHANGE_DISALLOWED);
 
810
                }
 
811
                response = ' ';
 
812
                break;
 
813
 
 
814
            case 'F':   /* Change ftp directory sorting. */
 
815
                if (!LYSelectPopups) {
 
816
                    HTfileSortMethod = LYChooseBoolean(HTfileSortMethod,
 
817
                                                      L_FTPSTYPE, -1,
 
818
                                                      fileSort_choices);
 
819
                } else {
 
820
                    HTfileSortMethod = LYChoosePopup(HTfileSortMethod,
 
821
                                                    L_FTPSTYPE, -1,
 
822
                                                    fileSort_choices,
 
823
                                                    4, FALSE, FALSE);
 
824
#if defined(VMS) || defined(USE_SLANG)
 
825
                    LYmove(L_FTPSTYPE, COL_OPTION_VALUES);
 
826
                    LYclrtoeol();
 
827
                    LYaddstr(fileSort_choices[HTfileSortMethod]);
 
828
#endif /* VMS || USE_SLANG */
 
829
                }
 
830
                response = ' ';
 
831
                if (LYSelectPopups) {
 
832
                    HANDLE_LYOPTIONS;
 
833
                }
 
834
                break;
 
835
 
 
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);
 
841
                    LYaddstr("    ");
 
842
                    *display_option = '\0';
 
843
                }
 
844
                _statusline(ACCEPT_DATA);
 
845
                LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
 
846
                lynx_start_bold();
 
847
                ch = LYgetstr(display_option, VISIBLE,
 
848
                              sizeof(display_option), NORECALL);
 
849
                lynx_stop_bold();
 
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);
 
857
                    LYaddstr("NONE");
 
858
                } else {
 
859
                    StrAllocCopy(personal_mail_address, display_option);
 
860
                    LYaddstr(display_option);
 
861
                }
 
862
                LYclrtoeol();
 
863
                if (ch == -1) {
 
864
                    HTInfoMsg(CANCELLED);
 
865
                    HTInfoMsg("");
 
866
                } else {
 
867
                    _statusline(VALUE_ACCEPTED);
 
868
                }
 
869
                response = ' ';
 
870
                break;
 
871
 
 
872
            case 'S':   /* Change case sensitivity for searches. */
 
873
                case_sensitive = LYChooseBoolean(case_sensitive,
 
874
                                                 L_SSEARCH, -1,
 
875
                                                 caseless_choices);
 
876
                response = ' ';
 
877
                break;
 
878
 
 
879
            case '\001':        /* Change assume_charset setting. */
 
880
                if (use_assume_charset) {
 
881
                    int i, curval;
 
882
                    CONST char ** assume_list;
 
883
                    assume_list = typecallocn(CONST char *,(LYNumCharsets + 1));
 
884
                    if (!assume_list) {
 
885
                        outofmem(__FILE__, "options");
 
886
                    }
 
887
                    for (i = 0; i < LYNumCharsets; i++) {
 
888
                        assume_list[i] = LYCharSet_UC[i].MIMEname;
 
889
                    }
 
890
                    curval = UCLYhndl_for_unspec;
 
891
                    if (curval == current_char_set && UCAssume_MIMEcharset) {
 
892
                        curval = UCGetLYhndl_byMIME(UCAssume_MIMEcharset);
 
893
                    }
 
894
                    if (curval < 0)
 
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)
 
902
                                            ? 1
 
903
                                            : 0];
 
904
#else
 
905
                        UCLYhndl_for_unspec = LYChooseBoolean(curval,
 
906
                                                             L_ASSUME_CHARSET, -1,
 
907
                                                             assume_list);
 
908
#endif
 
909
                    } else {
 
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,
 
915
                                          0, FALSE, FALSE)
 
916
                                          ? 1
 
917
                                          : 0];
 
918
#else
 
919
                        UCLYhndl_for_unspec = LYChoosePopup(curval,
 
920
                                                           L_ASSUME_CHARSET, -1,
 
921
                                                           assume_list,
 
922
                                                           0, FALSE, FALSE);
 
923
#endif
 
924
#if defined(VMS) || defined(USE_SLANG)
 
925
                        LYmove(L_ASSUME_CHARSET, COL_OPTION_VALUES);
 
926
                        LYclrtoeol();
 
927
                        if (UCLYhndl_for_unspec >= 0)
 
928
                            LYaddstr(LYCharSet_UC[UCLYhndl_for_unspec].MIMEname);
 
929
#endif /* VMS || USE_SLANG */
 
930
                    }
 
931
 
 
932
                    /*
 
933
                     *  Set the raw 8-bit or CJK mode defaults and
 
934
                     *  character set if changed. - FM
 
935
                     */
 
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);
 
941
                        }
 
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)
 
949
                        if (!LYSelectPopups)
 
950
#endif /* !VMS && !USE_SLANG */
 
951
                        {
 
952
                            LYmove(L_Rawmode, COL_OPTION_VALUES);
 
953
                            LYclrtoeol();
 
954
                            ShowBool(LYRawMode);
 
955
                        }
 
956
                    }
 
957
                    FREE(assume_list);
 
958
                    response = ' ';
 
959
                    if (LYSelectPopups) {
 
960
                        HANDLE_LYOPTIONS;
 
961
                    }
 
962
                } else {
 
963
                    _statusline(NEED_ADVANCED_USER_MODE);
 
964
                    AddValueAccepted = FALSE;
 
965
                }
 
966
                break;
 
967
 
 
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,
 
972
                                                      L_Charset, -1,
 
973
                                                      display_charset_choices);
 
974
                    current_char_set = display_charset_map[displayed_display_charset_idx];
 
975
#else
 
976
                    current_char_set = LYChooseBoolean(current_char_set,
 
977
                                                      L_Charset, -1,
 
978
                                                      LYchar_set_names);
 
979
#endif
 
980
                } else {
 
981
#ifndef ALL_CHARSETS_IN_O_MENU_SCREEN
 
982
                    displayed_display_charset_idx = LYChoosePopup(displayed_display_charset_idx,
 
983
                                                    L_Charset, -1,
 
984
                                                    display_charset_choices,
 
985
                                                    0, FALSE, FALSE);
 
986
                    current_char_set = display_charset_map[displayed_display_charset_idx];
 
987
#else
 
988
                    current_char_set = LYChoosePopup(current_char_set,
 
989
                                                    L_Charset, -1,
 
990
                                                    LYchar_set_names,
 
991
                                                    0, FALSE, FALSE);
 
992
#endif
 
993
 
 
994
#if defined(VMS) || defined(USE_SLANG)
 
995
                    LYmove(L_Charset, COL_OPTION_VALUES);
 
996
                    LYclrtoeol();
 
997
                    LYaddstr(LYchar_set_names[current_char_set]);
 
998
#endif /* VMS || USE_SLANG */
 
999
                }
 
1000
                /*
 
1001
                 *  Set the raw 8-bit or CJK mode defaults and
 
1002
                 *  character set if changed. - FM
 
1003
                 */
 
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 */
 
1012
                    {
 
1013
                        LYmove(L_Rawmode, COL_OPTION_VALUES);
 
1014
                        LYclrtoeol();
 
1015
                        ShowBool(LYRawMode);
 
1016
                    }
 
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);
 
1022
#endif
 
1023
                }
 
1024
                response = ' ';
 
1025
                if (LYSelectPopups) {
 
1026
                    HANDLE_LYOPTIONS;
 
1027
                }
 
1028
                break;
 
1029
 
 
1030
            case 'O':   /* Change raw mode setting. */
 
1031
                LYRawMode = LYChooseBoolean(LYRawMode, L_Rawmode, -1, bool_choices);
 
1032
                /*
 
1033
                 *  Set the LYUseDefaultRawMode value and character
 
1034
                 *  handling if LYRawMode was changed. - FM
 
1035
                 */
 
1036
                if (CurrentRawMode != LYRawMode) {
 
1037
                    HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
 
1038
                    HTMLSetCharacterHandling(current_char_set);
 
1039
                    CurrentRawMode = LYRawMode;
 
1040
                }
 
1041
                response = ' ';
 
1042
                break;
 
1043
 
 
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);
 
1049
                    LYaddstr("    ");
 
1050
                    *display_option = '\0';
 
1051
                }
 
1052
                _statusline(ACCEPT_DATA);
 
1053
                LYmove(L_LANGUAGE, COL_OPTION_VALUES);
 
1054
                lynx_start_bold();
 
1055
                ch = LYgetstr(display_option, VISIBLE,
 
1056
                              sizeof(display_option), NORECALL);
 
1057
                lynx_stop_bold();
 
1058
                LYmove(L_LANGUAGE, COL_OPTION_VALUES);
 
1059
                if (term_options || ch == -1) {
 
1060
                    LYaddstr((language && *language) ?
 
1061
                                          language : "NONE");
 
1062
                } else if (*display_option == '\0') {
 
1063
                    FREE(language);
 
1064
                    LYaddstr("NONE");
 
1065
                } else {
 
1066
                    StrAllocCopy(language, display_option);
 
1067
                    LYaddstr(display_option);
 
1068
                }
 
1069
                LYclrtoeol();
 
1070
                if (ch == -1) {
 
1071
                    HTInfoMsg(CANCELLED);
 
1072
                    HTInfoMsg("");
 
1073
                } else {
 
1074
                    _statusline(VALUE_ACCEPTED);
 
1075
                }
 
1076
                response = ' ';
 
1077
                break;
 
1078
 
 
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);
 
1084
                    LYaddstr("    ");
 
1085
                    *display_option = '\0';
 
1086
                }
 
1087
                _statusline(ACCEPT_DATA);
 
1088
                LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
 
1089
                lynx_start_bold();
 
1090
                ch = LYgetstr(display_option, VISIBLE,
 
1091
                              sizeof(display_option), NORECALL);
 
1092
                lynx_stop_bold();
 
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') {
 
1098
                    FREE(pref_charset);
 
1099
                    LYaddstr("NONE");
 
1100
                } else {
 
1101
                    StrAllocCopy(pref_charset, display_option);
 
1102
                    LYaddstr(display_option);
 
1103
                }
 
1104
                LYclrtoeol();
 
1105
                if (ch == -1) {
 
1106
                    HTInfoMsg(CANCELLED);
 
1107
                    HTInfoMsg("");
 
1108
                } else {
 
1109
                    _statusline(VALUE_ACCEPTED);
 
1110
                }
 
1111
                response = ' ';
 
1112
                break;
 
1113
 
 
1114
            case 'V':   /* Change VI keys setting. */
 
1115
                vi_keys = LYChooseBoolean(vi_keys,
 
1116
                                         L_Bool_A, C_VIKEYS,
 
1117
                                         bool_choices);
 
1118
                if (vi_keys) {
 
1119
                    set_vi_keys();
 
1120
                } else {
 
1121
                    reset_vi_keys();
 
1122
                }
 
1123
                response = ' ';
 
1124
                break;
 
1125
 
 
1126
            case 'M':   /* Change emacs keys setting. */
 
1127
                emacs_keys = LYChooseBoolean(emacs_keys,
 
1128
                                            L_Bool_A, C_EMACSKEYS,
 
1129
                                            bool_choices);
 
1130
                if (emacs_keys) {
 
1131
                    set_emacs_keys();
 
1132
                } else {
 
1133
                    reset_emacs_keys();
 
1134
                }
 
1135
                response = ' ';
 
1136
                break;
 
1137
 
 
1138
            case 'W':   /* Change show dotfiles setting. */
 
1139
                if (no_dotfiles) {
 
1140
                    _statusline(DOTFILE_ACCESS_DISABLED);
 
1141
                } else {
 
1142
                    show_dotfiles = LYChooseBoolean(show_dotfiles,
 
1143
                                                   L_Bool_A,
 
1144
                                                   C_SHOW_DOTFILES,
 
1145
                                                   bool_choices);
 
1146
                }
 
1147
                response = ' ';
 
1148
                break;
 
1149
 
 
1150
            case 'T':   /* Change select popups setting. */
 
1151
                LYSelectPopups = LYChooseBoolean(LYSelectPopups,
 
1152
                                                L_Bool_B,
 
1153
                                                C_SELECT_POPUPS,
 
1154
                                                bool_choices);
 
1155
                response = ' ';
 
1156
                break;
 
1157
 
 
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");
 
1164
                        if (terminal)
 
1165
                            HTUserMsg2(
 
1166
                                COLOR_TOGGLE_DISABLED_FOR_TERM,
 
1167
                                terminal);
 
1168
                        else
 
1169
                            HTUserMsg(COLOR_TOGGLE_DISABLED);
 
1170
                        break;
 
1171
                    }
 
1172
#endif
 
1173
                    LYShowColor = LYChooseBoolean((LYShowColor - 1),
 
1174
                                                 L_Color,
 
1175
                                                 C_COLOR,
 
1176
                                                 bool_choices);
 
1177
                    if (LYShowColor == 0) {
 
1178
                        LYShowColor = SHOW_COLOR_OFF;
 
1179
                    } else {
 
1180
                        LYShowColor = SHOW_COLOR_ON;
 
1181
                    }
 
1182
                } else {                /* !no_option_save */
 
1183
                    BOOLEAN again = FALSE;
 
1184
                    int chosen;
 
1185
                    /*
 
1186
                     *  Copy strings into choice array.
 
1187
                     */
 
1188
                    choices[0] = NULL;
 
1189
                    StrAllocCopy(choices[0], "NEVER     ");
 
1190
                    choices[1] = NULL;
 
1191
                    StrAllocCopy(choices[1], "OFF       ");
 
1192
                    choices[2] = NULL;
 
1193
                    StrAllocCopy(choices[2], "ON        ");
 
1194
                    choices[3] = NULL;
 
1195
#if defined(COLOR_CURSES)
 
1196
                    if (!has_colors())
 
1197
                        StrAllocCopy(choices[3], "Always try");
 
1198
                    else
 
1199
#endif
 
1200
                        StrAllocCopy(choices[3], "ALWAYS    ");
 
1201
                    choices[4] = NULL;
 
1202
                    do {
 
1203
                        if (!LYSelectPopups) {
 
1204
                            chosen = LYChooseBoolean(LYChosenShowColor,
 
1205
                                                    L_Color,
 
1206
                                                    C_COLOR,
 
1207
                                                    choices);
 
1208
                        } else {
 
1209
                            chosen = LYChoosePopup(LYChosenShowColor,
 
1210
                                                  L_Color,
 
1211
                                                  C_COLOR,
 
1212
                                                  choices, 4, FALSE, FALSE);
 
1213
                        }
 
1214
#if defined(COLOR_CURSES)
 
1215
                        again = (BOOL) (chosen == SHOW_COLOR_ON && !has_colors());
 
1216
                        if (again) {
 
1217
                            char * terminal = LYGetEnv("TERM");
 
1218
                            if (terminal)
 
1219
                                HTUserMsg2(
 
1220
                                    COLOR_TOGGLE_DISABLED_FOR_TERM,
 
1221
                                    terminal);
 
1222
                            else
 
1223
                                HTUserMsg(COLOR_TOGGLE_DISABLED);
 
1224
                        }
 
1225
#endif
 
1226
                    } while (again);
 
1227
                    LYChosenShowColor = chosen;
 
1228
#if defined(VMS)
 
1229
                    if (LYSelectPopups) {
 
1230
                        LYmove(L_Color, C_COLOR);
 
1231
                        LYclrtoeol();
 
1232
                        LYaddstr(choices[LYChosenShowColor]);
 
1233
                    }
 
1234
#endif /* VMS */
 
1235
#if defined(COLOR_CURSES)
 
1236
                    if (has_colors())
 
1237
#endif
 
1238
                        LYShowColor = chosen;
 
1239
                    FREE(choices[0]);
 
1240
                    FREE(choices[1]);
 
1241
                    FREE(choices[2]);
 
1242
                    FREE(choices[3]);
 
1243
                }
 
1244
                if (CurrentShowColor != LYShowColor) {
 
1245
                    lynx_force_repaint();
 
1246
                }
 
1247
                CurrentShowColor = LYShowColor;
 
1248
#ifdef USE_SLANG
 
1249
                SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
 
1250
#endif
 
1251
                response = ' ';
 
1252
                if (LYSelectPopups && !no_option_save) {
 
1253
                    HANDLE_LYOPTIONS;
 
1254
                }
 
1255
                break;
 
1256
#endif /* USE_SLANG or COLOR_CURSES */
 
1257
 
 
1258
            case '@':   /* Change show cursor setting. */
 
1259
                LYShowCursor = LYChooseBoolean(LYShowCursor,
 
1260
                                              L_Bool_B,
 
1261
                                              C_SHOW_CURSOR,
 
1262
                                              bool_choices);
 
1263
                response = ' ';
 
1264
                break;
 
1265
 
 
1266
            case 'K':   /* Change keypad mode. */
 
1267
                if (!LYSelectPopups) {
 
1268
                    keypad_mode = LYChooseBoolean(keypad_mode,
 
1269
                                                 L_Keypad, -1,
 
1270
                                                 keypad_choices);
 
1271
                } else {
 
1272
                    keypad_mode = LYChoosePopup(keypad_mode,
 
1273
                                                L_Keypad, -1,
 
1274
                                                keypad_choices,
 
1275
                                                3, FALSE, FALSE);
 
1276
#if defined(VMS) || defined(USE_SLANG)
 
1277
                    LYmove(L_Keypad, COL_OPTION_VALUES);
 
1278
                    LYclrtoeol();
 
1279
                    LYaddstr(keypad_choices[keypad_mode]);
 
1280
#endif /* VMS || USE_SLANG */
 
1281
                }
 
1282
                if (keypad_mode == NUMBERS_AS_ARROWS) {
 
1283
                    set_numbers_as_arrows();
 
1284
                } else {
 
1285
                    reset_numbers_as_arrows();
 
1286
                }
 
1287
                response = ' ';
 
1288
                if (LYSelectPopups) {
 
1289
                    HANDLE_LYOPTIONS;
 
1290
                }
 
1291
                break;
 
1292
 
 
1293
            case 'N':   /* Change line editor key bindings. */
 
1294
                if (!LYSelectPopups) {
 
1295
                    current_lineedit = LYChooseBoolean(current_lineedit,
 
1296
                                                      L_Lineed, -1,
 
1297
                                                      LYLineeditNames);
 
1298
                } else {
 
1299
                    current_lineedit = LYChoosePopup(current_lineedit,
 
1300
                                                    L_Lineed, -1,
 
1301
                                                    LYLineeditNames,
 
1302
                                                    0, FALSE, FALSE);
 
1303
#if defined(VMS) || defined(USE_SLANG)
 
1304
                    LYmove(L_Lineed, COL_OPTION_VALUES);
 
1305
                    LYclrtoeol();
 
1306
                    LYaddstr(LYLineeditNames[current_lineedit]);
 
1307
#endif /* VMS || USE_SLANG */
 
1308
                }
 
1309
                response = ' ';
 
1310
                if (LYSelectPopups) {
 
1311
                    HANDLE_LYOPTIONS;
 
1312
                }
 
1313
                break;
 
1314
 
 
1315
#ifdef EXP_KEYBOARD_LAYOUT
 
1316
            case 'Y':   /* Change keyboard layout */
 
1317
                if (!LYSelectPopups) {
 
1318
                    current_layout = LYChooseBoolean(current_layout,
 
1319
                                                      L_Layout, -1,
 
1320
                                                      LYKbLayoutNames);
 
1321
                } else {
 
1322
                    current_layout = LYChoosePopup(current_layout,
 
1323
                                                    L_Layout, -1,
 
1324
                                                    LYKbLayoutNames,
 
1325
                                                    0, FALSE, FALSE);
 
1326
#if defined(VMS) || defined(USE_SLANG)
 
1327
                    LYmove(L_Layout, COL_OPTION_VALUES);
 
1328
                    LYclrtoeol();
 
1329
                    LYaddstr(LYKbLayoutNames[current_layout]);
 
1330
#endif /* VMS || USE_SLANG */
 
1331
                }
 
1332
                response = ' ';
 
1333
                if (LYSelectPopups) {
 
1334
                    HANDLE_LYOPTIONS;
 
1335
                }
 
1336
                break;
 
1337
#endif /* EXP_KEYBOARD_LAYOUT */
 
1338
 
 
1339
#ifdef DIRED_SUPPORT
 
1340
            case 'I':   /* Change local directory sorting. */
 
1341
                if (!LYSelectPopups) {
 
1342
                    dir_list_style = LYChooseBoolean(dir_list_style,
 
1343
                                                    L_Dired, -1,
 
1344
                                                    dirList_choices);
 
1345
                } else {
 
1346
                    dir_list_style = LYChoosePopup(dir_list_style,
 
1347
                                                  L_Dired, -1,
 
1348
                                                  dirList_choices,
 
1349
                                                  3, FALSE, FALSE);
 
1350
#if defined(VMS) || defined(USE_SLANG)
 
1351
                    LYmove(L_Dired, COL_OPTION_VALUES);
 
1352
                    LYclrtoeol();
 
1353
                    LYaddstr(dirList_choices[dir_list_style]);
 
1354
#endif /* VMS || USE_SLANG */
 
1355
                }
 
1356
                response = ' ';
 
1357
                if (LYSelectPopups) {
 
1358
                    HANDLE_LYOPTIONS;
 
1359
                }
 
1360
                break;
 
1361
#endif /* DIRED_SUPPORT */
 
1362
 
 
1363
            case 'U':   /* Change user mode. */
 
1364
                if (!LYSelectPopups) {
 
1365
                    user_mode = LYChooseBoolean(user_mode,
 
1366
                                                L_User_Mode, -1,
 
1367
                                                userMode_choices);
 
1368
                    use_assume_charset = (BOOL) (user_mode >= 2);
 
1369
                } else {
 
1370
                    user_mode = LYChoosePopup(user_mode,
 
1371
                                              L_User_Mode, -1,
 
1372
                                              userMode_choices,
 
1373
                                              3, FALSE, FALSE);
 
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);
 
1378
                        LYclrtoeol();
 
1379
                        LYaddstr(userMode_choices[user_mode]);
 
1380
                    }
 
1381
#endif /* VMS || USE_SLANG */
 
1382
                }
 
1383
                if (user_mode == NOVICE_MODE) {
 
1384
                    display_lines = (LYlines - 4);
 
1385
                } else {
 
1386
                    display_lines = LYlines-2;
 
1387
                }
 
1388
                response = ' ';
 
1389
                if (LYSelectPopups) {
 
1390
                    HANDLE_LYOPTIONS;
 
1391
                }
 
1392
                break;
 
1393
 
 
1394
            case '!':
 
1395
                if (!LYSelectPopups) {
 
1396
                    verbose_img = LYChooseBoolean(verbose_img,
 
1397
                                                L_VERBOSE_IMAGES,
 
1398
                                                C_VERBOSE_IMAGES,
 
1399
                                                bool_choices);
 
1400
                } else {
 
1401
                    verbose_img = LYChoosePopup(verbose_img,
 
1402
                                             L_VERBOSE_IMAGES,
 
1403
                                             C_VERBOSE_IMAGES,
 
1404
                                             bool_choices,
 
1405
                                             2, FALSE, FALSE);
 
1406
                }
 
1407
                response = ' ';
 
1408
                if (LYSelectPopups) {
 
1409
                    HANDLE_LYOPTIONS;
 
1410
                }
 
1411
                break;
 
1412
 
 
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);
 
1419
                        LYaddstr("    ");
 
1420
                        *display_option = '\0';
 
1421
                    }
 
1422
                    _statusline(ACCEPT_DATA_OR_DEFAULT);
 
1423
                    LYmove(L_User_Agent, COL_OPTION_VALUES);
 
1424
                    lynx_start_bold();
 
1425
                    ch = LYgetstr(display_option, VISIBLE,
 
1426
                                  sizeof(display_option), NORECALL);
 
1427
                    lynx_stop_bold();
 
1428
                    LYmove(L_User_Agent, COL_OPTION_VALUES);
 
1429
                    if (term_options || ch == -1) {
 
1430
                        LYaddstr((LYUserAgent &&
 
1431
                                *LYUserAgent) ?
 
1432
                                  LYUserAgent : "NONE");
 
1433
                    } else if (*display_option == '\0') {
 
1434
                        StrAllocCopy(LYUserAgent, LYUserAgentDefault);
 
1435
                        LYaddstr((LYUserAgent &&
 
1436
                                *LYUserAgent) ?
 
1437
                                  LYUserAgent : "NONE");
 
1438
                    } else {
 
1439
                        StrAllocCopy(LYUserAgent, display_option);
 
1440
                        LYaddstr(display_option);
 
1441
                    }
 
1442
                    LYclrtoeol();
 
1443
                    if (ch == -1) {
 
1444
                        HTInfoMsg(CANCELLED);
 
1445
                        HTInfoMsg("");
 
1446
                    } else if (!LYCheckUserAgent()) {
 
1447
                        _statusline(UA_PLEASE_USE_LYNX);
 
1448
                    } else {
 
1449
                        _statusline(VALUE_ACCEPTED);
 
1450
                    }
 
1451
                } else { /* disallowed */
 
1452
                    _statusline(UA_CHANGE_DISABLED);
 
1453
                }
 
1454
                response = ' ';
 
1455
                break;
 
1456
 
 
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);
 
1461
                    response = ' ';
 
1462
                    break;
 
1463
                }
 
1464
#ifndef NEVER_ALLOW_REMOTE_EXEC
 
1465
                if (local_exec) {
 
1466
                    itmp = 2;
 
1467
                } else
 
1468
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
 
1469
                {
 
1470
                    if (local_exec_on_local_files) {
 
1471
                        itmp= 1;
 
1472
                    } else {
 
1473
                        itmp = 0;
 
1474
                    }
 
1475
                }
 
1476
                if (!LYSelectPopups) {
 
1477
                    itmp = LYChooseBoolean(itmp,
 
1478
                                          L_Exec, -1,
 
1479
                                          exec_choices);
 
1480
                } else {
 
1481
                    itmp = LYChoosePopup(itmp,
 
1482
                                        L_Exec, -1,
 
1483
                                        exec_choices,
 
1484
                                        0, (exec_frozen ? TRUE : FALSE),
 
1485
                                        FALSE);
 
1486
#if defined(VMS) || defined(USE_SLANG)
 
1487
                    LYmove(L_Exec, COL_OPTION_VALUES);
 
1488
                    LYclrtoeol();
 
1489
                    LYaddstr(exec_choices[itmp]);
 
1490
#endif /* VMS || USE_SLANG */
 
1491
                }
 
1492
                if (!exec_frozen) {
 
1493
                    switch (itmp) {
 
1494
                        case 0:
 
1495
                            local_exec = FALSE;
 
1496
                            local_exec_on_local_files = FALSE;
 
1497
                            break;
 
1498
                        case 1:
 
1499
                            local_exec = FALSE;
 
1500
                            local_exec_on_local_files = TRUE;
 
1501
                            break;
 
1502
#ifndef NEVER_ALLOW_REMOTE_EXEC
 
1503
                        case 2:
 
1504
                            local_exec = TRUE;
 
1505
                            local_exec_on_local_files = FALSE;
 
1506
                            break;
 
1507
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
 
1508
                    } /* end switch */
 
1509
                }
 
1510
                response = ' ';
 
1511
                if (LYSelectPopups) {
 
1512
                    HANDLE_LYOPTIONS;
 
1513
                }
 
1514
                break;
 
1515
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
1516
 
 
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);
 
1523
                    } else {
 
1524
                        HTAlert(OPTIONS_NOT_SAVED);
 
1525
                    }
 
1526
                } else {
 
1527
                    HTInfoMsg(R_TO_RETURN_TO_LYNX);
 
1528
                    /*
 
1529
                     *  Change response so that we don't exit
 
1530
                     *  the options menu.
 
1531
                     */
 
1532
                    response = ' ';
 
1533
                }
 
1534
                break;
 
1535
 
 
1536
            case 'R':   /* Return to document (quit options menu). */
 
1537
                break;
 
1538
 
 
1539
            default:
 
1540
                if (!no_option_save) {
 
1541
                    HTInfoMsg(SAVE_OR_R_TO_RETURN_TO_LYNX);
 
1542
                } else {
 
1543
                    HTInfoMsg(R_TO_RETURN_TO_LYNX);
 
1544
                }
 
1545
        }  /* end switch */
 
1546
    }  /* end while */
 
1547
 
 
1548
    term_options = FALSE;
 
1549
    LYStatusLine = -1;          /* let user_mode have some of the screen */
 
1550
    signal(SIGINT, cleanup_sig);
 
1551
}
 
1552
 
 
1553
PRIVATE int widest_choice ARGS1(
 
1554
        CONST char **,  choices)
 
1555
{
 
1556
    int n, width = 0;
 
1557
    for (n = 0; choices[n] != NULL; ++n) {
 
1558
        int len = strlen(choices[n]);
 
1559
        if (width < len)
 
1560
            width = len;
 
1561
    }
 
1562
    return width;
 
1563
}
 
1564
 
 
1565
PRIVATE void show_choice ARGS2(
 
1566
        CONST char *,   choice,
 
1567
        int,            width)
 
1568
{
 
1569
    int len = strlen(choice);
 
1570
    LYaddstr(choice);
 
1571
    while (len++ < width)
 
1572
        LYaddch(' ');
 
1573
}
 
1574
 
 
1575
/*
 
1576
 *  Take a status code, prompt the user for a new status, and return it.
 
1577
 */
 
1578
PRIVATE int boolean_choice ARGS4(
 
1579
        int,            cur_choice,
 
1580
        int,            line,
 
1581
        int,            column,
 
1582
        CONST char **,  choices)
 
1583
{
 
1584
    int response = 0;
 
1585
    int cmd = 0;
 
1586
    int number = 0;
 
1587
    int col = (column >= 0 ? column : COL_OPTION_VALUES);
 
1588
    int orig_choice = cur_choice;
 
1589
    int width = widest_choice(choices);
 
1590
 
 
1591
    /*
 
1592
     *  Get the number of choices and then make
 
1593
     *  number zero-based.
 
1594
     */
 
1595
    for (number = 0; choices[number] != NULL; number++)
 
1596
        ;  /* empty loop body */
 
1597
    number--;
 
1598
 
 
1599
    /*
 
1600
     *  Update the statusline.
 
1601
     */
 
1602
    _statusline(ANY_KEY_CHANGE_RET_ACCEPT);
 
1603
 
 
1604
    /*
 
1605
     *  Highlight the current choice.
 
1606
     */
 
1607
    LYmove(line, col);
 
1608
    lynx_start_reverse();
 
1609
    show_choice(choices[cur_choice], width);
 
1610
    if (LYShowCursor)
 
1611
        LYmove(line, (col - 1));
 
1612
    LYrefresh();
 
1613
 
 
1614
    /*
 
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.
 
1619
     */
 
1620
    term_options = FALSE;
 
1621
    while (1) {
 
1622
        LYmove(line, col);
 
1623
        if (term_options == FALSE) {
 
1624
            response = LYgetch_single();
 
1625
        }
 
1626
        if (term_options || LYCharIsINTERRUPT_NO_letter(response)) {
 
1627
             /*
 
1628
              *  Control-C or Control-G.
 
1629
              */
 
1630
            response = '\n';
 
1631
            term_options = TRUE;
 
1632
            cur_choice = orig_choice;
 
1633
        }
 
1634
#ifdef VMS
 
1635
        if (HadVMSInterrupt) {
 
1636
            HadVMSInterrupt = FALSE;
 
1637
            response = '\n';
 
1638
            term_options = TRUE;
 
1639
            cur_choice = orig_choice;
 
1640
        }
 
1641
#endif /* VMS */
 
1642
        if ((response != '\n' && response != '\r') &&
 
1643
            (cmd = LKC_TO_LAC(keymap,response)) != LYK_ACTIVATE) {
 
1644
            switch (cmd) {
 
1645
                case LYK_HOME:
 
1646
                    cur_choice = 0;
 
1647
                    break;
 
1648
 
 
1649
                case LYK_END:
 
1650
                    cur_choice = number;
 
1651
                    break;
 
1652
 
 
1653
                case LYK_REFRESH:
 
1654
                    lynx_force_repaint();
 
1655
                    LYrefresh();
 
1656
                    break;
 
1657
 
 
1658
                case LYK_QUIT:
 
1659
                case LYK_ABORT:
 
1660
                case LYK_PREV_DOC:
 
1661
                    cur_choice = orig_choice;
 
1662
                    term_options = TRUE;
 
1663
                    break;
 
1664
 
 
1665
                case LYK_PREV_PAGE:
 
1666
                case LYK_UP_HALF:
 
1667
                case LYK_UP_TWO:
 
1668
                case LYK_PREV_LINK:
 
1669
                case LYK_LPOS_PREV_LINK:
 
1670
                case LYK_FASTBACKW_LINK:
 
1671
                case LYK_UP_LINK:
 
1672
                case LYK_LEFT_LINK:
 
1673
                    if (cur_choice == 0)
 
1674
                        cur_choice = number;  /* go back to end */
 
1675
                    else
 
1676
                        cur_choice--;
 
1677
                    break;
 
1678
 
 
1679
                case LYK_1:
 
1680
                case LYK_2:
 
1681
                case LYK_3:
 
1682
                case LYK_4:
 
1683
                case LYK_5:
 
1684
                case LYK_6:
 
1685
                case LYK_7:
 
1686
                case LYK_8:
 
1687
                case LYK_9:
 
1688
                    if((cmd - LYK_1 + 1) <= number) {
 
1689
                        cur_choice = cmd -LYK_1 + 1;
 
1690
                        break;
 
1691
                    }  /* else fall through! */
 
1692
                default:
 
1693
                    if (cur_choice == number)
 
1694
                        cur_choice = 0;  /* go over the top and around */
 
1695
                    else
 
1696
                        cur_choice++;
 
1697
            }  /* end of switch */
 
1698
            show_choice(choices[cur_choice], width);
 
1699
            if (LYShowCursor)
 
1700
                LYmove(line, (col - 1));
 
1701
            LYrefresh();
 
1702
        } else {
 
1703
            /*
 
1704
             *  Unhighlight choice.
 
1705
             */
 
1706
            LYmove(line, col);
 
1707
            lynx_stop_reverse();
 
1708
            show_choice(choices[cur_choice], width);
 
1709
 
 
1710
            if (term_options) {
 
1711
                term_options = FALSE;
 
1712
                HTInfoMsg(CANCELLED);
 
1713
                HTInfoMsg("");
 
1714
            } else {
 
1715
                _statusline(VALUE_ACCEPTED);
 
1716
            }
 
1717
            return cur_choice;
 
1718
        }
 
1719
    }
 
1720
}
 
1721
#endif /* !NO_OPTION_MENU */
 
1722
 
 
1723
PRIVATE void terminate_options ARGS1(
 
1724
        int,            sig GCC_UNUSED)
 
1725
{
 
1726
    term_options = TRUE;
 
1727
    /*
 
1728
     *  Reassert the AST.
 
1729
     */
 
1730
    signal(SIGINT, terminate_options);
 
1731
#ifdef VMS
 
1732
    /*
 
1733
     *  Refresh the screen to get rid of the "interrupt" message.
 
1734
     */
 
1735
    if (!dump_output_immediately) {
 
1736
        lynx_force_repaint();
 
1737
        LYrefresh();
 
1738
    }
 
1739
#endif /* VMS */
 
1740
}
 
1741
 
 
1742
/*
 
1743
 *  Multi-Bookmark On-Line editing support. - FMG & FM
 
1744
 */
 
1745
PUBLIC void edit_bookmarks NOARGS
 
1746
{
 
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];
 
1753
 
 
1754
    /*
 
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.
 
1759
     */
 
1760
    term_options = FALSE;
 
1761
    signal(SIGINT, terminate_options);
 
1762
 
 
1763
draw_bookmark_list:
 
1764
    /*
 
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
 
1768
     */
 
1769
#if defined(FANCY_CURSES) || defined (USE_SLANG)
 
1770
    if (enable_scrollback) {
 
1771
        LYclear();
 
1772
    } else {
 
1773
        LYerase();
 
1774
    }
 
1775
#else
 
1776
    LYclear();
 
1777
#endif /* FANCY_CURSES || USE_SLANG */
 
1778
    LYmove(0, 5);
 
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);
 
1783
    } else {
 
1784
        LYaddstr(MULTIBOOKMARKS_EHEAD);
 
1785
    }
 
1786
    lynx_stop_h1_color ();
 
1787
 
 
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)));
 
1793
            LYaddstr(" : ");
 
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);
 
1797
            LYaddstr("| ");
 
1798
            if (MBM_A_subbookmark[a]) {
 
1799
                LYaddstr(MBM_A_subbookmark[a]);
 
1800
            }
 
1801
        }
 
1802
    } else {
 
1803
        for (a = 0; a <= MBM_V_MAXFILES; a++) {
 
1804
            LYmove(3 + a, 5);
 
1805
            LYaddch(UCH(LYindex2MBM(a)));
 
1806
            LYaddstr(" : ");
 
1807
            if (MBM_A_subdescript[a])
 
1808
                LYaddstr(MBM_A_subdescript[a]);
 
1809
            LYmove(3 + a, 35);
 
1810
            LYaddstr("| ");
 
1811
            if (MBM_A_subbookmark[a]) {
 
1812
                LYaddstr(MBM_A_subbookmark[a]);
 
1813
            }
 
1814
        }
 
1815
    }
 
1816
 
 
1817
    /*
 
1818
     *  Only needed when we have 2 screens.
 
1819
     */
 
1820
    if (LYlines < MBM_V_MAXFILES + MULTI_OFFSET) {
 
1821
        LYmove((LYlines - 4), 0);
 
1822
        LYaddstr("'");
 
1823
        lynx_start_bold();
 
1824
        LYaddstr("[");
 
1825
        lynx_stop_bold();
 
1826
        LYaddstr("' ");
 
1827
        LYaddstr(PREVIOUS);
 
1828
        LYaddstr(", '");
 
1829
        lynx_start_bold();
 
1830
        LYaddstr("]");
 
1831
        lynx_stop_bold();
 
1832
        LYaddstr("' ");
 
1833
        LYaddstr(NEXT_SCREEN);
 
1834
    }
 
1835
 
 
1836
    LYmove((LYlines - 3), 0);
 
1837
    if (!no_option_save) {
 
1838
        LYaddstr("'");
 
1839
        lynx_start_bold();
 
1840
        LYaddstr(">");
 
1841
        lynx_stop_bold();
 
1842
        LYaddstr("'");
 
1843
        LYaddstr(TO_SAVE_SEGMENT);
 
1844
    }
 
1845
    LYaddstr(OR_SEGMENT);
 
1846
    LYaddstr("'");
 
1847
    lynx_start_bold();
 
1848
    LYaddstr("^G");
 
1849
    lynx_stop_bold();
 
1850
    LYaddstr("'");
 
1851
    LYaddstr(TO_RETURN_SEGMENT);
 
1852
 
 
1853
    while (!term_options &&
 
1854
           !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
 
1855
           !LYCharIsINTERRUPT_NO_letter(response) && response != '>') {
 
1856
 
 
1857
        LYmove((LYlines - 2), 0);
 
1858
        lynx_start_prompt_color ();
 
1859
        LYaddstr(MULTIBOOKMARKS_LETTER);
 
1860
        lynx_stop_prompt_color ();
 
1861
 
 
1862
        LYrefresh();
 
1863
        response = (def_response ? def_response : LYgetch_single());
 
1864
        def_response = 0;
 
1865
 
 
1866
        /*
 
1867
         *  Check for a cancel.
 
1868
         */
 
1869
        if (term_options || LYCharIsINTERRUPT_NO_letter(response) ||
 
1870
            LYisNonAlnumKeyname(response, LYK_PREV_DOC))
 
1871
            continue;
 
1872
 
 
1873
        /*
 
1874
         *  Check for a save.
 
1875
         */
 
1876
        if (response == '>') {
 
1877
            if (!no_option_save) {
 
1878
                HTInfoMsg(SAVING_OPTIONS);
 
1879
                if (save_rc(NULL))
 
1880
                    HTInfoMsg(OPTIONS_SAVED);
 
1881
                else
 
1882
                    HTAlert(OPTIONS_NOT_SAVED);
 
1883
            } else {
 
1884
                HTInfoMsg(R_TO_RETURN_TO_LYNX);
 
1885
                /*
 
1886
                 *  Change response so that we don't exit
 
1887
                 *  the options menu.
 
1888
                 */
 
1889
                response = ' ';
 
1890
            }
 
1891
            continue;
 
1892
        }
 
1893
 
 
1894
        /*
 
1895
         *  Check for a refresh.
 
1896
         */
 
1897
        if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
 
1898
            lynx_force_repaint();
 
1899
            continue;
 
1900
        }
 
1901
 
 
1902
        /*
 
1903
         *  Move between the screens - if we can't show it all at once.
 
1904
         */
 
1905
        if ((response == ']' ||
 
1906
             LYisNonAlnumKeyname(response, LYK_NEXT_PAGE)) &&
 
1907
            LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
 
1908
            MBM_current++;
 
1909
            if (MBM_current >= 3)
 
1910
                MBM_current = 1;
 
1911
            goto draw_bookmark_list;
 
1912
        }
 
1913
        if ((response == '[' ||
 
1914
             LYisNonAlnumKeyname(response, LYK_PREV_PAGE)) &&
 
1915
            LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {
 
1916
            MBM_current--;
 
1917
            if (MBM_current <= 0)
 
1918
                MBM_current = 2;
 
1919
            goto draw_bookmark_list;
 
1920
        }
 
1921
 
 
1922
        /*
 
1923
         *  Instead of using 26 case statements, we set up
 
1924
         *  a scan through the letters and edit the lines
 
1925
         *  that way.
 
1926
         */
 
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)) {
 
1931
                        MBM_current = 2;
 
1932
                        def_response = response;
 
1933
                        goto draw_bookmark_list;
 
1934
                    }
 
1935
                    if (MBM_current == 2 && a < (MBM_V_MAXFILES/2)) {
 
1936
                        MBM_current = 1;
 
1937
                        def_response = response;
 
1938
                        goto draw_bookmark_list;
 
1939
                    }
 
1940
                }
 
1941
                _statusline(ACCEPT_DATA);
 
1942
 
 
1943
                if (a > 0) {
 
1944
                    lynx_start_bold();
 
1945
                    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
 
1946
                        LYmove(
 
1947
                         (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
 
1948
                             9);
 
1949
                    else
 
1950
                        LYmove((3 + a), 9);
 
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);
 
1957
                    lynx_stop_bold();
 
1958
 
 
1959
                    if (strlen(MBM_tmp_line) < 1) {
 
1960
                        FREE(MBM_A_subdescript[a]);
 
1961
                    } else {
 
1962
                        StrAllocCopy(MBM_A_subdescript[a], MBM_tmp_line);
 
1963
                    }
 
1964
                    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
 
1965
                        LYmove(
 
1966
                         (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
 
1967
                             5);
 
1968
                    else
 
1969
                        LYmove((3 + a), 5);
 
1970
                    LYaddch(UCH(LYindex2MBM(a)));
 
1971
                    LYaddstr(" : ");
 
1972
                    if (MBM_A_subdescript[a])
 
1973
                        LYaddstr(MBM_A_subdescript[a]);
 
1974
                    LYclrtoeol();
 
1975
                    LYrefresh();
 
1976
                }
 
1977
 
 
1978
                if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
 
1979
                    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),
 
1980
                         35);
 
1981
                else
 
1982
                    LYmove((3 + a), 35);
 
1983
                LYaddstr("| ");
 
1984
 
 
1985
                lynx_start_bold();
 
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);
 
1991
                lynx_stop_bold();
 
1992
 
 
1993
                if (*MBM_tmp_line == '\0') {
 
1994
                    if (a == 0)
 
1995
                        StrAllocCopy(MBM_A_subbookmark[a], bookmark_page);
 
1996
                    else
 
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);
 
2001
                        LYSleepAlert();
 
2002
                } else {
 
2003
                    StrAllocCopy(MBM_A_subbookmark[a], MBM_tmp_line);
 
2004
                    if (a == 0) {
 
2005
                        StrAllocCopy(bookmark_page, MBM_A_subbookmark[a]);
 
2006
                    }
 
2007
                }
 
2008
                if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))
 
2009
                    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current-1)),
 
2010
                         35);
 
2011
                else
 
2012
                    LYmove((3 + a), 35);
 
2013
                LYaddstr("| ");
 
2014
                if (MBM_A_subbookmark[a])
 
2015
                    LYaddstr(MBM_A_subbookmark[a]);
 
2016
                LYclrtoeol();
 
2017
                LYmove(LYlines-1, 0);
 
2018
                LYclrtoeol();
 
2019
                break;
 
2020
            }
 
2021
        }  /* end for */
 
2022
    } /* end while */
 
2023
 
 
2024
    term_options = FALSE;
 
2025
    signal(SIGINT, cleanup_sig);
 
2026
}
 
2027
 
 
2028
#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES)))
 
2029
 
 
2030
/*
 
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
 
2034
 *
 
2035
 *  Also used for mouse popups with ncurses; this is indicated
 
2036
 *  by for_mouse.
 
2037
 */
 
2038
PUBLIC int popup_choice ARGS7(
 
2039
        int,            cur_choice,
 
2040
        int,            line,
 
2041
        int,            column,
 
2042
        CONST char **,  choices,
 
2043
        int,            i_length,
 
2044
        int,            disabled,
 
2045
        BOOLEAN,        for_mouse)
 
2046
{
 
2047
    if (column < 0)
 
2048
        column = (COL_OPTION_VALUES - 1);
 
2049
 
 
2050
    term_options = FALSE;
 
2051
    cur_choice = LYhandlePopupList(cur_choice,
 
2052
                                   line,
 
2053
                                   column,
 
2054
                                   (CONST char **)choices,
 
2055
                                   -1,
 
2056
                                   i_length,
 
2057
                                   disabled,
 
2058
                                   for_mouse,
 
2059
                                   TRUE);
 
2060
    switch (cur_choice) {
 
2061
    case LYK_QUIT:
 
2062
    case LYK_ABORT:
 
2063
    case LYK_PREV_DOC:
 
2064
        term_options = TRUE;
 
2065
        if (!for_mouse) {
 
2066
            HTUserMsg(CANCELLED);
 
2067
        }
 
2068
        break;
 
2069
    }
 
2070
 
 
2071
    if (disabled || term_options) {
 
2072
        _statusline("");
 
2073
    } else if (!for_mouse) {
 
2074
        _statusline(VALUE_ACCEPTED);
 
2075
    }
 
2076
    return(cur_choice);
 
2077
}
 
2078
 
 
2079
#endif /* !NO_OPTION_MENU */
 
2080
#ifndef NO_OPTION_FORMS
 
2081
 
 
2082
/*
 
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.
 
2086
 */
 
2087
#define SELECTED(flag) (flag) ? selected_string : ""
 
2088
#define DISABLED(flag) (flag) ? disabled_string : ""
 
2089
 
 
2090
typedef struct {
 
2091
    int value;
 
2092
    CONST char *LongName;
 
2093
    CONST char *HtmlName;
 
2094
} OptValues;
 
2095
 
 
2096
typedef struct {
 
2097
    char * tag;
 
2098
    char * value;
 
2099
} PostPair;
 
2100
 
 
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"          },
 
2110
        { 0, 0, 0 }};
 
2111
 
 
2112
static char * secure_string             = "secure";
 
2113
static char * secure_value              = NULL;
 
2114
static char * save_options_string       = "save_options";
 
2115
 
 
2116
/*
 
2117
 * Personal Preferences
 
2118
 */
 
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;
 
2126
 
 
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" },
 
2137
#endif
 
2138
        { 0, 0, 0 }};
 
2139
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
2140
 
 
2141
#ifdef EXP_KEYBOARD_LAYOUT
 
2142
static char * kblayout_string           = RC_KBLAYOUT;
 
2143
#endif
 
2144
static char * keypad_mode_string        = RC_KEYPAD_MODE;
 
2145
static OptValues keypad_mode_values[]   = {
 
2146
        { NUMBERS_AS_ARROWS,  N_("Numbers act as arrows"),
 
2147
                              "number_arrows" },
 
2148
        { LINKS_ARE_NUMBERED, N_("Links are numbered"),
 
2149
                              "links_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"),
 
2155
                              "forms_numbered" },
 
2156
        { 0, 0, 0 }};
 
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" },
 
2163
        { 0, 0, 0 }};
 
2164
 
 
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 },
 
2172
        { 0, 0, 0 }};
 
2173
#endif
 
2174
 
 
2175
static char * show_cursor_string        = RC_SHOW_CURSOR;
 
2176
 
 
2177
static char * underline_links_string    = RC_UNDERLINE_LINKS;
 
2178
 
 
2179
#ifdef USE_SCROLLBAR
 
2180
static char * show_scrollbar_string     = RC_SCROLLBAR;
 
2181
#endif
 
2182
 
 
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 },
 
2190
        { 0, 0, 0 }};
 
2191
 
 
2192
static char * cookie_prompt_string      = RC_FORCE_COOKIE_PROMPT;
 
2193
 
 
2194
#ifdef USE_SSL
 
2195
static char * ssl_prompt_string         = RC_FORCE_SSL_PROMPT;
 
2196
#endif
 
2197
 
 
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" },
 
2203
        { 0, 0, 0 }};
 
2204
 
 
2205
static char * vi_keys_string            = RC_VI_KEYS;
 
2206
 
 
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" },
 
2216
        { 0, 0, 0 }};
 
2217
 
 
2218
/*
 
2219
 * Document Layout
 
2220
 */
 
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" },
 
2226
        { 0, 0, 0 }};
 
2227
 
 
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");
 
2233
 
 
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" },
 
2239
        { 0, 0, 0 }};
 
2240
 
 
2241
/*
 
2242
 * Bookmark Options
 
2243
 */
 
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" },
 
2249
        { 0, 0, 0 }};
 
2250
 
 
2251
static char * single_bookmark_string    = RC_BOOKMARK_FILE;
 
2252
 
 
2253
/*
 
2254
 * Character Set Options
 
2255
 */
 
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;
 
2259
 
 
2260
#ifdef EXP_LOCALE_CHARSET
 
2261
static char * locale_charset_string     = RC_LOCALE_CHARSET;
 
2262
#endif
 
2263
 
 
2264
/*
 
2265
 * File Management Options
 
2266
 */
 
2267
static char * show_dotfiles_string      = RC_SHOW_DOTFILES;
 
2268
 
 
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" },
 
2275
        { 0, 0, 0 }};
 
2276
#ifdef LONG_LIST
 
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" },
 
2284
#ifndef NO_GROUPS
 
2285
        { ORDER_BY_USER,        N_("By User"),          "dired_by_user" },
 
2286
        { ORDER_BY_GROUP,       N_("By Group"),         "dired_by_group" },
 
2287
#endif
 
2288
        { 0, 0, 0 }};
 
2289
#endif /* LONG_LIST */
 
2290
#endif /* DIRED_SUPPORT */
 
2291
 
 
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" },
 
2298
        { 0, 0, 0 }};
 
2299
 
 
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" },
 
2309
#endif
 
2310
        { 0, 0, 0 }};
 
2311
#endif /* USE_READPROGRESS */
 
2312
 
 
2313
/*
 
2314
 * Headers transferred to remote server
 
2315
 */
 
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;
 
2319
 
 
2320
#define PutTextInput(fp, Name, Value, Size, disable) \
 
2321
        fprintf(fp,\
 
2322
        "<input size=%d type=\"text\" name=\"%s\" value=\"%s\" %s>\n",\
 
2323
                (int) Size, Name, Value, disable_all?disabled_string:disable)
 
2324
 
 
2325
#define PutOption(fp, flag, html, name) \
 
2326
        fprintf(fp,"<option value=\"%s\" %s>%s\n", html, SELECTED(flag), gettext(name))
 
2327
 
 
2328
#define BeginSelect(fp, text) \
 
2329
        fprintf(fp,"<select name=\"%s\" %s>\n", text, disable_all?disabled_string:"")
 
2330
 
 
2331
#define MaybeSelect(fp, flag, text) \
 
2332
        fprintf(fp,"<select name=\"%s\" %s>\n", text, disable_all?disabled_string:DISABLED(flag))
 
2333
 
 
2334
#define EndSelect(fp)\
 
2335
        fprintf(fp,"</select>\n")
 
2336
 
 
2337
PRIVATE void PutOptValues ARGS3(
 
2338
        FILE *,         fp,
 
2339
        int,            value,
 
2340
        OptValues *,    table)
 
2341
{
 
2342
    while (table->LongName != 0) {
 
2343
        if (table->HtmlName) {
 
2344
            PutOption(fp,
 
2345
                      value == table->value,
 
2346
                      table->HtmlName,
 
2347
                      table->LongName);
 
2348
        }
 
2349
        table++;
 
2350
    }
 
2351
}
 
2352
 
 
2353
PRIVATE BOOLEAN GetOptValues ARGS3(
 
2354
        OptValues *,    table,
 
2355
        char *,         value,
 
2356
        int *,          result)
 
2357
{
 
2358
    while (table->LongName != 0) {
 
2359
        if (table->HtmlName && !strcmp(value, table->HtmlName)) {
 
2360
            *result = table->value;
 
2361
            return TRUE;
 
2362
        }
 
2363
        table++;
 
2364
    }
 
2365
    return FALSE;
 
2366
}
 
2367
 
 
2368
/*
 
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...
 
2376
 */
 
2377
 
 
2378
PRIVATE PostPair * break_data ARGS1(
 
2379
    bstring *,  data)
 
2380
{
 
2381
    char * p;
 
2382
    PostPair * q = NULL;
 
2383
    int count = 0;
 
2384
 
 
2385
    if (isBEmpty(data))
 
2386
        return NULL;
 
2387
 
 
2388
    p = BStrData(data);
 
2389
    CTRACE((tfp, "break_data %s\n", p));
 
2390
 
 
2391
    q = typecalloc(PostPair);
 
2392
    if (q == NULL)
 
2393
        outofmem(__FILE__, "break_data(calloc)");
 
2394
 
 
2395
    do {
 
2396
        /*
 
2397
         * First, break up on '&', sliding 'p' on down the line.
 
2398
         */
 
2399
        q[count].value = LYstrsep(&p, "&");
 
2400
        /*
 
2401
         * Then break up on '=', sliding value down, and setting tag.
 
2402
         */
 
2403
        q[count].tag = LYstrsep(&(q[count].value), "=");
 
2404
 
 
2405
        /*
 
2406
         * Clean them up a bit, in case user entered a funky string.
 
2407
         */
 
2408
        HTUnEscape(q[count].tag);
 
2409
 
 
2410
        /* In the value field we have '+' instead of ' '. So do a simple
 
2411
         * find&replace on the value field before UnEscaping() - SKY
 
2412
         */
 
2413
        {
 
2414
           size_t i, len;
 
2415
           len = strlen(q[count].value);
 
2416
           for (i = 0; i < len; i++) {
 
2417
                if (q[count].value[i] == '+') {
 
2418
#ifdef UNIX
 
2419
                    /*
 
2420
                     * Allow for special case of options which begin with a "+" on
 
2421
                     * Unix - TD
 
2422
                     */
 
2423
                    if (i > 0
 
2424
                    && q[count].value[i+1] == '+'
 
2425
                    && isalnum(UCH(q[count].value[i+2]))) {
 
2426
                        q[count].value[i++] = ' ';
 
2427
                        i++;
 
2428
                        continue;
 
2429
                    }
 
2430
#endif
 
2431
                    q[count].value[i] = ' ';
 
2432
                }
 
2433
           }
 
2434
        }
 
2435
        HTUnEscape(q[count].value);
 
2436
        CTRACE((tfp, "...item[%d] tag=%s, value=%s\n", count, q[count].tag, q[count].value));
 
2437
 
 
2438
        count++;
 
2439
        /*
 
2440
         * Like I said, screw efficiency.  Sides, realloc is fast on
 
2441
         * Linux ;->
 
2442
         */
 
2443
        q = realloc(q, sizeof(PostPair)*(count+1));
 
2444
        if (q == NULL)
 
2445
            outofmem(__FILE__, "break_data(realloc)");
 
2446
        q[count].tag = NULL;
 
2447
    } while (p != NULL && p[0] != '\0');
 
2448
    return q;
 
2449
}
 
2450
 
 
2451
PRIVATE int gen_options PARAMS((char **newfile));
 
2452
 
 
2453
/*
 
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
 
2456
 * pointer.  MRC
 
2457
 *
 
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...)
 
2461
 *
 
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
 
2467
 *
 
2468
 * Exit status: NULLFILE (reload) or NORMAL (use HText cache).
 
2469
 *
 
2470
 * On exit, got the document which was current before the Options menu:
 
2471
 *
 
2472
 *   (from cache) nothing changed or no visual effect supposed:
 
2473
 *             editor name, e-mail, etc.
 
2474
 *
 
2475
 *   (reload locally) to see the effect of certain changes:
 
2476
 *             display_char_set, assume_charset, etc.
 
2477
 *             (use 'need_reload' flag where necessary).
 
2478
 *
 
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).
 
2483
 */
 
2484
 
 
2485
PUBLIC int postoptions ARGS1(
 
2486
    DocInfo *,          newdoc)
 
2487
{
 
2488
    PostPair *data = 0;
 
2489
    DocAddress WWWDoc;  /* need on exit */
 
2490
    int i;
 
2491
    int code;
 
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;
 
2500
#endif
 
2501
 
 
2502
    /*-------------------------------------------------
 
2503
     * kludge a link from mbm_menu, the URL was:
 
2504
     * "<a href=\"LYNXOPTIONS://MBM_MENU\">Goto multi-bookmark menu</a>\n"
 
2505
     *--------------------------------------------------*/
 
2506
 
 
2507
    if (strstr(newdoc->address, "LYNXOPTIONS://MBM_MENU")) {
 
2508
        FREE(newdoc->post_data);
 
2509
        if (no_bookmark) {
 
2510
           HTAlert(BOOKMARK_CHANGE_DISALLOWED); /* anonymous */
 
2511
           return(NULLFILE);
 
2512
        } else if (dump_output_immediately) {
 
2513
            return(NOT_FOUND);
 
2514
        } else {
 
2515
           edit_bookmarks();
 
2516
           return(NULLFILE);
 
2517
        }
 
2518
    }
 
2519
 
 
2520
    data = break_data(newdoc->post_data);
 
2521
 
 
2522
    if (!data) {
 
2523
        int status;
 
2524
 
 
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);
 
2532
            return(status);
 
2533
        }
 
2534
 
 
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;
 
2542
 
 
2543
        if (!HTLoadAbsolute(&WWWDoc))
 
2544
            return(NOT_FOUND);
 
2545
        LYRegisterUIPage(newdoc->address, UIP_OPTIONS_MENU);
 
2546
#ifdef DIRED_SUPPORT
 
2547
        lynx_edit_mode = FALSE;
 
2548
#endif /* DIRED_SUPPORT */
 
2549
        return(NORMAL);
 
2550
    }
 
2551
 
 
2552
    if (!LYIsUIPage3(HTLoadedDocumentURL(), UIP_OPTIONS_MENU, 0) &&
 
2553
        !LYIsUIPage3(HTLoadedDocumentURL(), UIP_VLINKS, 0)) {
 
2554
        char *buf = NULL;
 
2555
 
 
2556
        /*  We may have been spoofed? */
 
2557
        HTSprintf0(&buf,
 
2558
                   gettext("Use %s to invoke the Options menu!"),
 
2559
                   key_for_func_ext(LYK_OPTIONS, FOR_PANEL));
 
2560
        HTAlert(buf);
 
2561
        FREE(buf);
 
2562
        FREE(data);
 
2563
        return(NOT_FOUND);
 
2564
    }
 
2565
 
 
2566
    for (i = 0; data[i].tag != NULL; i++) {
 
2567
        /*
 
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
 
2572
         */
 
2573
        if (!strcmp(data[i].tag, secure_string)) {
 
2574
            if (!secure_value || strcmp(data[i].value, secure_value)) {
 
2575
                char *buf = NULL;
 
2576
 
 
2577
                /*
 
2578
                 * We probably came from an older instance of the Options
 
2579
                 * page that had been on the history stack. - kw
 
2580
                 */
 
2581
                HTSprintf0(&buf,
 
2582
                           gettext("Use %s to invoke the Options menu!"),
 
2583
                           key_for_func_ext(LYK_OPTIONS, FOR_PANEL));
 
2584
                HTAlert(buf);
 
2585
                FREE(data);
 
2586
                return(NULLFILE);
 
2587
            }
 
2588
            FREE(secure_value);
 
2589
        }
 
2590
 
 
2591
        /* Save options */
 
2592
        if (!strcmp(data[i].tag, save_options_string) && (!no_option_save)) {
 
2593
            save_all = TRUE;
 
2594
        }
 
2595
 
 
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;
 
2606
            }
 
2607
        }
 
2608
 
 
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);
 
2614
        }
 
2615
 
 
2616
        /* Editor: INPUT */
 
2617
        if (!strcmp(data[i].tag, editor_string)) {
 
2618
            FREE(editor);
 
2619
            StrAllocCopy(editor, data[i].value);
 
2620
        }
 
2621
 
 
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) {
 
2626
                set_emacs_keys();
 
2627
            } else {
 
2628
                reset_emacs_keys();
 
2629
            }
 
2630
        }
 
2631
 
 
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);
 
2640
        }
 
2641
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
2642
 
 
2643
        /* Keypad Mode: SELECT */
 
2644
        if (!strcmp(data[i].tag, keypad_mode_string)) {
 
2645
            int newval;
 
2646
            if (GetOptValues(keypad_mode_values, data[i].value, &newval)
 
2647
                 && keypad_mode != newval) {
 
2648
                keypad_mode = newval;
 
2649
                need_reload = TRUE;
 
2650
                if (keypad_mode == NUMBERS_AS_ARROWS) {
 
2651
                    set_numbers_as_arrows();
 
2652
                } else {
 
2653
                    reset_numbers_as_arrows();
 
2654
                }
 
2655
            }
 
2656
        }
 
2657
 
 
2658
        /* Line edit style: SELECT */
 
2659
        if (!strcmp(data[i].tag, lineedit_mode_string)) {
 
2660
            int newval = atoi(data[i].value);
 
2661
            int j;
 
2662
            /* prevent spoofing attempt */
 
2663
            for (j = 0; LYLineeditNames[j]; j++) {
 
2664
                if (j==newval)  current_lineedit = newval;
 
2665
            }
 
2666
        }
 
2667
 
 
2668
#ifdef EXP_KEYBOARD_LAYOUT
 
2669
        /* Keyboard layout: SELECT */
 
2670
        if (!strcmp(data[i].tag, kblayout_string)) {
 
2671
            int newval = atoi(data[i].value);
 
2672
            int j;
 
2673
            /* prevent spoofing attempt */
 
2674
            for (j = 0; LYKbLayoutNames[j]; j++) {
 
2675
                if (j==newval)  current_layout = newval;
 
2676
            }
 
2677
        }
 
2678
#endif /* EXP_KEYBOARD_LAYOUT */
 
2679
 
 
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);
 
2684
        }
 
2685
 
 
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;
 
2690
        }
 
2691
 
 
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) {
 
2696
                Old_DTD = code;
 
2697
                HTSwitchDTD(!Old_DTD);
 
2698
                need_reload = TRUE;
 
2699
            }
 
2700
        }
 
2701
 
 
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;
 
2706
        }
 
2707
 
 
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)) {
 
2713
            if (can_do_colors)
 
2714
                LYShowColor = LYChosenShowColor;
 
2715
            if (CurrentShowColor != LYShowColor) {
 
2716
                lynx_force_repaint();
 
2717
            }
 
2718
            CurrentShowColor = LYShowColor;
 
2719
#ifdef USE_SLANG
 
2720
            SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
 
2721
#endif
 
2722
        }
 
2723
#endif /* USE_SLANG || COLOR_CURSES */
 
2724
 
 
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;
 
2729
        }
 
2730
 
 
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;
 
2735
        }
 
2736
 
 
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;
 
2742
        }
 
2743
#endif
 
2744
 
 
2745
        /* Cookie Prompting: SELECT */
 
2746
        if (!strcmp(data[i].tag, cookie_prompt_string))
 
2747
            GetOptValues(prompt_values, data[i].value, &cookie_noprompt);
 
2748
 
 
2749
#ifdef USE_SSL
 
2750
        /* SSL Prompting: SELECT */
 
2751
        if (!strcmp(data[i].tag, ssl_prompt_string))
 
2752
            GetOptValues(prompt_values, data[i].value, &ssl_noprompt);
 
2753
#endif
 
2754
 
 
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);
 
2760
            } else {
 
2761
                display_lines = LYlines-2;
 
2762
            }
 
2763
        }
 
2764
 
 
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);
 
2768
 
 
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;
 
2775
                need_reload = TRUE;
 
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;
 
2780
                need_reload = TRUE;
 
2781
            } else if (!strcmp(data[i].value, images_use_links_string)
 
2782
                        && !(clickable_images == TRUE)) {
 
2783
                clickable_images = TRUE;
 
2784
                need_reload = TRUE;
 
2785
            }
 
2786
        }
 
2787
 
 
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;
 
2793
                need_reload = TRUE;
 
2794
            }
 
2795
        }
 
2796
 
 
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) {
 
2801
                set_vi_keys();
 
2802
            } else {
 
2803
                reset_vi_keys();
 
2804
            }
 
2805
        }
 
2806
 
 
2807
        /* Bookmarks File Menu: SELECT */
 
2808
        if (!strcmp(data[i].tag, mbm_string) && (!LYMBMBlocked)) {
 
2809
            GetOptValues(mbm_values, data[i].value, &LYMultiBookmarks);
 
2810
        }
 
2811
 
 
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);
 
2817
            }
 
2818
        }
 
2819
 
 
2820
        /* Assume Character Set: SELECT */
 
2821
        if (!strcmp(data[i].tag, assume_char_set_string)) {
 
2822
            int newval = UCGetLYhndl_byMIME(data[i].value);
 
2823
 
 
2824
            if (newval >= 0
 
2825
             && ((raw_mode_old &&
 
2826
                     newval != safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset))
 
2827
              || (!raw_mode_old &&
 
2828
                     newval != UCLYhndl_for_unspec)
 
2829
                )) {
 
2830
 
 
2831
                UCLYhndl_for_unspec = newval;
 
2832
                StrAllocCopy(UCAssume_MIMEcharset, data[i].value);
 
2833
                assume_char_set_changed = TRUE;
 
2834
            }
 
2835
        }
 
2836
 
 
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;
 
2842
        }
 
2843
#endif
 
2844
 
 
2845
        /* Display Character Set: SELECT */
 
2846
        if (!strcmp(data[i].tag, display_char_set_string)) {
 
2847
            int newval = atoi(data[i].value);
 
2848
            int j;
 
2849
            /* prevent spoofing attempt */
 
2850
            for (j = 0; LYchar_set_names[j]; j++) {
 
2851
                if (j==newval)  current_char_set = newval;
 
2852
            }
 
2853
        }
 
2854
 
 
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;
 
2859
        }
 
2860
 
 
2861
        /*
 
2862
         * ftp sort: SELECT
 
2863
         */
 
2864
        if (!strcmp(data[i].tag, ftp_sort_string)) {
 
2865
            GetOptValues(ftp_sort_values, data[i].value, &HTfileSortMethod);
 
2866
        }
 
2867
 
 
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);
 
2872
        }
 
2873
#ifdef LONG_LIST
 
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);
 
2877
        }
 
2878
#endif /* LONG_LIST */
 
2879
#endif /* DIRED_SUPPORT */
 
2880
 
 
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;
 
2885
        }
 
2886
 
 
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;
 
2892
        }
 
2893
#endif /* USE_READPROGRESS */
 
2894
 
 
2895
        /* Preferred Document Character Set: INPUT */
 
2896
        if (!strcmp(data[i].tag, preferred_doc_char_string)) {
 
2897
            if (strcmp(pref_charset, data[i].value)) {
 
2898
                FREE(pref_charset);
 
2899
                StrAllocCopy(pref_charset, data[i].value);
 
2900
                need_end_reload = TRUE;
 
2901
           }
 
2902
        }
 
2903
 
 
2904
        /* Preferred Document Language: INPUT */
 
2905
        if (!strcmp(data[i].tag, preferred_doc_lang_string)) {
 
2906
            if (strcmp(language, data[i].value)) {
 
2907
                FREE(language);
 
2908
                StrAllocCopy(language, data[i].value);
 
2909
                need_end_reload = TRUE;
 
2910
            }
 
2911
        }
 
2912
 
 
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;
 
2917
                FREE(LYUserAgent);
 
2918
                /* ignore Copyright warning ? */
 
2919
                StrAllocCopy(LYUserAgent,
 
2920
                   *(data[i].value)
 
2921
                   ? data[i].value
 
2922
                   : LYUserAgentDefault);
 
2923
                if (!LYCheckUserAgent()) {
 
2924
                    HTAlert(UA_PLEASE_USE_LYNX);
 
2925
                }
 
2926
            }
 
2927
        }
 
2928
    } /* end of loop */
 
2929
 
 
2930
    /*
 
2931
     * Process the flags:
 
2932
     */
 
2933
#ifdef EXP_LOCALE_CHARSET
 
2934
    LYFindLocaleCharset();
 
2935
#endif
 
2936
    if ( display_char_set_old != current_char_set ||
 
2937
         raw_mode_old != LYRawMode ||
 
2938
         assume_char_set_changed ) {
 
2939
        /*
 
2940
         * charset settings: the order is essential here.
 
2941
         */
 
2942
        if (display_char_set_old != current_char_set) {
 
2943
            /*
 
2944
             *  Set the LYUseDefaultRawMode value and character
 
2945
             *  handling if LYRawMode was changed. - FM
 
2946
             */
 
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);
 
2954
#endif
 
2955
        }
 
2956
        if (assume_char_set_changed && HTCJK != JAPANESE) {
 
2957
            LYRawMode = (BOOL) (UCLYhndl_for_unspec == current_char_set);
 
2958
        }
 
2959
        if (raw_mode_old != LYRawMode || assume_char_set_changed) {
 
2960
            /*
 
2961
             *  Set the raw 8-bit or CJK mode defaults and
 
2962
             *  character set if changed. - FM
 
2963
             */
 
2964
            HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
 
2965
            HTMLSetCharacterHandling(current_char_set);
 
2966
        }
 
2967
        need_reload = TRUE;
 
2968
    } /* end of charset settings */
 
2969
 
 
2970
    /*
 
2971
     * FIXME: Golly gee, we need to write all of this out now, don't we?
 
2972
     */
 
2973
    BStrFree(newdoc->post_data);
 
2974
    FREE(data);
 
2975
    if (save_all) {
 
2976
        HTInfoMsg(SAVING_OPTIONS);
 
2977
        LYrcShowColor = LYChosenShowColor;
 
2978
        if (save_rc(NULL)) {
 
2979
            HTInfoMsg(OPTIONS_SAVED);
 
2980
        } else {
 
2981
            HTAlert(OPTIONS_NOT_SAVED);
 
2982
        }
 
2983
    }
 
2984
 
 
2985
    /*
 
2986
     *  Exit: working around the previous document.
 
2987
     *  Being out of mainloop()/getfile() cycle, do things manually.
 
2988
     */
 
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"));
 
2994
 
 
2995
    /*  Options menu was pushed before postoptions(), so pop-up. */
 
2996
    LYpop(newdoc);
 
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; /* ! */
 
3005
    /*
 
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).
 
3009
     *
 
3010
     * Probably *no_cache was set in a wrong position because of
 
3011
     * the internal page...
 
3012
     */
 
3013
    if (!HTLoadAbsolute(&WWWDoc))
 
3014
        return(NOT_FOUND);
 
3015
 
 
3016
    HTuncache_current_document(); /* will never use again */
 
3017
 
 
3018
    /*
 
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!):
 
3022
     */
 
3023
    LYpop(newdoc);
 
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 */
 
3032
    /*
 
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
 
3037
     * memory".
 
3038
     */
 
3039
    if (!HTLoadAbsolute(&WWWDoc))
 
3040
        return(NOT_FOUND);
 
3041
 
 
3042
    /*
 
3043
     * Now most interesting part: reload document when necessary.
 
3044
     * **********************************************************
 
3045
     */
 
3046
 
 
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):
 
3051
     */
 
3052
    if ((need_end_reload == TRUE &&
 
3053
         (strncmp(newdoc->address, "http", 4) == 0 ||
 
3054
          isLYNXCGI(newdoc->address) == 0))) {
 
3055
        /*
 
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
 
3065
         */
 
3066
        reloading = TRUE;  /* global flag */
 
3067
        need_reload = TRUE;  /* this was probably already TRUE, don't worry */
 
3068
    }
 
3069
 
 
3070
    if (need_reload == FALSE) {
 
3071
        /*  no uncache, already loaded */
 
3072
        CTRACE((tfp, "LYOptions.c/postoptions(): now really exit.\n\n"));
 
3073
        return(NORMAL);
 
3074
    } else {
 
3075
        /*  update HText cache */
 
3076
 
 
3077
        /*
 
3078
         *  see LYK_RELOAD & LYK_OPTIONS in mainloop for details...
 
3079
         */
 
3080
        if (HTisDocumentSource()) {
 
3081
            srcmode_for_next_retrieval(1);
 
3082
        }
 
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"));
 
3090
                return(NORMAL);
 
3091
            }
 
3092
        }
 
3093
#endif
 
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);
 
3099
            }
 
3100
            return(NORMAL);
 
3101
        }
 
3102
 
 
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"));
 
3108
        return(NULLFILE);
 
3109
    }
 
3110
 
 
3111
    /******** Done! **************************************************/
 
3112
}
 
3113
 
 
3114
PRIVATE char *NewSecureValue NOARGS
 
3115
{
 
3116
    FREE(secure_value);
 
3117
    if ((secure_value = malloc(80)) != 0) {
 
3118
#if defined(RAND_MAX)
 
3119
        long key = lynx_rand();
 
3120
#else
 
3121
        long key = (long)secure_value + (long)time(0);
 
3122
#endif
 
3123
        sprintf(secure_value, "%ld", key);
 
3124
        return secure_value;
 
3125
    }
 
3126
    return "?";
 
3127
}
 
3128
 
 
3129
#define LABEL_LEN 33
 
3130
 
 
3131
/*
 
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.
 
3134
 */
 
3135
PRIVATE void PutLabel ARGS3(
 
3136
        FILE *,         fp,
 
3137
        char *,         name,
 
3138
        char *,         value)
 
3139
{
 
3140
    if (will_save_rc(value) && !no_option_save) {
 
3141
        fprintf(fp, "  %-*s: ", LABEL_LEN, name);
 
3142
    } else {
 
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, "(!)");
 
3148
    }
 
3149
}
 
3150
 
 
3151
/*
 
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.
 
3156
 */
 
3157
PRIVATE char *check_if_write_lynxrc ARGS1(char **, table)
 
3158
{
 
3159
    int n;
 
3160
    char *result = NULL;
 
3161
 
 
3162
    for (n = 0; table[n] != 0; ++n) {
 
3163
        result = table[n];
 
3164
        if (!will_save_rc(result))
 
3165
            break;
 
3166
    }
 
3167
    return result;
 
3168
}
 
3169
 
 
3170
/*
 
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. 
 
3174
 */
 
3175
PRIVATE char *will_save_cookies NOARGS
 
3176
{
 
3177
    static char *table[] = {
 
3178
        RC_SET_COOKIES,                 /* LYSetCookies */
 
3179
        RC_ACCEPT_ALL_COOKIES,          /* LYAcceptAllCookies */
 
3180
        NULL
 
3181
    };
 
3182
    return check_if_write_lynxrc(table);
 
3183
}
 
3184
 
 
3185
/*
 
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. 
 
3189
 */
 
3190
PRIVATE char *will_save_images NOARGS
 
3191
{
 
3192
    static char *table[] = {
 
3193
        RC_MAKE_PSEUDO_ALTS_FOR_INLINES, /* pseudo_inline_alts */
 
3194
        RC_MAKE_LINKS_FOR_ALL_IMAGES,   /* clickable_images */
 
3195
        NULL
 
3196
    };
 
3197
    return check_if_write_lynxrc(table);
 
3198
}
 
3199
 
 
3200
/*
 
3201
 * The visited-links menu is used from the visited-links page as well as the
 
3202
 * options page.
 
3203
 */
 
3204
PUBLIC void LYMenuVisitedLinks ARGS2(
 
3205
        FILE *,         fp0,
 
3206
        int,            disable_all)
 
3207
{
 
3208
    BeginSelect(fp0, visited_links_string);
 
3209
    PutOptValues(fp0, Visited_Links_As, visited_links_values);
 
3210
    EndSelect(fp0);
 
3211
}
 
3212
 
 
3213
/*
 
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
 
3220
 *
 
3221
 * This function is synchronized with postoptions().  Read the comments in
 
3222
 * postoptions() header if you change something in gen_options().
 
3223
 */
 
3224
PRIVATE int gen_options ARGS1(
 
3225
        char **,        newfile)
 
3226
{
 
3227
    int i;
 
3228
    static char tempfile[LY_MAXPATH] = "\0";
 
3229
    BOOLEAN disable_all = FALSE;
 
3230
    FILE *fp0;
 
3231
    size_t cset_len = 0;
 
3232
    size_t text_len = LYscreenWidth() > 45 ? LYscreenWidth() - 38 : 7;  /* cf: PutLabel */
 
3233
 
 
3234
    if ((fp0 = InternalPageFP(tempfile, TRUE)) == 0)
 
3235
        return(NOT_FOUND);
 
3236
 
 
3237
    LYLocalFileToURL(newfile, tempfile);
 
3238
 
 
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;
 
3251
 
 
3252
    /*
 
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
 
3255
     */
 
3256
#ifndef NO_OPTION_MENU
 
3257
    if (!LYUseFormsOptions)
 
3258
        disable_all = TRUE;
 
3259
#endif
 
3260
 
 
3261
    BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */
 
3262
 
 
3263
    /*
 
3264
     * I do C, not HTML.  Feel free to pretty this up.
 
3265
     */
 
3266
    fprintf(fp0, "<form action=\"%s\" method=\"post\">\n", STR_LYNXOPTIONS);
 
3267
    /*
 
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.
 
3271
     */
 
3272
    fprintf(fp0, "<input name=\"%s\" type=\"hidden\" value=\"%s\">\n",
 
3273
                 secure_string, NewSecureValue());
 
3274
 
 
3275
    /*
 
3276
     * visible text begins here
 
3277
     */
 
3278
 
 
3279
    /* Submit/Reset/Help */
 
3280
    fprintf(fp0,"<p align=center>\n");
 
3281
    if (!disable_all) {
 
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);
 
3285
    }
 
3286
    fprintf(fp0, "<a href=\"%s%s\">%s</a>\n",
 
3287
                 helpfilepath, OPTIONS_HELP, TO_HELP);
 
3288
 
 
3289
    /* Save options */
 
3290
    if (!no_option_save) {
 
3291
        if (!disable_all) {
 
3292
            fprintf(fp0, "<p align=center>%s: ", SAVE_OPTIONS);
 
3293
            fprintf(fp0, "<input type=\"checkbox\" name=\"%s\">\n",
 
3294
                         save_options_string);
 
3295
        }
 
3296
        fprintf(fp0, "<br>%s\n",
 
3297
                        gettext("(options marked with (!) will not be saved)"));
 
3298
    }
 
3299
 
 
3300
    /*
 
3301
     * preformatted text follows
 
3302
     */
 
3303
    fprintf(fp0,"<pre>\n");
 
3304
 
 
3305
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("General Preferences"));
 
3306
    /*****************************************************************/
 
3307
 
 
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);
 
3312
    EndSelect(fp0);
 
3313
 
 
3314
    /* Editor: INPUT */
 
3315
    PutLabel(fp0, gettext("Editor"), editor_string);
 
3316
    PutTextInput(fp0, editor_string, NonNull(editor), text_len,
 
3317
                      DISABLED(no_editor || system_editor));
 
3318
 
 
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);
 
3323
    EndSelect(fp0);
 
3324
 
 
3325
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Security and Privacy"));
 
3326
    /*****************************************************************/
 
3327
 
 
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);
 
3340
    EndSelect(fp0);
 
3341
 
 
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);
 
3346
    EndSelect(fp0);
 
3347
 
 
3348
#ifdef USE_SSL
 
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);
 
3353
    EndSelect(fp0);
 
3354
#endif
 
3355
 
 
3356
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Keyboard Input"));
 
3357
    /*****************************************************************/
 
3358
 
 
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);
 
3363
    EndSelect(fp0);
 
3364
 
 
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);
 
3369
    EndSelect(fp0);
 
3370
 
 
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);
 
3375
    EndSelect(fp0);
 
3376
 
 
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++) {
 
3382
            char temp[16];
 
3383
            sprintf(temp, "%d", i);
 
3384
            PutOption(fp0, i==current_lineedit, temp, LYLineeditNames[i]);
 
3385
        }
 
3386
        EndSelect(fp0);
 
3387
    }
 
3388
 
 
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++) {
 
3394
        char temp[16];
 
3395
        sprintf(temp, "%d", i);
 
3396
        PutOption(fp0, i == current_layout, temp, LYKbLayoutNames[i]);
 
3397
    }
 
3398
    EndSelect(fp0);
 
3399
#endif /* EXP_KEYBOARD_LAYOUT */
 
3400
 
 
3401
    /*
 
3402
     * Display and Character Set
 
3403
     */
 
3404
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Display and Character Set"));
 
3405
    /*****************************************************************/
 
3406
 
 
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);
 
3412
    EndSelect(fp0);
 
3413
#else
 
3414
#define LYLocaleCharset FALSE
 
3415
#endif
 
3416
 
 
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++) {
 
3421
        char temp[10];
 
3422
        size_t len = strlen(LYchar_set_names[i]);
 
3423
        if (len > cset_len)
 
3424
            cset_len = len;
 
3425
        sprintf(temp, "%d", i);
 
3426
#ifdef EXP_CHARSET_CHOICE
 
3427
        if (!charset_subsets[i].hide_display)
 
3428
#endif
 
3429
        PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]);
 
3430
    }
 
3431
    EndSelect(fp0);
 
3432
 
 
3433
    /* Assume Character Set: SELECT */
 
3434
    {
 
3435
        int curval;
 
3436
        curval = UCLYhndl_for_unspec;
 
3437
 
 
3438
        /*
 
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
 
3442
         */
 
3443
        if (curval == current_char_set) {
 
3444
                /* ok, LYRawMode, so use UCAssume_MIMEcharset */
 
3445
            curval = safeUCGetLYhndl_byMIME(UCAssume_MIMEcharset);
 
3446
        }
 
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)
 
3452
#endif
 
3453
            PutOption(fp0, i == curval,
 
3454
                           LYCharSet_UC[i].MIMEname,
 
3455
                           LYCharSet_UC[i].MIMEname);
 
3456
        }
 
3457
        EndSelect(fp0);
 
3458
    }
 
3459
 
 
3460
    /* Raw Mode: ON/OFF */
 
3461
    if (LYHaveCJKCharacterSet) {
 
3462
        /*
 
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.
 
3466
         */
 
3467
        PutLabel(fp0, gettext("CJK mode"), raw_mode_string);
 
3468
    } else {
 
3469
        PutLabel(fp0, gettext("Raw 8-bit"), raw_mode_string);
 
3470
    }
 
3471
 
 
3472
    BeginSelect(fp0, raw_mode_string);
 
3473
    PutOptValues(fp0, LYRawMode, bool_values);
 
3474
    EndSelect(fp0);
 
3475
 
 
3476
    /* X Display: INPUT */
 
3477
    PutLabel(fp0, gettext("X Display"), x_display_string);
 
3478
    PutTextInput(fp0, x_display_string, NonNull(x_display), text_len, "");
 
3479
 
 
3480
    /*
 
3481
     * Document Appearance
 
3482
     */
 
3483
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Document Appearance"));
 
3484
    /*****************************************************************/
 
3485
 
 
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;
 
3496
        }
 
3497
        PutOptValues(fp0, LYShowColor - SHOW_COLOR_OFF, bool_values);
 
3498
    } else {
 
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;
 
3503
        } else {
 
3504
           show_color_values[2].HtmlName = NULL; /* suppress "ON" - kw */
 
3505
           show_color_values[3].LongName = "Always try";
 
3506
        }
 
3507
        PutOptValues(fp0, LYChosenShowColor, show_color_values);
 
3508
    }
 
3509
    EndSelect(fp0);
 
3510
#endif /* USE_SLANG || COLOR_CURSES */
 
3511
 
 
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);
 
3516
    EndSelect(fp0);
 
3517
 
 
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);
 
3522
    EndSelect(fp0);
 
3523
 
 
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);
 
3529
    EndSelect(fp0);
 
3530
#endif
 
3531
 
 
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);
 
3536
    EndSelect(fp0);
 
3537
 
 
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);
 
3542
    EndSelect(fp0);
 
3543
 
 
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);
 
3556
    EndSelect(fp0);
 
3557
 
 
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);
 
3562
    EndSelect(fp0);
 
3563
 
 
3564
    /*
 
3565
     * Headers Transferred to Remote Servers
 
3566
     */
 
3567
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Headers Transferred to Remote Servers"));
 
3568
    /*****************************************************************/
 
3569
 
 
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, "");
 
3574
 
 
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, "");
 
3579
 
 
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, "");
 
3584
 
 
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, "");
 
3590
    }
 
3591
 
 
3592
    /*
 
3593
     * Listing and Accessing Files
 
3594
     */
 
3595
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Listing and Accessing Files"));
 
3596
    /*****************************************************************/
 
3597
 
 
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);
 
3602
    EndSelect(fp0);
 
3603
 
 
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);
 
3609
    EndSelect(fp0);
 
3610
#ifdef LONG_LIST
 
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);
 
3615
    EndSelect(fp0);
 
3616
#endif /* LONG_LIST */
 
3617
#endif /* DIRED_SUPPORT */
 
3618
 
 
3619
    /* Show dot files: ON/OFF */
 
3620
    if (!no_dotfiles) {
 
3621
        PutLabel(fp0, gettext("Show dot files"), show_dotfiles_string);
 
3622
        BeginSelect(fp0, show_dotfiles_string);
 
3623
        PutOptValues(fp0, show_dotfiles, bool_values);
 
3624
        EndSelect(fp0);
 
3625
    }
 
3626
 
 
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
 
3633
                      ? EXEC_ALWAYS
 
3634
                      : (local_exec_on_local_files
 
3635
                          ? EXEC_LOCAL
 
3636
                          : EXEC_NEVER),
 
3637
                      exec_links_values);
 
3638
#else
 
3639
    PutOptValues(fp0, local_exec_on_local_files
 
3640
                      ? EXEC_LOCAL
 
3641
                      : EXEC_NEVER,
 
3642
                      exec_links_values);
 
3643
#endif /* !NEVER_ALLOW_REMOTE_EXEC */
 
3644
    EndSelect(fp0);
 
3645
#endif /* ENABLE_OPTS_CHANGE_EXEC */
 
3646
 
 
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));
 
3656
        PutOption(fp0,
 
3657
                  LYTransferRate == rate_values[i].value,
 
3658
                  rate_values[i].HtmlName,
 
3659
                  message);
 
3660
        FREE(message);
 
3661
    }
 
3662
    EndSelect(fp0);
 
3663
#endif /* USE_READPROGRESS */
 
3664
 
 
3665
    /*
 
3666
     * Special Files and Screens
 
3667
     */
 
3668
    fprintf(fp0,"\n  <em>%s</em>\n", gettext("Special Files and Screens"));
 
3669
    /*****************************************************************/
 
3670
 
 
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);
 
3676
        EndSelect(fp0);
 
3677
    }
 
3678
 
 
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"));
 
3684
    } else {
 
3685
        PutLabel(fp0, gettext("Bookmarks file"), single_bookmark_string);
 
3686
        PutTextInput(fp0, single_bookmark_string,
 
3687
                         NonNull(bookmark_page), text_len, "");
 
3688
    }
 
3689
 
 
3690
    /* Visited Pages: SELECT */
 
3691
    PutLabel(fp0, gettext("Visited Pages"), visited_links_string);
 
3692
    LYMenuVisitedLinks(fp0, disable_all);
 
3693
 
 
3694
    if (!no_lynxcfg_info) {
 
3695
        fprintf(fp0, "\n  %s<a href=\"%s\">lynx.cfg</a>.\n",
 
3696
                     gettext("View the file "),
 
3697
                     STR_LYNXCFG);
 
3698
    }
 
3699
 
 
3700
    fprintf(fp0,"\n</pre>\n");
 
3701
 
 
3702
    /* Submit/Reset */
 
3703
    if (!disable_all) {
 
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);
 
3708
    }
 
3709
 
 
3710
    /*
 
3711
     * close HTML
 
3712
     */
 
3713
    fprintf(fp0,"</form>\n");
 
3714
    EndInternalPage(fp0);
 
3715
 
 
3716
    LYCloseTempFP(fp0);
 
3717
    return(NORMAL);
 
3718
}
 
3719
#endif /* !NO_OPTION_FORMS */