"Fossies" - the Fresh Open Source Software Archive

Member "links-1.03/menu.c" (16 Nov 2011, 45834 Bytes) of archive /linux/www/links-1.03.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "menu.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.8_vs_1.03.

    1 #include "links.h"
    2 
    3 /*static inline struct session *get_term_session(struct terminal *term)
    4 {
    5     if ((void *)term->windows.prev == &term->windows) {
    6         internal("terminal has no windows");
    7         return NULL;
    8     }
    9     return ((struct window *)term->windows.prev)->data;
   10 }*/
   11 
   12 void menu_about(struct terminal *term, void *d, struct session *ses)
   13 {
   14     msg_box(term, NULL, TEXT_(T_ABOUT), AL_CENTER, TEXT_(T_LINKS__LYNX_LIKE), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
   15 }
   16 
   17 void menu_keys(struct terminal *term, void *d, struct session *ses)
   18 {
   19     msg_box(term, NULL, TEXT_(T_KEYS), AL_LEFT, TEXT_(T_KEYS_DESC), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
   20 }
   21 
   22 void menu_copying(struct terminal *term, void *d, struct session *ses)
   23 {
   24     msg_box(term, NULL, TEXT_(T_COPYING), AL_CENTER, TEXT_(T_COPYING_DESC), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
   25 }
   26 
   27 void menu_manual(struct terminal *term, void *d, struct session *ses)
   28 {
   29     goto_url(ses, LINKS_MANUAL_URL);
   30 }
   31 
   32 void menu_for_frame(struct terminal *term, void (*f)(struct session *, struct f_data_c *, int), struct session *ses)
   33 {
   34     do_for_frame(ses, f, 0);
   35 }
   36 
   37 void menu_goto_url(struct terminal *term, void *d, struct session *ses)
   38 {
   39     dialog_goto_url(ses, "");
   40 }
   41 
   42 void menu_save_url_as(struct terminal *term, void *d, struct session *ses)
   43 {
   44     dialog_save_url(ses);
   45 }
   46 
   47 void menu_go_back(struct terminal *term, void *d, struct session *ses)
   48 {
   49     go_back(ses);
   50 }
   51 
   52 void menu_reload(struct terminal *term, void *d, struct session *ses)
   53 {
   54     reload(ses, -1);
   55 }
   56 
   57 void really_exit_prog(struct session *ses)
   58 {
   59     register_bottom_half((void (*)(void *))destroy_terminal, ses->term);
   60 }
   61 
   62 void dont_exit_prog(struct session *ses)
   63 {
   64     ses->exit_query = 0;
   65 }
   66 
   67 void query_exit(struct session *ses)
   68 {
   69     ses->exit_query = 1;
   70     msg_box(ses->term, NULL, TEXT_(T_EXIT_LINKS), AL_CENTER, (ses->term->next == ses->term->prev && are_there_downloads()) ? TEXT_(T_DO_YOU_REALLY_WANT_TO_EXIT_LINKS_AND_TERMINATE_ALL_DOWNLOADS) : TEXT_(T_DO_YOU_REALLY_WANT_TO_EXIT_LINKS), ses, 2, TEXT_(T_YES), (void (*)(void *))really_exit_prog, B_ENTER, TEXT_(T_NO), dont_exit_prog, B_ESC);
   71 }
   72 
   73 void exit_prog(struct terminal *term, void *d, struct session *ses)
   74 {
   75     if (!ses) {
   76         register_bottom_half((void (*)(void *))destroy_terminal, term);
   77         return;
   78     }
   79     if (!ses->exit_query && (!d || (term->next == term->prev && are_there_downloads()))) {
   80         query_exit(ses);
   81         return;
   82     }
   83     really_exit_prog(ses);
   84 }
   85 
   86 struct refresh {
   87     struct terminal *term;
   88     struct window *win;
   89     struct session *ses;
   90     void (*fn)(struct terminal *term, void *d, struct session *ses);
   91     void *data;
   92     int timer;
   93 };
   94 
   95 void refresh(struct refresh *r)
   96 {
   97     struct refresh rr;
   98     r->timer = -1;
   99     memcpy(&rr, r, sizeof(struct refresh));
  100     delete_window(r->win);
  101     rr.fn(rr.term, rr.data, rr.ses);
  102 }
  103 
  104 void end_refresh(struct refresh *r)
  105 {
  106     if (r->timer != -1) kill_timer(r->timer);
  107     mem_free(r);
  108 }
  109 
  110 void refresh_abort(struct dialog_data *dlg)
  111 {
  112     end_refresh(dlg->dlg->udata2);
  113 }
  114 
  115 void cache_inf(struct terminal *term, void *d, struct session *ses)
  116 {
  117     unsigned char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11, *a12, *a13, *a14, *a15, *a16;
  118     int l = 0;
  119     struct refresh *r;
  120     r = mem_alloc(sizeof(struct refresh));
  121     r->term = term;
  122     r->win = NULL;
  123     r->ses = ses;
  124     r->fn = cache_inf;
  125     r->data = d;
  126     r->timer = -1;
  127     l = 0;
  128     l = 0, a1 = init_str(); add_to_str(&a1, &l, ": "); add_num_to_str(&a1, &l, select_info(CI_FILES));add_to_str(&a1, &l, " ");
  129     l = 0, a2 = init_str(); add_to_str(&a2, &l, ", "); add_num_to_str(&a2, &l, select_info(CI_TIMERS));add_to_str(&a2, &l, " ");
  130     l = 0, a3 = init_str(); add_to_str(&a3, &l, ".\n");
  131 
  132     l = 0, a4 = init_str(); add_to_str(&a4, &l, ": "); add_num_to_str(&a4, &l, connect_info(CI_FILES));add_to_str(&a4, &l, " ");
  133     l = 0, a5 = init_str(); add_to_str(&a5, &l, ", "); add_num_to_str(&a5, &l, connect_info(CI_CONNECTING));add_to_str(&a5, &l, " ");
  134     l = 0, a6 = init_str(); add_to_str(&a6, &l, ", "); add_num_to_str(&a6, &l, connect_info(CI_TRANSFER));add_to_str(&a6, &l, " ");
  135     l = 0, a7 = init_str(); add_to_str(&a7, &l, ", "); add_num_to_str(&a7, &l, connect_info(CI_KEEP));add_to_str(&a7, &l, " ");
  136     l = 0, a8 = init_str(); add_to_str(&a8, &l, ".\n");
  137 
  138     l = 0, a9 = init_str(); add_to_str(&a9, &l, ": "); add_num_to_str(&a9, &l, cache_info(CI_BYTES));add_to_str(&a9, &l, " ");
  139     l = 0, a10 = init_str(); add_to_str(&a10, &l, ", "); add_num_to_str(&a10, &l, cache_info(CI_FILES));add_to_str(&a10, &l, " ");
  140     l = 0, a11 = init_str(); add_to_str(&a11, &l, ", "); add_num_to_str(&a11, &l, cache_info(CI_LOCKED));add_to_str(&a11, &l, " ");
  141     l = 0, a12 = init_str(); add_to_str(&a12, &l, ", "); add_num_to_str(&a12, &l, cache_info(CI_LOADING));add_to_str(&a12, &l, " ");
  142     l = 0, a13 = init_str(); add_to_str(&a13, &l, ".\n");
  143 
  144     l = 0, a14 = init_str(); add_to_str(&a14, &l, ": "); add_num_to_str(&a14, &l, formatted_info(CI_FILES));add_to_str(&a14, &l, " ");
  145     l = 0, a15 = init_str(); add_to_str(&a15, &l, ", "); add_num_to_str(&a15, &l, formatted_info(CI_LOCKED));add_to_str(&a15, &l, " ");
  146     l = 0, a16 = init_str(); add_to_str(&a16, &l, ".");
  147 
  148     msg_box(term, getml(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, NULL), TEXT_(T_RESOURCES), AL_LEFT | AL_EXTD_TEXT, TEXT_(T_RESOURCES), a1, TEXT_(T_HANDLES), a2, TEXT_(T_TIMERS), a3, TEXT_(T_CONNECTIONS), a4, TEXT_(T_cONNECTIONS), a5, TEXT_(T_CONNECTING), a6, TEXT_(T_tRANSFERRING), a7, TEXT_(T_KEEPALIVE), a8, TEXT_(T_MEMORY_CACHE), a9, TEXT_(T_BYTES), a10, TEXT_(T_FILES), a11, TEXT_(T_LOCKED), a12, TEXT_(T_LOADING), a13, TEXT_(T_FORMATTED_DOCUMENT_CACHE), a14, TEXT_(T_DOCUMENTS), a15, TEXT_(T_LOCKED), a16, NULL, r, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
  149     r->win = term->windows.next;
  150     ((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort;
  151     r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh, r);
  152 }
  153 
  154 #ifdef DEBUG
  155 
  156 void list_cache(struct terminal *term, void *d, struct session *ses)
  157 {
  158     unsigned char *a;
  159     int l = 0;
  160     struct refresh *r;
  161     struct cache_entry *ce, *cache;
  162     a = init_str();
  163     r = mem_alloc(sizeof(struct refresh));
  164     r->term = term;
  165     r->win = NULL;
  166     r->ses = ses;
  167     r->fn = list_cache;
  168     r->data = d;
  169     r->timer = -1;
  170     cache = (struct cache_entry *)cache_info(CI_LIST);
  171     add_to_str(&a, &l, ":");
  172     foreach(ce, *cache) {
  173         add_to_str(&a, &l, "\n");
  174         add_to_str(&a, &l, ce->url);
  175     }
  176     msg_box(term, getml(a, NULL), TEXT_(T_CACHE_INFO), AL_LEFT | AL_EXTD_TEXT, TEXT_(T_CACHE_CONTENT), a, NULL, r, 1, TEXT_(T_OK), end_refresh, B_ENTER | B_ESC);
  177     r->win = term->windows.next;
  178     r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh, r);
  179     /* !!! the refresh here is buggy */
  180 }
  181 
  182 #endif
  183 
  184 #ifdef LEAK_DEBUG
  185 
  186 void memory_cld(struct terminal *term, void *d)
  187 {
  188     last_mem_amount = mem_amount;
  189 }
  190 
  191 #define MSG_BUF 2000
  192 #define MSG_W   100
  193 
  194 void memory_info(struct terminal *term, void *d, struct session *ses)
  195 {
  196     char message[MSG_BUF];
  197     char *p;
  198     struct refresh *r;
  199     r = mem_alloc(sizeof(struct refresh));
  200     r->term = term;
  201     r->win = NULL;
  202     r->ses = ses;
  203     r->fn = memory_info;
  204     r->data = d;
  205     r->timer = -1;
  206     p = message;
  207     sprintf(p, "%ld %s", mem_amount, _(TEXT_(T_MEMORY_ALLOCATED), term)), p += strlen(p);
  208     if (last_mem_amount != -1) sprintf(p, ", %s %ld, %s %ld", _(TEXT_(T_LAST), term), last_mem_amount, _(TEXT_(T_DIFFERENCE), term), mem_amount - last_mem_amount), p += strlen(p);
  209     sprintf(p, "."), p += strlen(p);
  210 #if 0 && defined(MAX_LIST_SIZE)
  211     if (last_mem_amount != -1) {
  212         long i, j;
  213         int l = 0;
  214         for (i = 0; i < MAX_LIST_SIZE; i++) if (memory_list[i].p && memory_list[i].p != last_memory_list[i].p) {
  215             for (j = 0; j < MAX_LIST_SIZE; j++) if (last_memory_list[j].p == memory_list[i].p) goto b;
  216             if (!l) sprintf(p, "\n%s: ", _(TEXT_(T_NEW_ADDRESSES), term)), p += strlen(p), l = 1;
  217             else sprintf(p, ", "), p += strlen(p);
  218             sprintf(p, "#%p of %d at %s:%d", memory_list[i].p, (int)memory_list[i].size, memory_list[i].file, memory_list[i].line), p += strlen(p);
  219             if (p - message >= MSG_BUF - MSG_W) {
  220                 sprintf(p, ".."), p += strlen(p);
  221                 break;
  222             }
  223             b:;
  224         }
  225         if (!l) sprintf(p, "\n%s", _(TEXT_(T_NO_NEW_ADDRESSES), term)), p += strlen(p);
  226         sprintf(p, "."), p += strlen(p);
  227     }
  228 #endif
  229     p = stracpy(message);
  230     msg_box(term, getml(p, NULL), TEXT_(T_MEMORY_INFO), AL_CENTER, p, r, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
  231     r->win = term->windows.next;
  232     ((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort;
  233     r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh, r);
  234 }
  235 
  236 #endif
  237 
  238 void flush_caches(struct terminal *term, void *d, void *e)
  239 {
  240     shrink_memory(1);
  241 }
  242 
  243 void go_backwards(struct terminal *term, void *psteps, struct session *ses)
  244 {
  245     int steps = (int) psteps;
  246 
  247     /*if (ses->tq_goto_position)
  248         --steps;
  249     if (ses->search_word)
  250         mem_free(ses->search_word), ses->search_word = NULL;*/
  251     abort_loading(ses);
  252 
  253     while (steps > 1) {
  254         struct location *loc = ses->history.next;
  255         if ((void *) loc == &ses->history) return;
  256         loc = loc->next;
  257         if ((void *) loc == &ses->history) return;
  258         destroy_location(loc);
  259 
  260         --steps;
  261     }
  262 
  263     if (steps)
  264         go_back(ses);
  265 }
  266 
  267 struct menu_item no_hist_menu[] = {
  268     { TEXT_(T_NO_HISTORY), "", M_BAR, NULL, NULL, 0, 0 },
  269     { NULL, NULL, 0, NULL, NULL, 0, 0 },
  270 };
  271 
  272 void history_menu(struct terminal *term, void *ddd, struct session *ses)
  273 {
  274     struct location *l;
  275     struct menu_item *mi = NULL;
  276     int n = 0;
  277     foreach(l, ses->history) {
  278         if (n/* || ses->tq_goto_position*/) {
  279             unsigned char *url;
  280             if (!mi && !(mi = new_menu(3))) return;
  281             url = stracpy(l->vs.url);
  282             if (strchr(url, POST_CHAR)) *strchr(url, POST_CHAR) = 0;
  283             add_to_menu(&mi, url, "", "", MENU_FUNC go_backwards, (void *) n, 0);
  284         }
  285         n++;
  286     }
  287     if (n <= 1) do_menu(term, no_hist_menu, ses);
  288     else do_menu(term, mi, ses);
  289 }
  290 
  291 struct menu_item no_downloads_menu[] = {
  292     { TEXT_(T_NO_DOWNLOADS), "", M_BAR, NULL, NULL, 0, 0 },
  293     { NULL, NULL, 0, NULL, NULL, 0, 0 },
  294 };
  295 
  296 void downloads_menu(struct terminal *term, void *ddd, struct session *ses)
  297 {
  298     struct download *d;
  299     struct menu_item *mi = NULL;
  300     int n = 0;
  301     foreachback(d, downloads) {
  302         unsigned char *u;
  303         if (!mi) if (!(mi = new_menu(3))) return;
  304         u = stracpy(d->url);
  305         if (strchr(u, POST_CHAR)) *strchr(u, POST_CHAR) = 0;
  306         add_to_menu(&mi, u, "", "", MENU_FUNC display_download, d, 0);
  307         n++;
  308     }
  309     if (!n) do_menu(term, no_downloads_menu, ses);
  310     else do_menu(term, mi, ses);
  311 }
  312 
  313 void menu_doc_info(struct terminal *term, void *ddd, struct session *ses)
  314 {
  315     state_msg(ses);
  316 }
  317 
  318 void menu_head_info(struct terminal *term, void *ddd, struct session *ses)
  319 {
  320     head_msg(ses);
  321 }
  322 
  323 void menu_toggle(struct terminal *term, void *ddd, struct session *ses)
  324 {
  325     toggle(ses, ses->screen, 0);
  326 }
  327 
  328 void display_codepage(struct terminal *term, void *pcp, struct session *ses)
  329 {
  330     int cp = (int)pcp;
  331     struct term_spec *t = new_term_spec(term->term);
  332     if (t) t->charset = cp;
  333     cls_redraw_all_terminals();
  334 }
  335 
  336 void assumed_codepage(struct terminal *term, void *pcp, struct session *ses)
  337 {
  338     int cp = (int)pcp;
  339     ses->ds.assume_cp = cp;
  340     redraw_terminal_cls(term);
  341 }
  342 
  343 void charset_list(struct terminal *term, void *xxx, struct session *ses)
  344 {
  345     int i, sel;
  346     unsigned char *n;
  347     struct menu_item *mi;
  348     if (!(mi = new_menu(1))) return;
  349     for (i = 0; (n = get_cp_name(i)); i++) {
  350         if (is_cp_special(i)) continue;
  351         add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC display_codepage, (void *)i, 0);
  352     }
  353     sel = ses->term->spec->charset;
  354     if (sel < 0) sel = 0;
  355     do_menu_selected(term, mi, ses, sel);
  356 }
  357 
  358 void set_val(struct terminal *term, void *ip, int *d)
  359 {
  360     *d = (int)ip;
  361 }
  362 
  363 void charset_sel_list(struct terminal *term, struct session *ses, int *ptr)
  364 {
  365     int i, sel;
  366     unsigned char *n;
  367     struct menu_item *mi;
  368     if (!(mi = new_menu(1))) return;
  369     for (i = 0; (n = get_cp_name(i)); i++) {
  370         add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC set_val, (void *)i, 0);
  371     }
  372     sel = *ptr;
  373     if (sel < 0) sel = 0;
  374     do_menu_selected(term, mi, ptr, sel);
  375 }
  376 
  377 void terminal_options_ok(void *p)
  378 {
  379     cls_redraw_all_terminals();
  380 }
  381 
  382 unsigned char *td_labels[] = { TEXT_(T_NO_FRAMES), TEXT_(T_VT_100_FRAMES), TEXT_(T_LINUX_OR_OS2_FRAMES), TEXT_(T_KOI8R_FRAMES), TEXT_(T_FREEBSD_FRAMES), TEXT_(T_USE_11M), TEXT_(T_RESTRICT_FRAMES_IN_CP850_852), TEXT_(T_BLOCK_CURSOR), TEXT_(T_COLOR), NULL };
  383 
  384 void terminal_options(struct terminal *term, void *xxx, struct session *ses)
  385 {
  386     struct dialog *d;
  387     struct term_spec *ts = new_term_spec(term->term);
  388     if (!ts) return;
  389     d = mem_alloc(sizeof(struct dialog) + 12 * sizeof(struct dialog_item));
  390     memset(d, 0, sizeof(struct dialog) + 12 * sizeof(struct dialog_item));
  391     d->title = TEXT_(T_TERMINAL_OPTIONS);
  392     d->fn = checkbox_list_fn;
  393     d->udata = td_labels;
  394     d->refresh = (void (*)(void *))terminal_options_ok;
  395     d->items[0].type = D_CHECKBOX;
  396     d->items[0].gid = 1;
  397     d->items[0].gnum = TERM_DUMB;
  398     d->items[0].dlen = sizeof(int);
  399     d->items[0].data = (void *)&ts->mode;
  400     d->items[1].type = D_CHECKBOX;
  401     d->items[1].gid = 1;
  402     d->items[1].gnum = TERM_VT100;
  403     d->items[1].dlen = sizeof(int);
  404     d->items[1].data = (void *)&ts->mode;
  405     d->items[2].type = D_CHECKBOX;
  406     d->items[2].gid = 1;
  407     d->items[2].gnum = TERM_LINUX;
  408     d->items[2].dlen = sizeof(int);
  409     d->items[2].data = (void *)&ts->mode;
  410     d->items[3].type = D_CHECKBOX;
  411     d->items[3].gid = 1;
  412     d->items[3].gnum = TERM_KOI8;
  413     d->items[3].dlen = sizeof(int);
  414     d->items[3].data = (void *)&ts->mode;
  415     d->items[4].type = D_CHECKBOX;
  416     d->items[4].gid = 1;
  417     d->items[4].gnum = TERM_FREEBSD;
  418     d->items[4].dlen = sizeof(int);
  419     d->items[4].data = (void *)&ts->mode;
  420     d->items[5].type = D_CHECKBOX;
  421     d->items[5].gid = 0;
  422     d->items[5].dlen = sizeof(int);
  423     d->items[5].data = (void *)&ts->m11_hack;
  424     d->items[6].type = D_CHECKBOX;
  425     d->items[6].gid = 0;
  426     d->items[6].dlen = sizeof(int);
  427     d->items[6].data = (void *)&ts->restrict_852;
  428     d->items[7].type = D_CHECKBOX;
  429     d->items[7].gid = 0;
  430     d->items[7].dlen = sizeof(int);
  431     d->items[7].data = (void *)&ts->block_cursor;
  432     d->items[8].type = D_CHECKBOX;
  433     d->items[8].gid = 0;
  434     d->items[8].dlen = sizeof(int);
  435     d->items[8].data = (void *)&ts->col;
  436     d->items[9].type = D_BUTTON;
  437     d->items[9].gid = B_ENTER;
  438     d->items[9].fn = ok_dialog;
  439     d->items[9].text = TEXT_(T_OK);
  440     d->items[10].type = D_BUTTON;
  441     d->items[10].gid = B_ESC;
  442     d->items[10].fn = cancel_dialog;
  443     d->items[10].text = TEXT_(T_CANCEL);
  444     d->items[11].type = D_END;
  445     do_dialog(term, d, getml(d, NULL));
  446 }
  447 
  448 unsigned char *http_labels[] = { TEXT_(T_USE_HTTP_10), TEXT_(T_ALLOW_SERVER_BLACKLIST), TEXT_(T_BROKEN_302_REDIRECT), TEXT_(T_NO_KEEPALIVE_AFTER_POST_REQUEST), TEXT_(T_DO_NOT_SEND_ACCEPT_CHARSET) };
  449 
  450 int dlg_http_options(struct dialog_data *dlg, struct dialog_item_data *di)
  451 {
  452     struct http_bugs *bugs = (struct http_bugs *)di->cdata;
  453     struct dialog *d;
  454     d = mem_alloc(sizeof(struct dialog) + 8 * sizeof(struct dialog_item));
  455     memset(d, 0, sizeof(struct dialog) + 8 * sizeof(struct dialog_item));
  456     d->title = TEXT_(T_HTTP_BUG_WORKAROUNDS);
  457     d->fn = checkbox_list_fn;
  458     d->udata = http_labels;
  459     d->items[0].type = D_CHECKBOX;
  460     d->items[0].gid = 0;
  461     d->items[0].dlen = sizeof(int);
  462     d->items[0].data = (void *)&bugs->http10;
  463     d->items[1].type = D_CHECKBOX;
  464     d->items[1].gid = 0;
  465     d->items[1].dlen = sizeof(int);
  466     d->items[1].data = (void *)&bugs->allow_blacklist;
  467     d->items[2].type = D_CHECKBOX;
  468     d->items[2].gid = 0;
  469     d->items[2].dlen = sizeof(int);
  470     d->items[2].data = (void *)&bugs->bug_302_redirect;
  471     d->items[3].type = D_CHECKBOX;
  472     d->items[3].gid = 0;
  473     d->items[3].dlen = sizeof(int);
  474     d->items[3].data = (void *)&bugs->bug_post_no_keepalive;
  475     d->items[4].type = D_CHECKBOX;
  476     d->items[4].gid = 0;
  477     d->items[4].dlen = sizeof(int);
  478     d->items[4].data = (void *)&bugs->no_accept_charset;
  479     d->items[5].type = D_BUTTON;
  480     d->items[5].gid = B_ENTER;
  481     d->items[5].fn = ok_dialog;
  482     d->items[5].text = TEXT_(T_OK);
  483     d->items[6].type = D_BUTTON;
  484     d->items[6].gid = B_ESC;
  485     d->items[6].fn = cancel_dialog;
  486     d->items[6].text = TEXT_(T_CANCEL);
  487     d->items[7].type = D_END;
  488     do_dialog(dlg->win->term, d, getml(d, NULL));
  489     return 0;
  490 }
  491 
  492 unsigned char *ftp_texts[] = { TEXT_(T_PASSWORD_FOR_ANONYMOUS_LOGIN), TEXT_(T_USE_PASSIVE_FTP), TEXT_(T_USE_FAST_FTP), TEXT_(T_SET_TYPE_OF_SERVICE), NULL };
  493 
  494 void ftpopt_fn(struct dialog_data *dlg)
  495 {
  496     struct terminal *term = dlg->win->term;
  497     int max = 0, min = 0;
  498     int w, rw;
  499     int y = 0;
  500     max_text_width(term, ftp_texts[0], &max);
  501     min_text_width(term, ftp_texts[0], &min);
  502     checkboxes_width(term, ftp_texts + 1, &max, max_text_width);
  503     checkboxes_width(term, ftp_texts + 1, &min, min_text_width);
  504     max_buttons_width(term, dlg->items + dlg->n - 2, 2, &max);
  505     min_buttons_width(term, dlg->items + dlg->n - 2, 2, &min);
  506     w = term->x * 9 / 10 - 2 * DIALOG_LB;
  507     if (w > max) w = max;
  508     if (w < min) w = min;
  509     if (w > term->x - 2 * DIALOG_LB) w = term->x - 2 * DIALOG_LB;
  510     if (w < 5) w = 5;
  511     rw = 0;
  512     dlg_format_text(NULL, term, ftp_texts[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  513     y += 1;
  514     dlg_format_checkboxes(NULL, term, dlg->items + 1, dlg->n - 3, 0, &y, w, &rw, ftp_texts + 1);
  515     y += 1;
  516     dlg_format_buttons(NULL, term, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
  517     w = rw;
  518     dlg->xw = rw + 2 * DIALOG_LB;
  519     dlg->yw = y + 2 * DIALOG_TB;
  520     center_dlg(dlg);
  521     draw_dlg(dlg);
  522     y = dlg->y + DIALOG_TB;
  523     dlg_format_text(term, term, ftp_texts[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  524     dlg_format_field(term, term, dlg->items, dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  525     y += 1;
  526     dlg_format_checkboxes(term, term, dlg->items + 1, dlg->n - 3, dlg->x + DIALOG_LB, &y, w, NULL, ftp_texts + 1);
  527     y += 1;
  528     dlg_format_buttons(term, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
  529 }
  530 
  531 
  532 int dlg_ftp_options(struct dialog_data *dlg, struct dialog_item_data *di)
  533 {
  534     int a;
  535     struct ftp_options *ftp_options = (struct ftp_options *)di->cdata;
  536     struct dialog *d;
  537     d = mem_alloc(sizeof(struct dialog) + 7 * sizeof(struct dialog_item));
  538     memset(d, 0, sizeof(struct dialog) + 7 * sizeof(struct dialog_item));
  539     d->title = TEXT_(T_FTP_OPTIONS);
  540     d->fn = ftpopt_fn;
  541     d->items[0].type = D_FIELD;
  542     d->items[0].dlen = MAX_STR_LEN;
  543     d->items[0].data = ftp_options->anon_pass;
  544     d->items[1].type = D_CHECKBOX;
  545     d->items[1].dlen = sizeof(int);
  546     d->items[1].data = (void*)&ftp_options->passive_ftp;
  547     d->items[1].gid = 0;
  548     d->items[2].type = D_CHECKBOX;
  549     d->items[2].dlen = sizeof(int);
  550     d->items[2].data = (void*)&ftp_options->fast_ftp;
  551 #ifdef HAVE_IPTOS
  552     d->items[3].type = D_CHECKBOX;
  553     d->items[3].dlen = sizeof(int);
  554     d->items[3].data = (void*)&ftp_options->set_tos;
  555     a = 4;
  556 #else
  557     a = 3;
  558 #endif
  559     d->items[a].type = D_BUTTON;
  560     d->items[a].gid = B_ENTER;
  561     d->items[a].fn = ok_dialog;
  562     d->items[a].text = TEXT_(T_OK);
  563     a++;
  564     d->items[a].type = D_BUTTON;
  565     d->items[a].gid = B_ESC;
  566     d->items[a].fn = cancel_dialog;
  567     d->items[a].text = TEXT_(T_CANCEL);
  568     a++;
  569     d->items[a].type = D_END;
  570     do_dialog(dlg->win->term, d, getml(d, NULL));
  571     return 0;
  572 }
  573 
  574 unsigned char max_c_str[3];
  575 unsigned char max_cth_str[3];
  576 unsigned char max_t_str[3];
  577 unsigned char time_str[5];
  578 unsigned char unrtime_str[5];
  579 
  580 void refresh_net(void *xxx)
  581 {
  582     /*abort_all_connections();*/
  583     max_connections = atoi(max_c_str);
  584     max_connections_to_host = atoi(max_cth_str);
  585     max_tries = atoi(max_t_str);
  586     receive_timeout = atoi(time_str);
  587     unrestartable_receive_timeout = atoi(unrtime_str);
  588     register_bottom_half(check_queue, NULL);
  589 }
  590 
  591 unsigned char *net_msg[] = {
  592     TEXT_(T_HTTP_PROXY__HOST_PORT),
  593     TEXT_(T_FTP_PROXY__HOST_PORT),
  594     TEXT_(T_MAX_CONNECTIONS),
  595     TEXT_(T_MAX_CONNECTIONS_TO_ONE_HOST),
  596     TEXT_(T_RETRIES),
  597     TEXT_(T_RECEIVE_TIMEOUT_SEC),
  598     TEXT_(T_TIMEOUT_WHEN_UNRESTARTABLE),
  599     TEXT_(T_ASYNC_DNS_LOOKUP),
  600     TEXT_(T_SET_TIME_OF_DOWNLOADED_FILES),
  601     "",
  602     "",
  603 };
  604 
  605 void netopt_fn(struct dialog_data *dlg)
  606 {
  607     struct terminal *term = dlg->win->term;
  608     int max = 0, min = 0;
  609     int w, rw;
  610     int y = -1;
  611     max_text_width(term, net_msg[0], &max);
  612     min_text_width(term, net_msg[0], &min);
  613     max_text_width(term, net_msg[1], &max);
  614     min_text_width(term, net_msg[1], &min);
  615     max_group_width(term, net_msg + 2, dlg->items + 2, 9, &max);
  616     min_group_width(term, net_msg + 2, dlg->items + 2, 9, &min);
  617     max_buttons_width(term, dlg->items + 11, 2, &max);
  618     min_buttons_width(term, dlg->items + 11, 2, &min);
  619     w = dlg->win->term->x * 9 / 10 - 2 * DIALOG_LB;
  620     if (w > max) w = max;
  621     if (w < min) w = min;
  622     if (w > dlg->win->term->x - 2 * DIALOG_LB) w = dlg->win->term->x - 2 * DIALOG_LB;
  623     if (w < 1) w = 1;
  624     rw = 0;
  625     dlg_format_text(NULL, term, net_msg[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  626     y += 2;
  627     dlg_format_text(NULL, term, net_msg[1], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  628     y += 2;
  629     dlg_format_group(NULL, term, net_msg + 2, dlg->items + 2, 9, 0, &y, w, &rw);
  630     y++;
  631     dlg_format_buttons(NULL, term, dlg->items + 11, 2, 0, &y, w, &rw, AL_CENTER);
  632     w = rw;
  633     dlg->xw = w + 2 * DIALOG_LB;
  634     dlg->yw = y + 2 * DIALOG_TB;
  635     center_dlg(dlg);
  636     draw_dlg(dlg);
  637     y = dlg->y + DIALOG_TB;
  638     dlg_format_text(term, term, net_msg[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  639     dlg_format_field(term, term, &dlg->items[0], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  640     y++;
  641     dlg_format_text(term, term, net_msg[1], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  642     dlg_format_field(term, term, &dlg->items[1], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  643     y++;
  644     dlg_format_group(term, term, net_msg + 2, &dlg->items[2], 9, dlg->x + DIALOG_LB, &y, w, NULL);
  645     y++;
  646     dlg_format_buttons(term, term, &dlg->items[11], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
  647 }
  648 
  649 void net_options(struct terminal *term, void *xxx, void *yyy)
  650 {
  651     struct dialog *d;
  652     snprint(max_c_str, 3, max_connections);
  653     snprint(max_cth_str, 3, max_connections_to_host);
  654     snprint(max_t_str, 3, max_tries);
  655     snprint(time_str, 5, receive_timeout);
  656     snprint(unrtime_str, 5, unrestartable_receive_timeout);
  657     d = mem_alloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
  658     memset(d, 0, sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
  659     d->title = TEXT_(T_NETWORK_OPTIONS);
  660     d->fn = netopt_fn;
  661     d->refresh = (void (*)(void *))refresh_net;
  662     d->items[0].type = D_FIELD;
  663     d->items[0].dlen = MAX_STR_LEN;
  664     d->items[0].data = http_proxy;
  665     d->items[1].type = D_FIELD;
  666     d->items[1].dlen = MAX_STR_LEN;
  667     d->items[1].data = ftp_proxy;
  668     d->items[2].type = D_FIELD;
  669     d->items[2].data = max_c_str;
  670     d->items[2].dlen = 3;
  671     d->items[2].fn = check_number;
  672     d->items[2].gid = 1;
  673     d->items[2].gnum = 99;
  674     d->items[3].type = D_FIELD;
  675     d->items[3].data = max_cth_str;
  676     d->items[3].dlen = 3;
  677     d->items[3].fn = check_number;
  678     d->items[3].gid = 1;
  679     d->items[3].gnum = 99;
  680     d->items[4].type = D_FIELD;
  681     d->items[4].data = max_t_str;
  682     d->items[4].dlen = 3;
  683     d->items[4].fn = check_number;
  684     d->items[4].gid = 0;
  685     d->items[4].gnum = 16;
  686     d->items[5].type = D_FIELD;
  687     d->items[5].data = time_str;
  688     d->items[5].dlen = 5;
  689     d->items[5].fn = check_number;
  690     d->items[5].gid = 1;
  691     d->items[5].gnum = 1800;
  692     d->items[6].type = D_FIELD;
  693     d->items[6].data = unrtime_str;
  694     d->items[6].dlen = 5;
  695     d->items[6].fn = check_number;
  696     d->items[6].gid = 1;
  697     d->items[6].gnum = 1800;
  698     d->items[7].type = D_CHECKBOX;
  699     d->items[7].data = (unsigned char *)&async_lookup;
  700     d->items[7].dlen = sizeof(int);
  701     d->items[8].type = D_CHECKBOX;
  702     d->items[8].data = (unsigned char *)&download_utime;
  703     d->items[8].dlen = sizeof(int);
  704     d->items[9].type = D_BUTTON;
  705     d->items[9].gid = 0;
  706     d->items[9].fn = dlg_http_options;
  707     d->items[9].text = TEXT_(T_HTTP_OPTIONS);
  708     d->items[9].data = (unsigned char *)&http_bugs;
  709     d->items[9].dlen = sizeof(struct http_bugs);
  710     d->items[10].type = D_BUTTON;
  711     d->items[10].gid = 0;
  712     d->items[10].fn = dlg_ftp_options;
  713     d->items[10].text = TEXT_(T_FTP_OPTIONS);
  714     d->items[10].data = (unsigned char *)&ftp_options;
  715     d->items[10].dlen = sizeof(struct ftp_options);
  716     d->items[11].type = D_BUTTON;
  717     d->items[11].gid = B_ENTER;
  718     d->items[11].fn = ok_dialog;
  719     d->items[11].text = TEXT_(T_OK);
  720     d->items[12].type = D_BUTTON;
  721     d->items[12].gid = B_ESC;
  722     d->items[12].fn = cancel_dialog;
  723     d->items[12].text = TEXT_(T_CANCEL);
  724     d->items[13].type = D_END;
  725     do_dialog(term, d, getml(d, NULL));
  726 }
  727 
  728 unsigned char *prg_msg[] = {
  729     TEXT_(T_MAILTO_PROG),
  730     TEXT_(T_TELNET_PROG),
  731     TEXT_(T_TN3270_PROG),
  732     TEXT_(T_MMS_PROG),
  733     ""
  734 };
  735 
  736 void netprog_fn(struct dialog_data *dlg)
  737 {
  738     struct terminal *term = dlg->win->term;
  739     int max = 0, min = 0;
  740     int w, rw;
  741     int y = -1;
  742     max_text_width(term, prg_msg[0], &max);
  743     min_text_width(term, prg_msg[0], &min);
  744     max_text_width(term, prg_msg[1], &max);
  745     min_text_width(term, prg_msg[1], &min);
  746     max_text_width(term, prg_msg[2], &max);
  747     min_text_width(term, prg_msg[2], &min);
  748     max_text_width(term, prg_msg[3], &max);
  749     min_text_width(term, prg_msg[3], &min);
  750     max_buttons_width(term, dlg->items + 4, 2, &max);
  751     min_buttons_width(term, dlg->items + 4, 2, &min);
  752     w = dlg->win->term->x * 9 / 10 - 2 * DIALOG_LB;
  753     if (w > max) w = max;
  754     if (w < min) w = min;
  755     if (w > dlg->win->term->x - 2 * DIALOG_LB) w = dlg->win->term->x - 2 * DIALOG_LB;
  756     if (w < 1) w = 1;
  757     rw = 0;
  758     dlg_format_text(NULL, term, prg_msg[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  759     y += 2;
  760     dlg_format_text(NULL, term, prg_msg[1], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  761     y += 2;
  762     dlg_format_text(NULL, term, prg_msg[2], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  763     y += 2;
  764     dlg_format_text(NULL, term, prg_msg[3], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
  765     y += 2;
  766     dlg_format_buttons(NULL, term, dlg->items + 4, 2, 0, &y, w, &rw, AL_CENTER);
  767     w = rw;
  768     dlg->xw = w + 2 * DIALOG_LB;
  769     dlg->yw = y + 2 * DIALOG_TB;
  770     center_dlg(dlg);
  771     draw_dlg(dlg);
  772     y = dlg->y + DIALOG_TB;
  773     dlg_format_text(term, term, prg_msg[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  774     dlg_format_field(term, term, &dlg->items[0], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  775     y++;
  776     dlg_format_text(term, term, prg_msg[1], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  777     dlg_format_field(term, term, &dlg->items[1], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  778     y++;
  779     dlg_format_text(term, term, prg_msg[2], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  780     dlg_format_field(term, term, &dlg->items[2], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  781     y++;
  782     dlg_format_text(term, term, prg_msg[3], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
  783     dlg_format_field(term, term, &dlg->items[3], dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
  784     y++;
  785     dlg_format_buttons(term, term, &dlg->items[4], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
  786 }
  787 
  788 void net_programs(struct terminal *term, void *xxx, void *yyy)
  789 {
  790     struct dialog *d;
  791     d = mem_alloc(sizeof(struct dialog) + 7 * sizeof(struct dialog_item));
  792     memset(d, 0, sizeof(struct dialog) + 7 * sizeof(struct dialog_item));
  793     d->title = TEXT_(T_MAIL_AND_TELNET_PROGRAMS);
  794     d->fn = netprog_fn;
  795     d->items[0].type = D_FIELD;
  796     d->items[0].dlen = MAX_STR_LEN;
  797     d->items[0].data = get_prog(&mailto_prog);
  798     d->items[1].type = D_FIELD;
  799     d->items[1].dlen = MAX_STR_LEN;
  800     d->items[1].data = get_prog(&telnet_prog);
  801     d->items[2].type = D_FIELD;
  802     d->items[2].dlen = MAX_STR_LEN;
  803     d->items[2].data = get_prog(&tn3270_prog);
  804     d->items[3].type = D_FIELD;
  805     d->items[3].dlen = MAX_STR_LEN;
  806     d->items[3].data = get_prog(&mms_prog);
  807     d->items[4].type = D_BUTTON;
  808     d->items[4].gid = B_ENTER;
  809     d->items[4].fn = ok_dialog;
  810     d->items[4].text = TEXT_(T_OK);
  811     d->items[5].type = D_BUTTON;
  812     d->items[5].gid = B_ESC;
  813     d->items[5].fn = cancel_dialog;
  814     d->items[5].text = TEXT_(T_CANCEL);
  815     d->items[6].type = D_END;
  816     do_dialog(term, d, getml(d, NULL));
  817 }
  818 
  819 /*void net_opt_ask(struct terminal *term, void *xxx, void *yyy)
  820 {
  821     if (list_empty(downloads)) {
  822         net_options(term, xxx, yyy);
  823         return;
  824     }
  825     msg_box(term, NULL, _("Network options"), AL_CENTER, _("Warning: configuring network will terminate all running downloads. Do you really want to configure network?"), term, 2, _("Yes"), (void (*)(void *))net_options, B_ENTER, _("No"), NULL, B_ESC);
  826 }*/
  827 
  828 unsigned char mc_str[8];
  829 unsigned char doc_str[4];
  830 
  831 void cache_refresh(void *xxx)
  832 {
  833     memory_cache_size = atoi(mc_str) * 1024;
  834     max_format_cache_entries = atoi(doc_str);
  835     count_format_cache();
  836     shrink_memory(0);
  837 }
  838 
  839 unsigned char *cache_texts[] = { TEXT_(T_MEMORY_CACHE_SIZE__KB), TEXT_(T_NUMBER_OF_FORMATTED_DOCUMENTS) };
  840 
  841 void cache_opt(struct terminal *term, void *xxx, void *yyy)
  842 {
  843     struct dialog *d;
  844     snprint(mc_str, 8, memory_cache_size / 1024);
  845     snprint(doc_str, 4, max_format_cache_entries);
  846     d = mem_alloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
  847     memset(d, 0, sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
  848     d->title = TEXT_(T_CACHE_OPTIONS);
  849     d->fn = group_fn;
  850     d->udata = cache_texts;
  851     d->refresh = (void (*)(void *))cache_refresh;
  852     d->items[0].type = D_FIELD;
  853     d->items[0].dlen = 8;
  854     d->items[0].data = mc_str;
  855     d->items[0].fn = check_number;
  856     d->items[0].gid = 0;
  857     d->items[0].gnum = MAXINT / 1024;
  858     d->items[1].type = D_FIELD;
  859     d->items[1].dlen = 4;
  860     d->items[1].data = doc_str;
  861     d->items[1].fn = check_number;
  862     d->items[1].gid = 0;
  863     d->items[1].gnum = 256;
  864     d->items[2].type = D_BUTTON;
  865     d->items[2].gid = B_ENTER;
  866     d->items[2].fn = ok_dialog;
  867     d->items[2].text = TEXT_(T_OK);
  868     d->items[3].type = D_BUTTON;
  869     d->items[3].gid = B_ESC;
  870     d->items[3].fn = cancel_dialog;
  871     d->items[3].text = TEXT_(T_CANCEL);
  872     d->items[4].type = D_END;
  873     do_dialog(term, d, getml(d, NULL));
  874 }
  875 
  876 void menu_shell(struct terminal *term, void *xxx, void *yyy)
  877 {
  878     unsigned char *sh;
  879     if (!(sh = GETSHELL)) sh = DEFAULT_SHELL;
  880     exec_on_terminal(term, sh, "", 1);
  881 }
  882 
  883 void menu_kill_background_connections(struct terminal *term, void *xxx, void *yyy)
  884 {
  885     abort_background_connections();
  886 }
  887 
  888 void menu_save_html_options(struct terminal *term, void *xxx, struct session *ses)
  889 {
  890     memcpy(&dds, &ses->ds, sizeof(struct document_setup));
  891     write_html_config(term);
  892 }
  893 
  894 unsigned char marg_str[2];
  895 
  896 void html_refresh(struct session *ses)
  897 {
  898     ses->ds.margin = atoi(marg_str);
  899     html_interpret(ses);
  900     draw_formatted(ses);
  901     load_frames(ses, ses->screen);
  902     process_file_requests(ses);
  903     print_screen_status(ses);
  904 }
  905 
  906 unsigned char *html_texts[] = { TEXT_(T_DISPLAY_TABLES), TEXT_(T_DISPLAY_FRAMES), TEXT_(T_DISPLAY_LINKS_TO_IMAGES), TEXT_(T_LINK_ORDER_BY_COLUMNS), TEXT_(T_NUMBERED_LINKS), TEXT_(T_TEXT_MARGIN), "", TEXT_(T_IGNORE_CHARSET_INFO_SENT_BY_SERVER) };
  907 
  908 int dlg_assume_cp(struct dialog_data *dlg, struct dialog_item_data *di)
  909 {
  910     charset_sel_list(dlg->win->term, dlg->dlg->udata2, (int *)di->cdata);
  911     return 0;
  912 }
  913 
  914 void menu_html_options(struct terminal *term, void *xxx, struct session *ses)
  915 {
  916     struct dialog *d;
  917     snprint(marg_str, 2, ses->ds.margin);
  918     d = mem_alloc(sizeof(struct dialog) + 11 * sizeof(struct dialog_item));
  919     memset(d, 0, sizeof(struct dialog) + 11 * sizeof(struct dialog_item));
  920     d->title = TEXT_(T_HTML_OPTIONS);
  921     d->fn = group_fn;
  922     d->udata = html_texts;
  923     d->udata2 = ses;
  924     d->refresh = (void (*)(void *))html_refresh;
  925     d->refresh_data = ses;
  926     d->items[0].type = D_CHECKBOX;
  927     d->items[0].data = (unsigned char *) &ses->ds.tables;
  928     d->items[0].dlen = sizeof(int);
  929     d->items[1].type = D_CHECKBOX;
  930     d->items[1].data = (unsigned char *) &ses->ds.frames;
  931     d->items[1].dlen = sizeof(int);
  932     d->items[2].type = D_CHECKBOX;
  933     d->items[2].data = (unsigned char *) &ses->ds.images;
  934     d->items[2].dlen = sizeof(int);
  935     d->items[3].type = D_CHECKBOX;
  936     d->items[3].data = (unsigned char *) &ses->ds.table_order;
  937     d->items[3].dlen = sizeof(int);
  938     d->items[4].type = D_CHECKBOX;
  939     d->items[4].data = (unsigned char *) &ses->ds.num_links;
  940     d->items[4].dlen = sizeof(int);
  941     d->items[5].type = D_FIELD;
  942     d->items[5].dlen = 2;
  943     d->items[5].data = marg_str;
  944     d->items[5].fn = check_number;
  945     d->items[5].gid = 0;
  946     d->items[5].gnum = 9;
  947     d->items[6].type = D_BUTTON;
  948     d->items[6].gid = 0;
  949     d->items[6].fn = dlg_assume_cp;
  950     d->items[6].text = TEXT_(T_DEFAULT_CODEPAGE);
  951     d->items[6].data = (unsigned char *) &ses->ds.assume_cp;
  952     d->items[6].dlen = sizeof(int);
  953     d->items[7].type = D_CHECKBOX;
  954     d->items[7].data = (unsigned char *) &ses->ds.hard_assume;
  955     d->items[7].dlen = sizeof(int);
  956     d->items[8].type = D_BUTTON;
  957     d->items[8].gid = B_ENTER;
  958     d->items[8].fn = ok_dialog;
  959     d->items[8].text = TEXT_(T_OK);
  960     d->items[9].type = D_BUTTON;
  961     d->items[9].gid = B_ESC;
  962     d->items[9].fn = cancel_dialog;
  963     d->items[9].text = TEXT_(T_CANCEL);
  964     d->items[10].type = D_END;
  965     do_dialog(term, d, getml(d, NULL));
  966 }
  967 
  968 void menu_set_language(struct terminal *term, void *pcp, struct session *ses)
  969 {
  970     set_language((int)pcp);
  971     cls_redraw_all_terminals();
  972 }
  973 
  974 void menu_language_list(struct terminal *term, void *xxx, struct session *ses)
  975 {
  976     int i, sel;
  977     unsigned char *n;
  978     struct menu_item *mi;
  979     if (!(mi = new_menu(1))) return;
  980     for (i = 0; i < n_languages(); i++) {
  981         n = language_name(i);
  982         add_to_menu(&mi, n, "", "", MENU_FUNC menu_set_language, (void *)i, 0);
  983     }
  984     sel = current_language;
  985     do_menu_selected(term, mi, ses, sel);
  986 }
  987 
  988 unsigned char *resize_texts[] = { TEXT_(T_COLUMNS), TEXT_(T_ROWS) };
  989 
  990 unsigned char x_str[4];
  991 unsigned char y_str[4];
  992 
  993 void do_resize_terminal(struct terminal *term)
  994 {
  995     unsigned char str[8];
  996     strcpy(str, x_str);
  997     strcat(str, ",");
  998     strcat(str, y_str);
  999     do_terminal_function(term, TERM_FN_RESIZE, str);
 1000 }
 1001 
 1002 void dlg_resize_terminal(struct terminal *term, void *xxx, struct session *ses)
 1003 {
 1004     struct dialog *d;
 1005     int x = term->x > 999 ? 999 : term->x;
 1006     int y = term->y > 999 ? 999 : term->y;
 1007     sprintf(x_str, "%d", x);
 1008     sprintf(y_str, "%d", y);
 1009     d = mem_alloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
 1010     memset(d, 0, sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
 1011     d->title = TEXT_(T_RESIZE_TERMINAL);
 1012     d->fn = group_fn;
 1013     d->udata = resize_texts;
 1014     d->refresh = (void (*)(void *))do_resize_terminal;
 1015     d->refresh_data = term;
 1016     d->items[0].type = D_FIELD;
 1017     d->items[0].dlen = 4;
 1018     d->items[0].data = x_str;
 1019     d->items[0].fn = check_number;
 1020     d->items[0].gid = 1;
 1021     d->items[0].gnum = 999;
 1022     d->items[1].type = D_FIELD;
 1023     d->items[1].dlen = 4;
 1024     d->items[1].data = y_str;
 1025     d->items[1].fn = check_number;
 1026     d->items[1].gid = 1;
 1027     d->items[1].gnum = 999;
 1028     d->items[2].type = D_BUTTON;
 1029     d->items[2].gid = B_ENTER;
 1030     d->items[2].fn = ok_dialog;
 1031     d->items[2].text = TEXT_(T_OK);
 1032     d->items[3].type = D_BUTTON;
 1033     d->items[3].gid = B_ESC;
 1034     d->items[3].fn = cancel_dialog;
 1035     d->items[3].text = TEXT_(T_CANCEL);
 1036     d->items[4].type = D_END;
 1037     do_dialog(term, d, getml(d, NULL));
 1038 
 1039 }
 1040 
 1041 struct menu_item file_menu11[] = {
 1042     { TEXT_(T_GOTO_URL), "g", TEXT_(T_HK_GOTO_URL), MENU_FUNC menu_goto_url, (void *)0, 0, 0 },
 1043     { TEXT_(T_GO_BACK), "<-", TEXT_(T_HK_GO_BACK), MENU_FUNC menu_go_back, (void *)0, 0, 0 },
 1044     { TEXT_(T_HISTORY), ">", TEXT_(T_HK_HISTORY), MENU_FUNC history_menu, (void *)0, 1, 0 },
 1045     { TEXT_(T_RELOAD), "Ctrl-R", TEXT_(T_HK_RELOAD), MENU_FUNC menu_reload, (void *)0, 0, 0 },
 1046 };
 1047 
 1048 struct menu_item file_menu12[] = {
 1049     { TEXT_(T_BOOKMARKS), "s", TEXT_(T_HK_BOOKMARKS), MENU_FUNC menu_bookmark_manager, (void *)0, 0, 0 },
 1050     { TEXT_(T_ADD_BOOKMARK), "a", TEXT_(T_HK_ADD_BOOKMARK), MENU_FUNC launch_bm_add_doc_dialog, (void *)0, 0, 0 },
 1051 };
 1052 
 1053 struct menu_item file_menu21[] = {
 1054     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1055     { TEXT_(T_SAVE_AS), "", TEXT_(T_HK_SAVE_AS), MENU_FUNC save_as, (void *)0, 0, 0 },
 1056     { TEXT_(T_SAVE_URL_AS), "", TEXT_(T_HK_SAVE_URL_AS), MENU_FUNC menu_save_url_as, (void *)0, 0, 0 },
 1057     { TEXT_(T_SAVE_FORMATTED_DOCUMENT), "", TEXT_(T_HK_SAVE_FORMATTED_DOCUMENT), MENU_FUNC menu_save_formatted, (void *)0, 0, 0 },
 1058 };
 1059 
 1060 struct menu_item file_menu22[] = {
 1061     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1062     { TEXT_(T_KILL_BACKGROUND_CONNECTIONS), "", TEXT_(T_HK_KILL_BACKGROUND_CONNECTIONS), MENU_FUNC menu_kill_background_connections, (void *)0, 0, 0 },
 1063     { TEXT_(T_FLUSH_ALL_CACHES), "", TEXT_(T_HK_FLUSH_ALL_CACHES), MENU_FUNC flush_caches, (void *)0, 0, 0 },
 1064     { TEXT_(T_RESOURCE_INFO), "", TEXT_(T_HK_RESOURCE_INFO), MENU_FUNC cache_inf, (void *)0, 0, 0 },
 1065 #if 0
 1066     { TEXT_(T_CACHE_INFO), "", TEXT_(T_HK_CACHE_INFO), MENU_FUNC list_cache, (void *)0, 0, 0 },
 1067 #endif
 1068 #ifdef LEAK_DEBUG
 1069     { TEXT_(T_MEMORY_INFO), "", TEXT_(T_HK_MEMORY_INFO), MENU_FUNC memory_info, (void *)0, 0, 0 },
 1070 #endif
 1071     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1072 };
 1073 
 1074 struct menu_item file_menu3[] = {
 1075     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1076     { TEXT_(T_EXIT), "q", TEXT_(T_HK_EXIT), MENU_FUNC exit_prog, (void *)0, 0, 0 },
 1077     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1078 };
 1079 
 1080 void do_file_menu(struct terminal *term, void *xxx, struct session *ses)
 1081 {
 1082     int x;
 1083     int o;
 1084     struct menu_item *file_menu, *e, *f;
 1085     file_menu = mem_alloc(sizeof(file_menu11) + sizeof(file_menu12) + sizeof(file_menu21) + sizeof(file_menu22) + sizeof(file_menu3) + 3 * sizeof(struct menu_item));
 1086     e = file_menu;
 1087     memcpy(e, file_menu11, sizeof(file_menu11));
 1088     e += sizeof(file_menu11) / sizeof(struct menu_item);
 1089     if (!anonymous) {
 1090         memcpy(e, file_menu12, sizeof(file_menu12));
 1091         e += sizeof(file_menu12) / sizeof(struct menu_item);
 1092     }
 1093     if ((o = can_open_in_new(term))) {
 1094         e->text = TEXT_(T_NEW_WINDOW);
 1095         e->rtext = o - 1 ? ">" : "";
 1096         e->hotkey = TEXT_(T_HK_NEW_WINDOW);
 1097         e->func = MENU_FUNC open_in_new_window;
 1098         e->data = send_open_new_xterm;
 1099         e->in_m = o - 1;
 1100         e->free_i = 0;
 1101         e++;
 1102     }
 1103     if (!anonymous) {
 1104         memcpy(e, file_menu21, sizeof(file_menu21));
 1105         e += sizeof(file_menu21) / sizeof(struct menu_item);
 1106     }
 1107     memcpy(e, file_menu22, sizeof(file_menu22));
 1108     e += sizeof(file_menu22) / sizeof(struct menu_item);
 1109     /*"", "", M_BAR, NULL, NULL, 0, 0,
 1110     TEXT_(T_OS_SHELL), "", TEXT_(T_HK_OS_SHELL), MENU_FUNC menu_shell, NULL, 0, 0,*/
 1111     x = 1;
 1112     if (!anonymous && can_open_os_shell(term->environment)) {
 1113         e->text = TEXT_(T_OS_SHELL);
 1114         e->rtext = "";
 1115         e->hotkey = TEXT_(T_HK_OS_SHELL);
 1116         e->func = MENU_FUNC menu_shell;
 1117         e->data = NULL;
 1118         e->in_m = 0;
 1119         e->free_i = 0;
 1120         e++;
 1121         x = 0;
 1122     }
 1123     if (can_resize_window(term->environment)) {
 1124         e->text = TEXT_(T_RESIZE_TERMINAL);
 1125         e->rtext = "";
 1126         e->hotkey = TEXT_(T_HK_RESIZE_TERMINAL);
 1127         e->func = MENU_FUNC dlg_resize_terminal;
 1128         e->data = NULL;
 1129         e->in_m = 0;
 1130         e->free_i = 0;
 1131         e++;
 1132         x = 0;
 1133     }
 1134     memcpy(e, file_menu3 + x, sizeof(file_menu3) - x * sizeof(struct menu_item));
 1135     e += sizeof(file_menu3) / sizeof(struct menu_item);
 1136     for (f = file_menu; f < e; f++) f->free_i = 1;
 1137     do_menu(term, file_menu, ses);
 1138 }
 1139 
 1140 struct menu_item view_menu[] = {
 1141     { TEXT_(T_SEARCH), "/", TEXT_(T_HK_SEARCH), MENU_FUNC menu_for_frame, (void *)search_dlg, 0, 0 },
 1142     { TEXT_(T_SEARCH_BACK), "?", TEXT_(T_HK_SEARCH_BACK), MENU_FUNC menu_for_frame, (void *)search_back_dlg, 0, 0 },
 1143     { TEXT_(T_FIND_NEXT), "n", TEXT_(T_HK_FIND_NEXT), MENU_FUNC menu_for_frame, (void *)find_next, 0, 0 },
 1144     { TEXT_(T_FIND_PREVIOUS), "N", TEXT_(T_HK_FIND_PREVIOUS), MENU_FUNC menu_for_frame, (void *)find_next_back, 0, 0 },
 1145     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1146     { TEXT_(T_TOGGLE_HTML_PLAIN), "\\", TEXT_(T_HK_TOGGLE_HTML_PLAIN), MENU_FUNC menu_toggle, NULL, 0, 0 },
 1147     { TEXT_(T_DOCUMENT_INFO), "=", TEXT_(T_HK_DOCUMENT_INFO), MENU_FUNC menu_doc_info, NULL, 0, 0 },
 1148     { TEXT_(T_HEADER_INFO), "|", TEXT_(T_HK_HEADER_INFO), MENU_FUNC menu_head_info, NULL, 0, 0 },
 1149     { TEXT_(T_FRAME_AT_FULL_SCREEN), "f", TEXT_(T_HK_FRAME_AT_FULL_SCREEN), MENU_FUNC menu_for_frame, (void *)set_frame, 0, 0 },
 1150     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1151     { TEXT_(T_HTML_OPTIONS), "", TEXT_(T_HK_HTML_OPTIONS), MENU_FUNC menu_html_options, (void *)0, 0, 0 },
 1152     { TEXT_(T_SAVE_HTML_OPTIONS), "", TEXT_(T_HK_SAVE_HTML_OPTIONS), MENU_FUNC menu_save_html_options, (void *)0, 0, 0 },
 1153     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1154 };
 1155 
 1156 struct menu_item view_menu_anon[] = {
 1157     { TEXT_(T_SEARCH), "/", TEXT_(T_HK_SEARCH), MENU_FUNC menu_for_frame, (void *)search_dlg, 0, 0 },
 1158     { TEXT_(T_SEARCH_BACK), "?", TEXT_(T_HK_SEARCH_BACK), MENU_FUNC menu_for_frame, (void *)search_back_dlg, 0, 0 },
 1159     { TEXT_(T_FIND_NEXT), "n", TEXT_(T_HK_FIND_NEXT), MENU_FUNC menu_for_frame, (void *)find_next, 0, 0 },
 1160     { TEXT_(T_FIND_PREVIOUS), "N", TEXT_(T_HK_FIND_PREVIOUS), MENU_FUNC menu_for_frame, (void *)find_next_back, 0, 0 },
 1161     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1162     { TEXT_(T_TOGGLE_HTML_PLAIN), "\\", TEXT_(T_HK_TOGGLE_HTML_PLAIN), MENU_FUNC menu_toggle, NULL, 0, 0 },
 1163     { TEXT_(T_DOCUMENT_INFO), "=", TEXT_(T_HK_DOCUMENT_INFO), MENU_FUNC menu_doc_info, NULL, 0, 0 },
 1164     { TEXT_(T_FRAME_AT_FULL_SCREEN), "f", TEXT_(T_HK_FRAME_AT_FULL_SCREEN), MENU_FUNC menu_for_frame, (void *)set_frame, 0, 0 },
 1165     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1166     { TEXT_(T_HTML_OPTIONS), "", TEXT_(T_HK_HTML_OPTIONS), MENU_FUNC menu_html_options, (void *)0, 0, 0 },
 1167     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1168 };
 1169 
 1170 struct menu_item help_menu[] = {
 1171     { TEXT_(T_ABOUT), "", TEXT_(T_HK_ABOUT), MENU_FUNC menu_about, (void *)0, 0, 0 },
 1172     { TEXT_(T_KEYS), "", TEXT_(T_HK_KEYS), MENU_FUNC menu_keys, (void *)0, 0, 0 },
 1173     { TEXT_(T_MANUAL), "", TEXT_(T_HK_MANUAL), MENU_FUNC menu_manual, (void *)0, 0, 0 },
 1174     { TEXT_(T_COPYING), "", TEXT_(T_HK_COPYING), MENU_FUNC menu_copying, (void *)0, 0, 0 },
 1175     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1176 };
 1177 
 1178 struct menu_item assoc_menu[] = {
 1179     { TEXT_(T_ADD), "", TEXT_(T_HK_ADD), MENU_FUNC menu_add_ct, NULL, 0, 0 },
 1180     { TEXT_(T_MODIFY), ">", TEXT_(T_HK_MODIFY), MENU_FUNC menu_list_assoc, menu_add_ct, 1, 0 },
 1181     { TEXT_(T_DELETE), ">", TEXT_(T_HK_DELETE), MENU_FUNC menu_list_assoc, menu_del_ct, 1, 0 },
 1182     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1183 };
 1184 
 1185 struct menu_item ext_menu[] = {
 1186     { TEXT_(T_ADD), "", TEXT_(T_HK_ADD), MENU_FUNC menu_add_ext, NULL, 0, 0 },
 1187     { TEXT_(T_MODIFY), ">", TEXT_(T_HK_MODIFY), MENU_FUNC menu_list_ext, menu_add_ext, 1, 0 },
 1188     { TEXT_(T_DELETE), ">", TEXT_(T_HK_DELETE), MENU_FUNC menu_list_ext, menu_del_ext, 1, 0 },
 1189     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1190 };
 1191 
 1192 struct menu_item setup_menu[] = {
 1193     { TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_list, NULL, 1, 0 },
 1194     { TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC charset_list, (void *)1, 1, 0 },
 1195     { TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 },
 1196     { TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC net_options, NULL, 0, 0 },
 1197     { TEXT_(T_CACHE), "", TEXT_(T_HK_CACHE), MENU_FUNC cache_opt, NULL, 0, 0 },
 1198     { TEXT_(T_MAIL_AND_TELNEL), "", TEXT_(T_HK_MAIL_AND_TELNEL), MENU_FUNC net_programs, NULL, 0, 0 },
 1199     { TEXT_(T_ASSOCIATIONS), ">", TEXT_(T_HK_ASSOCIATIONS), MENU_FUNC do_menu, assoc_menu, 1, 0 },
 1200     { TEXT_(T_FILE_EXTENSIONS), ">", TEXT_(T_HK_FILE_EXTENSIONS), MENU_FUNC do_menu, ext_menu, 1, 0 },
 1201     { "", "", M_BAR, NULL, NULL, 0, 0 },
 1202     { TEXT_(T_SAVE_OPTIONS), "", TEXT_(T_HK_SAVE_OPTIONS), MENU_FUNC write_config, NULL, 0, 0 },
 1203     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1204 };
 1205 
 1206 struct menu_item setup_menu_anon[] = {
 1207     { TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_list, NULL, 1, 0 },
 1208     { TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC charset_list, (void *)1, 1, 0 },
 1209     { TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 },
 1210     /*{ TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC net_options, NULL, 0, 0,}*/
 1211     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1212 };
 1213 
 1214 void do_view_menu(struct terminal *term, void *xxx, struct session *ses)
 1215 {
 1216     if (!anonymous) do_menu(term, view_menu, ses);
 1217     else do_menu(term, view_menu_anon, ses);
 1218 }
 1219 
 1220 void do_setup_menu(struct terminal *term, void *xxx, struct session *ses)
 1221 {
 1222     if (!anonymous) do_menu(term, setup_menu, ses);
 1223     else do_menu(term, setup_menu_anon, ses);
 1224 }
 1225 
 1226 struct menu_item main_menu[] = {
 1227     { TEXT_(T_FILE), "", TEXT_(T_HK_FILE), MENU_FUNC do_file_menu, NULL, 1, 1 },
 1228     { TEXT_(T_VIEW), "", TEXT_(T_HK_VIEW), MENU_FUNC do_view_menu, NULL, 1, 1 },
 1229     { TEXT_(T_LINK), "", TEXT_(T_HK_LINK), MENU_FUNC link_menu, NULL, 1, 1 },
 1230     { TEXT_(T_DOWNLOADS), "", TEXT_(T_HK_DOWNLOADS), MENU_FUNC downloads_menu, NULL, 1, 1 },
 1231     { TEXT_(T_SETUP), "", TEXT_(T_HK_SETUP), MENU_FUNC do_setup_menu, NULL, 1, 1 },
 1232     { TEXT_(T_HELP), "", TEXT_(T_HK_HELP), MENU_FUNC do_menu, help_menu, 1, 1 },
 1233     { NULL, NULL, 0, NULL, NULL, 0, 0 },
 1234 };
 1235 
 1236 void activate_bfu_technology(struct session *ses, int item)
 1237 {
 1238     struct terminal *term = ses->term;
 1239     do_mainmenu(term, main_menu, ses, item);
 1240 }
 1241 
 1242 struct history goto_url_history = { 0, { &goto_url_history.items, &goto_url_history.items } };
 1243 
 1244 void dialog_goto_url(struct session *ses, char *url)
 1245 {
 1246     input_field(ses->term, NULL, TEXT_(T_GOTO_URL), TEXT_(T_ENTER_URL), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &goto_url_history, MAX_INPUT_URL_LEN, url, 0, 0, NULL, (void (*)(void *, unsigned char *)) goto_url, NULL);
 1247 }
 1248 
 1249 void dialog_save_url(struct session *ses)
 1250 {
 1251     input_field(ses->term, NULL, TEXT_(T_SAVE_URL), TEXT_(T_ENTER_URL), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &goto_url_history, MAX_INPUT_URL_LEN, "", 0, 0, NULL, (void (*)(void *, unsigned char *)) save_url, NULL);
 1252 }
 1253 
 1254 struct history file_history = { 0, { &file_history.items, &file_history.items } };
 1255 
 1256 void query_file(struct session *ses, unsigned char *url, void (*std)(struct session *, unsigned char *), void (*cancel)(struct session *))
 1257 {
 1258     unsigned char *file, *def;
 1259     int dfl = 0;
 1260     int l;
 1261     get_filename_from_url(url, &file, &l);
 1262     def = init_str();
 1263     add_to_str(&def, &dfl, download_dir);
 1264     if (*def && !dir_sep(def[strlen(def) - 1])) add_chr_to_str(&def, &dfl, '/');
 1265     add_bytes_to_str(&def, &dfl, file, l);
 1266     input_field(ses->term, NULL, TEXT_(T_DOWNLOAD), TEXT_(T_SAVE_TO_FILE), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &file_history, MAX_INPUT_URL_LEN, def, 0, 0, NULL, (void (*)(void *, unsigned char *))std, (void (*)(void *))cancel);
 1267     mem_free(def);
 1268 }
 1269 
 1270 struct history search_history = { 0, { &search_history.items, &search_history.items } };
 1271 
 1272 void search_back_dlg(struct session *ses, struct f_data_c *f, int a)
 1273 {
 1274     input_field(ses->term, NULL, TEXT_(T_SEARCH_BACK), TEXT_(T_SEARCH_FOR_TEXT), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &search_history, MAX_INPUT_URL_LEN, "", 0, 0, NULL, (void (*)(void *, unsigned char *)) search_for_back, NULL);
 1275 }
 1276 
 1277 void search_dlg(struct session *ses, struct f_data_c *f, int a)
 1278 {
 1279     input_field(ses->term, NULL, TEXT_(T_SEARCH), TEXT_(T_SEARCH_FOR_TEXT), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &search_history, MAX_INPUT_URL_LEN, "", 0, 0, NULL, (void (*)(void *, unsigned char *)) search_for, NULL);
 1280 }
 1281 
 1282 void free_history_lists()
 1283 {
 1284     free_list(goto_url_history.items);
 1285     free_list(file_history.items);
 1286     free_list(search_history.items);
 1287 }
 1288