"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "menu.c" between
links-1.03.tar.gz and links-1.04.tar.gz

About: Links is a Lynx-like text WWW browser (table support and pop-up dialog boxes).

menu.c  (links-1.03):menu.c  (links-1.04)
#include "links.h" #include "links.h"
/*static inline struct session *get_term_session(struct terminal *term) static unsigned char *version_texts[] = {
TEXT_(T_LINKS_VERSION),
TEXT_(T_OPERATING_SYSTEM_TYPE),
TEXT_(T_OPERATING_SYSTEM_VERSION),
TEXT_(T_COMPILER),
TEXT_(T_WORD_SIZE),
TEXT_(T_ENCRYPTION),
#if defined(__linux__) || defined(__SPAD__) || defined(USE_GPM)
TEXT_(T_GPM_MOUSE_DRIVER),
#endif
#ifdef OS2
TEXT_(T_XTERM_FOR_OS2),
#endif
NULL,
};
void add_and_pad(unsigned char **s, int *l, struct terminal *term, unsigned char
*str, int maxlen)
{
unsigned char *x = _(str, term);
int len = strlen(x);
add_to_str(s, l, x);
add_to_str(s, l, ": ");
while (len++ < maxlen) add_chr_to_str(s, l, ' ');
}
void menu_version(struct terminal *term)
{ {
if ((void *)term->windows.prev == &term->windows) { int i;
internal("terminal has no windows"); int maxlen = 0;
return NULL; unsigned char *s;
int l;
unsigned char **text_ptr;
for (i = 0; version_texts[i]; i++) {
unsigned char *t = _(version_texts[i], term);
int tl = strlen(t);
if (tl > maxlen)
maxlen = tl;
} }
return ((struct window *)term->windows.prev)->data;
}*/ s = init_str();
l = 0;
text_ptr = version_texts;
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
add_to_str(&s, &l, VERSION_STRING);
add_to_str(&s, &l, "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
add_to_str(&s, &l, SYSTEM_NAME);
add_to_str(&s, &l, "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
add_to_str(&s, &l, system_name);
add_to_str(&s, &l, "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
add_to_str(&s, &l, compiler_name);
add_to_str(&s, &l, "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
add_to_str(&s, &l, _(TEXT_(T_MEMORY), term));
add_to_str(&s, &l, " ");
add_num_to_str(&s, &l, sizeof(void *) * 8);
add_to_str(&s, &l, "-bit, ");
add_to_str(&s, &l, _(TEXT_(T_FILE_SIZE), term));
add_to_str(&s, &l, " ");
add_num_to_str(&s, &l, sizeof(off_t) * 8 /*- ((off_t)-1 < 0)*/);
add_to_str(&s, &l, "-bit");
add_to_str(&s, &l, "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
#ifdef HAVE_SSL
add_to_str(&s, &l, (unsigned char *)SSLeay_version(SSLEAY_VERSION));
#else
add_to_str(&s, &l, _(TEXT_(T_NO), term));
#endif
add_to_str(&s, &l, "\n");
#if defined(__linux__) || defined(__SPAD__) || defined(USE_GPM)
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
#ifdef USE_GPM
add_gpm_version(&s, &l);
#else
add_to_str(&s, &l, _(TEXT_(T_NO), term));
#endif
add_to_str(&s, &l, "\n");
#endif
#ifdef OS2
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
#ifdef X2
add_to_str(&s, &l, _(TEXT_(T_YES), term));
#else
add_to_str(&s, &l, _(TEXT_(T_NO), term));
#endif
add_to_str(&s, &l, "\n");
#endif
s[l - 1] = 0;
if (*text_ptr)
internal("menu_version: text mismatched");
msg_box(term, getml(s, NULL), TEXT_(T_VERSION_INFORMATION), AL_LEFT, s, N
ULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
}
void menu_about(struct terminal *term, void *d, struct session *ses) void menu_about(struct terminal *term, void *d, struct session *ses)
{ {
msg_box(term, NULL, TEXT_(T_ABOUT), AL_CENTER, TEXT_(T_LINKS__LYNX_LIKE), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC); msg_box(term, NULL, TEXT_(T_ABOUT), AL_CENTER, TEXT_(T_LINKS__LYNX_LIKE), term, 2, TEXT_(T_OK), NULL, B_ENTER | B_ESC, TEXT_(T_VERSION), menu_version, 0) ;
} }
void menu_keys(struct terminal *term, void *d, struct session *ses) void menu_keys(struct terminal *term, void *d, struct session *ses)
{ {
msg_box(term, NULL, TEXT_(T_KEYS), AL_LEFT, TEXT_(T_KEYS_DESC), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC); msg_box(term, NULL, TEXT_(T_KEYS), AL_LEFT, TEXT_(T_KEYS_DESC), NULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
} }
void menu_copying(struct terminal *term, void *d, struct session *ses) void menu_copying(struct terminal *term, void *d, struct session *ses)
{ {
msg_box(term, NULL, TEXT_(T_COPYING), AL_CENTER, TEXT_(T_COPYING_DESC), N ULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC); msg_box(term, NULL, TEXT_(T_COPYING), AL_CENTER, TEXT_(T_COPYING_DESC), N ULL, 1, TEXT_(T_OK), NULL, B_ENTER | B_ESC);
skipping to change at line 120 skipping to change at line 216
void refresh_abort(struct dialog_data *dlg) void refresh_abort(struct dialog_data *dlg)
{ {
end_refresh(dlg->dlg->udata2); end_refresh(dlg->dlg->udata2);
} }
void cache_inf(struct terminal *term, void *d, struct session *ses) void cache_inf(struct terminal *term, void *d, struct session *ses)
{ {
unsigned char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11, *a 12, *a13, *a14, *a15, *a16; unsigned char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11, *a 12, *a13, *a14, *a15, *a16;
int l = 0; int l = 0;
struct refresh *r; struct refresh *r;
r = mem_alloc(sizeof(struct refresh)); r = mem_alloc(sizeof(struct refresh));
r->term = term; r->term = term;
r->win = NULL; r->win = NULL;
r->ses = ses; r->ses = ses;
r->fn = cache_inf; r->fn = cache_inf;
r->data = d; r->data = d;
r->timer = -1; r->timer = -1;
l = 0; l = 0;
l = 0, a1 = init_str(); add_to_str(&a1, &l, ": "); add_num_to_str(&a1, &l l = 0, a1 = init_str(); add_to_str(&a1, &l, ": "); add_unsigned_long_num_
, select_info(CI_FILES));add_to_str(&a1, &l, " "); to_str(&a1, &l, select_info(CI_FILES));add_to_str(&a1, &l, " ");
l = 0, a2 = init_str(); add_to_str(&a2, &l, ", "); add_num_to_str(&a2, &l l = 0, a2 = init_str(); add_to_str(&a2, &l, ", "); add_unsigned_long_num_
, select_info(CI_TIMERS));add_to_str(&a2, &l, " "); to_str(&a2, &l, select_info(CI_TIMERS));add_to_str(&a2, &l, " ");
l = 0, a3 = init_str(); add_to_str(&a3, &l, ".\n"); l = 0, a3 = init_str(); add_to_str(&a3, &l, ".\n");
l = 0, a4 = init_str(); add_to_str(&a4, &l, ": "); add_num_to_str(&a4, &l l = 0, a4 = init_str(); add_to_str(&a4, &l, ": "); add_unsigned_long_num_
, connect_info(CI_FILES));add_to_str(&a4, &l, " "); to_str(&a4, &l, connect_info(CI_FILES));add_to_str(&a4, &l, " ");
l = 0, a5 = init_str(); add_to_str(&a5, &l, ", "); add_num_to_str(&a5, &l l = 0, a5 = init_str(); add_to_str(&a5, &l, ", "); add_unsigned_long_num_
, connect_info(CI_CONNECTING));add_to_str(&a5, &l, " "); to_str(&a5, &l, connect_info(CI_CONNECTING));add_to_str(&a5, &l, " ");
l = 0, a6 = init_str(); add_to_str(&a6, &l, ", "); add_num_to_str(&a6, &l l = 0, a6 = init_str(); add_to_str(&a6, &l, ", "); add_unsigned_long_num_
, connect_info(CI_TRANSFER));add_to_str(&a6, &l, " "); to_str(&a6, &l, connect_info(CI_TRANSFER));add_to_str(&a6, &l, " ");
l = 0, a7 = init_str(); add_to_str(&a7, &l, ", "); add_num_to_str(&a7, &l l = 0, a7 = init_str(); add_to_str(&a7, &l, ", "); add_unsigned_long_num_
, connect_info(CI_KEEP));add_to_str(&a7, &l, " "); to_str(&a7, &l, connect_info(CI_KEEP));add_to_str(&a7, &l, " ");
l = 0, a8 = init_str(); add_to_str(&a8, &l, ".\n"); l = 0, a8 = init_str(); add_to_str(&a8, &l, ".\n");
l = 0, a9 = init_str(); add_to_str(&a9, &l, ": "); add_num_to_str(&a9, &l l = 0, a9 = init_str(); add_to_str(&a9, &l, ": "); add_unsigned_long_num_
, cache_info(CI_BYTES));add_to_str(&a9, &l, " "); to_str(&a9, &l, cache_info(CI_BYTES));add_to_str(&a9, &l, " ");
l = 0, a10 = init_str(); add_to_str(&a10, &l, ", "); add_num_to_str(&a10, l = 0, a10 = init_str(); add_to_str(&a10, &l, ", "); add_unsigned_long_nu
&l, cache_info(CI_FILES));add_to_str(&a10, &l, " "); m_to_str(&a10, &l, cache_info(CI_FILES));add_to_str(&a10, &l, " ");
l = 0, a11 = init_str(); add_to_str(&a11, &l, ", "); add_num_to_str(&a11, l = 0, a11 = init_str(); add_to_str(&a11, &l, ", "); add_unsigned_long_nu
&l, cache_info(CI_LOCKED));add_to_str(&a11, &l, " "); m_to_str(&a11, &l, cache_info(CI_LOCKED));add_to_str(&a11, &l, " ");
l = 0, a12 = init_str(); add_to_str(&a12, &l, ", "); add_num_to_str(&a12, l = 0, a12 = init_str(); add_to_str(&a12, &l, ", "); add_unsigned_long_nu
&l, cache_info(CI_LOADING));add_to_str(&a12, &l, " "); m_to_str(&a12, &l, cache_info(CI_LOADING));add_to_str(&a12, &l, " ");
l = 0, a13 = init_str(); add_to_str(&a13, &l, ".\n"); l = 0, a13 = init_str(); add_to_str(&a13, &l, ".\n");
l = 0, a14 = init_str(); add_to_str(&a14, &l, ": "); add_num_to_str(&a14, l = 0, a14 = init_str(); add_to_str(&a14, &l, ": "); add_unsigned_long_nu
&l, formatted_info(CI_FILES));add_to_str(&a14, &l, " "); m_to_str(&a14, &l, formatted_info(CI_FILES));add_to_str(&a14, &l, " ");
l = 0, a15 = init_str(); add_to_str(&a15, &l, ", "); add_num_to_str(&a15, l = 0, a15 = init_str(); add_to_str(&a15, &l, ", "); add_unsigned_long_nu
&l, formatted_info(CI_LOCKED));add_to_str(&a15, &l, " "); m_to_str(&a15, &l, formatted_info(CI_LOCKED));add_to_str(&a15, &l, " ");
l = 0, a16 = init_str(); add_to_str(&a16, &l, "."); l = 0, a16 = init_str(); add_to_str(&a16, &l, ".");
msg_box(term, getml(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a1 3, a14, a15, a16, NULL), TEXT_(T_RESOURCES), AL_LEFT | AL_EXTD_TEXT, TEXT_(T_RES OURCES), 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_DOCU MENT_CACHE), a14, TEXT_(T_DOCUMENTS), a15, TEXT_(T_LOCKED), a16, NULL, r, 1, TEX T_(T_OK), NULL, B_ENTER | B_ESC); msg_box(term, getml(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a1 3, a14, a15, a16, NULL), TEXT_(T_RESOURCES), AL_LEFT | AL_EXTD_TEXT, TEXT_(T_RES OURCES), 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_DOCU MENT_CACHE), a14, TEXT_(T_DOCUMENTS), a15, TEXT_(T_LOCKED), a16, NULL, r, 1, TEX T_(T_OK), NULL, B_ENTER | B_ESC);
r->win = term->windows.next; r->win = term->windows.next;
((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort; ((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort;
r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r); r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r);
} }
#ifdef DEBUG #if 0
void list_cache(struct terminal *term, void *d, struct session *ses) void list_cache(struct terminal *term, void *d, struct session *ses)
{ {
unsigned char *a; unsigned char *a;
int l = 0; int l = 0;
struct refresh *r; struct refresh *r;
struct cache_entry *ce, *cache; struct cache_entry *ce, *cache;
a = init_str(); a = init_str();
r = mem_alloc(sizeof(struct refresh)); r = mem_alloc(sizeof(struct refresh));
r->term = term; r->term = term;
skipping to change at line 186 skipping to change at line 283
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_E SC); 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_E SC);
r->win = term->windows.next; r->win = term->windows.next;
r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r); r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r);
/* !!! the refresh here is buggy */ /* !!! the refresh here is buggy */
} }
#endif #endif
#ifdef LEAK_DEBUG #ifdef LEAK_DEBUG
void memory_cld(struct terminal *term, void *d)
{
last_mem_amount = mem_amount;
}
#define MSG_BUF 2000 #define MSG_BUF 2000
#define MSG_W 100
void memory_info(struct terminal *term, void *d, struct session *ses) void memory_info(struct terminal *term, void *d, struct session *ses)
{ {
char message[MSG_BUF]; char message[MSG_BUF];
char *p; char *p;
struct refresh *r; struct refresh *r;
r = mem_alloc(sizeof(struct refresh)); r = mem_alloc(sizeof(struct refresh));
r->term = term; r->term = term;
r->win = NULL; r->win = NULL;
r->ses = ses; r->ses = ses;
r->fn = memory_info; r->fn = memory_info;
r->data = d; r->data = d;
r->timer = -1; r->timer = -1;
p = message; p = message;
sprintf(p, "%ld %s", mem_amount, _(TEXT_(T_MEMORY_ALLOCATED), term)), p + snprint(p, MSG_BUF, mem_amount), p += strlen(p);
= strlen(p); sprintf(p, " %s", _(TEXT_(T_MEMORY_ALLOCATED), term)), p += strlen(p);
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_am
ount), p += strlen(p);
sprintf(p, "."), p += strlen(p); sprintf(p, "."), p += strlen(p);
#if 0 && defined(MAX_LIST_SIZE) if (strlen(message) >= MSG_BUF)
if (last_mem_amount != -1) { internal("message buffer overflow");
long i, j;
int l = 0;
for (i = 0; i < MAX_LIST_SIZE; i++) if (memory_list[i].p && memor
y_list[i].p != last_memory_list[i].p) {
for (j = 0; j < MAX_LIST_SIZE; j++) if (last_memory_list[
j].p == memory_list[i].p) goto b;
if (!l) sprintf(p, "\n%s: ", _(TEXT_(T_NEW_ADDRESSES), te
rm)), p += strlen(p), l = 1;
else sprintf(p, ", "), p += strlen(p);
sprintf(p, "#%p of %d at %s:%d", memory_list[i].p, (int)m
emory_list[i].size, memory_list[i].file, memory_list[i].line), p += strlen(p);
if (p - message >= MSG_BUF - MSG_W) {
sprintf(p, ".."), p += strlen(p);
break;
}
b:;
}
if (!l) sprintf(p, "\n%s", _(TEXT_(T_NO_NEW_ADDRESSES), term)), p
+= strlen(p);
sprintf(p, "."), p += strlen(p);
}
#endif
p = stracpy(message); p = stracpy(message);
msg_box(term, getml(p, NULL), TEXT_(T_MEMORY_INFO), AL_CENTER, p, r, 1, T EXT_(T_OK), NULL, B_ENTER | B_ESC); msg_box(term, getml(p, NULL), TEXT_(T_MEMORY_INFO), AL_CENTER, p, r, 1, T EXT_(T_OK), NULL, B_ENTER | B_ESC);
r->win = term->windows.next; r->win = term->windows.next;
((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort; ((struct dialog_data *)r->win->data)->dlg->abort = refresh_abort;
r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r); r->timer = install_timer(RESOURCE_INFO_REFRESH, (void (*)(void *))refresh , r);
} }
#endif #endif
void flush_caches(struct terminal *term, void *d, void *e) void flush_caches(struct terminal *term, void *d, void *e)
{ {
shrink_memory(1); shrink_memory(1);
} }
void go_backwards(struct terminal *term, void *psteps, struct session *ses) void go_backwards(struct terminal *term, void *psteps, struct session *ses)
{ {
int steps = (int) psteps; int steps = (int)(my_uintptr_t)psteps;
/*if (ses->tq_goto_position) /*if (ses->tq_goto_position)
--steps; --steps;
if (ses->search_word) if (ses->search_word)
mem_free(ses->search_word), ses->search_word = NULL;*/ mem_free(ses->search_word), ses->search_word = NULL;*/
abort_loading(ses); abort_loading(ses);
while (steps > 1) { while (steps > 1) {
struct location *loc = ses->history.next; struct location *loc = ses->history.next;
if ((void *) loc == &ses->history) return; if ((void *) loc == &ses->history) return;
skipping to change at line 283 skipping to change at line 357
{ {
struct location *l; struct location *l;
struct menu_item *mi = NULL; struct menu_item *mi = NULL;
int n = 0; int n = 0;
foreach(l, ses->history) { foreach(l, ses->history) {
if (n/* || ses->tq_goto_position*/) { if (n/* || ses->tq_goto_position*/) {
unsigned char *url; unsigned char *url;
if (!mi && !(mi = new_menu(3))) return; if (!mi && !(mi = new_menu(3))) return;
url = stracpy(l->vs.url); url = stracpy(l->vs.url);
if (strchr(url, POST_CHAR)) *strchr(url, POST_CHAR) = 0; if (strchr(url, POST_CHAR)) *strchr(url, POST_CHAR) = 0;
add_to_menu(&mi, url, "", "", MENU_FUNC go_backwards, (vo id *) n, 0); add_to_menu(&mi, url, "", "", MENU_FUNC go_backwards, (vo id *)(my_uintptr_t)n, 0);
} }
n++; n++;
} }
if (n <= 1) do_menu(term, no_hist_menu, ses); if (n <= 1) do_menu(term, no_hist_menu, ses);
else do_menu(term, mi, ses); else do_menu(term, mi, ses);
} }
struct menu_item no_downloads_menu[] = { struct menu_item no_downloads_menu[] = {
{ TEXT_(T_NO_DOWNLOADS), "", M_BAR, NULL, NULL, 0, 0 }, { TEXT_(T_NO_DOWNLOADS), "", M_BAR, NULL, NULL, 0, 0 },
{ NULL, NULL, 0, NULL, NULL, 0, 0 }, { NULL, NULL, 0, NULL, NULL, 0, 0 },
skipping to change at line 330 skipping to change at line 404
head_msg(ses); head_msg(ses);
} }
void menu_toggle(struct terminal *term, void *ddd, struct session *ses) void menu_toggle(struct terminal *term, void *ddd, struct session *ses)
{ {
toggle(ses, ses->screen, 0); toggle(ses, ses->screen, 0);
} }
void display_codepage(struct terminal *term, void *pcp, struct session *ses) void display_codepage(struct terminal *term, void *pcp, struct session *ses)
{ {
int cp = (int)pcp; int cp = (int)(my_uintptr_t)pcp;
struct term_spec *t = new_term_spec(term->term); struct term_spec *t = new_term_spec(term->term);
if (t) t->charset = cp; if (t) t->charset = cp;
cls_redraw_all_terminals(); cls_redraw_all_terminals();
} }
void assumed_codepage(struct terminal *term, void *pcp, struct session *ses) void assumed_codepage(struct terminal *term, void *pcp, struct session *ses)
{ {
int cp = (int)pcp; int cp = (int)(my_uintptr_t)pcp;
ses->ds.assume_cp = cp; ses->ds.assume_cp = cp;
redraw_terminal_cls(term); redraw_terminal_cls(term);
} }
void charset_list(struct terminal *term, void *xxx, struct session *ses) void charset_list(struct terminal *term, void *xxx, struct session *ses)
{ {
int i, sel; int i, sel;
unsigned char *n; unsigned char *n;
struct menu_item *mi; struct menu_item *mi;
if (!(mi = new_menu(1))) return; if (!(mi = new_menu(1))) return;
for (i = 0; (n = get_cp_name(i)); i++) { for (i = 0; (n = get_cp_name(i)); i++) {
if (is_cp_special(i)) continue; if (is_cp_special(i)) continue;
add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC display_codepa ge, (void *)i, 0); add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC display_codepa ge, (void *)(my_uintptr_t)i, 0);
} }
sel = ses->term->spec->charset; sel = ses->term->spec->charset;
if (sel < 0) sel = 0; if (sel < 0) sel = 0;
do_menu_selected(term, mi, ses, sel); do_menu_selected(term, mi, ses, sel, NULL, NULL);
} }
void set_val(struct terminal *term, void *ip, int *d) void set_val(struct terminal *term, void *ip, int *d)
{ {
*d = (int)ip; *d = (int)(my_uintptr_t)ip;
} }
void charset_sel_list(struct terminal *term, struct session *ses, int *ptr) void charset_sel_list(struct terminal *term, struct session *ses, int *ptr)
{ {
int i, sel; int i, sel;
unsigned char *n; unsigned char *n;
struct menu_item *mi; struct menu_item *mi;
if (!(mi = new_menu(1))) return; if (!(mi = new_menu(1))) return;
for (i = 0; (n = get_cp_name(i)); i++) { for (i = 0; (n = get_cp_name(i)); i++) {
add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC set_val, (void *)i, 0); add_to_menu(&mi, get_cp_name(i), "", "", MENU_FUNC set_val, (void *)(my_uintptr_t)i, 0);
} }
sel = *ptr; sel = *ptr;
if (sel < 0) sel = 0; if (sel < 0) sel = 0;
do_menu_selected(term, mi, ptr, sel); do_menu_selected(term, mi, ptr, sel, NULL, NULL);
} }
void terminal_options_ok(void *p) void terminal_options_ok(void *p)
{ {
cls_redraw_all_terminals(); cls_redraw_all_terminals();
} }
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 }; 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 };
void terminal_options(struct terminal *term, void *xxx, struct session *ses) void terminal_options(struct terminal *term, void *xxx, struct session *ses)
skipping to change at line 581 skipping to change at line 655
} }
unsigned char max_c_str[3]; unsigned char max_c_str[3];
unsigned char max_cth_str[3]; unsigned char max_cth_str[3];
unsigned char max_t_str[3]; unsigned char max_t_str[3];
unsigned char time_str[5]; unsigned char time_str[5];
unsigned char unrtime_str[5]; unsigned char unrtime_str[5];
void refresh_net(void *xxx) void refresh_net(void *xxx)
{ {
netcfg_stamp++;
/*abort_all_connections();*/ /*abort_all_connections();*/
max_connections = atoi(max_c_str); max_connections = atoi(max_c_str);
max_connections_to_host = atoi(max_cth_str); max_connections_to_host = atoi(max_cth_str);
max_tries = atoi(max_t_str); max_tries = atoi(max_t_str);
receive_timeout = atoi(time_str); receive_timeout = atoi(time_str);
unrestartable_receive_timeout = atoi(unrtime_str); unrestartable_receive_timeout = atoi(unrtime_str);
abort_background_connections();
register_bottom_half(check_queue, NULL); register_bottom_half(check_queue, NULL);
} }
unsigned char *net_msg[] = { unsigned char *net_msg[] = {
TEXT_(T_HTTP_PROXY__HOST_PORT), TEXT_(T_HTTP_PROXY__HOST_PORT),
TEXT_(T_FTP_PROXY__HOST_PORT), TEXT_(T_FTP_PROXY__HOST_PORT),
TEXT_(T_MAX_CONNECTIONS), TEXT_(T_MAX_CONNECTIONS),
TEXT_(T_MAX_CONNECTIONS_TO_ONE_HOST), TEXT_(T_MAX_CONNECTIONS_TO_ONE_HOST),
TEXT_(T_RETRIES), TEXT_(T_RETRIES),
TEXT_(T_RECEIVE_TIMEOUT_SEC), TEXT_(T_RECEIVE_TIMEOUT_SEC),
skipping to change at line 969 skipping to change at line 1045
d->items[9].type = D_BUTTON; d->items[9].type = D_BUTTON;
d->items[9].gid = B_ESC; d->items[9].gid = B_ESC;
d->items[9].fn = cancel_dialog; d->items[9].fn = cancel_dialog;
d->items[9].text = TEXT_(T_CANCEL); d->items[9].text = TEXT_(T_CANCEL);
d->items[10].type = D_END; d->items[10].type = D_END;
do_dialog(term, d, getml(d, NULL)); do_dialog(term, d, getml(d, NULL));
} }
void menu_set_language(struct terminal *term, void *pcp, struct session *ses) void menu_set_language(struct terminal *term, void *pcp, struct session *ses)
{ {
set_language((int)pcp); set_language((int)(my_uintptr_t)pcp);
cls_redraw_all_terminals(); cls_redraw_all_terminals();
} }
void menu_language_list(struct terminal *term, void *xxx, struct session *ses) void menu_language_list(struct terminal *term, void *xxx, struct session *ses)
{ {
int i, sel; int i, sel;
unsigned char *n; unsigned char *n;
struct menu_item *mi; struct menu_item *mi;
if (!(mi = new_menu(1))) return; if (!(mi = new_menu(1))) return;
for (i = 0; i < n_languages(); i++) { for (i = 0; i < n_languages(); i++) {
n = language_name(i); n = language_name(i);
add_to_menu(&mi, n, "", "", MENU_FUNC menu_set_language, (void *) i, 0); add_to_menu(&mi, n, "", "", MENU_FUNC menu_set_language, (void *) (my_uintptr_t)i, 0);
} }
sel = current_language; sel = current_language;
do_menu_selected(term, mi, ses, sel); do_menu_selected(term, mi, ses, sel, NULL, NULL);
} }
unsigned char *resize_texts[] = { TEXT_(T_COLUMNS), TEXT_(T_ROWS) }; unsigned char *resize_texts[] = { TEXT_(T_COLUMNS), TEXT_(T_ROWS) };
unsigned char x_str[4]; unsigned char x_str[4];
unsigned char y_str[4]; unsigned char y_str[4];
void do_resize_terminal(struct terminal *term) void do_resize_terminal(struct terminal *term)
{ {
unsigned char str[8]; unsigned char str[8];
strcpy(str, x_str); strcpy(str, x_str);
strcat(str, ","); strcat(str, ",");
strcat(str, y_str); strcat(str, y_str);
do_terminal_function(term, TERM_FN_RESIZE, str); do_terminal_function(term, TERM_FN_RESIZE, str);
} }
void dlg_resize_terminal(struct terminal *term, void *xxx, struct session *ses) void dlg_resize_terminal(struct terminal *term, void *xxx, struct session *ses)
{ {
struct dialog *d; struct dialog *d;
int x = term->x > 999 ? 999 : term->x; unsigned x = (unsigned)term->x > 999 ? 999 : term->x;
int y = term->y > 999 ? 999 : term->y; unsigned y = (unsigned)term->y > 999 ? 999 : term->y;
sprintf(x_str, "%d", x); sprintf(x_str, "%u", x);
sprintf(y_str, "%d", y); sprintf(y_str, "%u", y);
d = mem_alloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item)); d = mem_alloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
memset(d, 0, sizeof(struct dialog) + 5 * sizeof(struct dialog_item)); memset(d, 0, sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
d->title = TEXT_(T_RESIZE_TERMINAL); d->title = TEXT_(T_RESIZE_TERMINAL);
d->fn = group_fn; d->fn = group_fn;
d->udata = resize_texts; d->udata = resize_texts;
d->refresh = (void (*)(void *))do_resize_terminal; d->refresh = (void (*)(void *))do_resize_terminal;
d->refresh_data = term; d->refresh_data = term;
d->items[0].type = D_FIELD; d->items[0].type = D_FIELD;
d->items[0].dlen = 4; d->items[0].dlen = 4;
d->items[0].data = x_str; d->items[0].data = x_str;
skipping to change at line 1122 skipping to change at line 1198
e->text = TEXT_(T_OS_SHELL); e->text = TEXT_(T_OS_SHELL);
e->rtext = ""; e->rtext = "";
e->hotkey = TEXT_(T_HK_OS_SHELL); e->hotkey = TEXT_(T_HK_OS_SHELL);
e->func = MENU_FUNC menu_shell; e->func = MENU_FUNC menu_shell;
e->data = NULL; e->data = NULL;
e->in_m = 0; e->in_m = 0;
e->free_i = 0; e->free_i = 0;
e++; e++;
x = 0; x = 0;
} }
if (can_resize_window(term->environment)) { if (can_resize_window(term)) {
e->text = TEXT_(T_RESIZE_TERMINAL); e->text = TEXT_(T_RESIZE_TERMINAL);
e->rtext = ""; e->rtext = "";
e->hotkey = TEXT_(T_HK_RESIZE_TERMINAL); e->hotkey = TEXT_(T_HK_RESIZE_TERMINAL);
e->func = MENU_FUNC dlg_resize_terminal; e->func = MENU_FUNC dlg_resize_terminal;
e->data = NULL; e->data = NULL;
e->in_m = 0; e->in_m = 0;
e->free_i = 0; e->free_i = 0;
e++; e++;
x = 0; x = 0;
} }
skipping to change at line 1191 skipping to change at line 1267
{ NULL, NULL, 0, NULL, NULL, 0, 0 }, { NULL, NULL, 0, NULL, NULL, 0, 0 },
}; };
struct menu_item ext_menu[] = { struct menu_item ext_menu[] = {
{ TEXT_(T_ADD), "", TEXT_(T_HK_ADD), MENU_FUNC menu_add_ext, NULL, 0, 0 } , { TEXT_(T_ADD), "", TEXT_(T_HK_ADD), MENU_FUNC menu_add_ext, NULL, 0, 0 } ,
{ TEXT_(T_MODIFY), ">", TEXT_(T_HK_MODIFY), MENU_FUNC menu_list_ext, menu _add_ext, 1, 0 }, { TEXT_(T_MODIFY), ">", TEXT_(T_HK_MODIFY), MENU_FUNC menu_list_ext, menu _add_ext, 1, 0 },
{ TEXT_(T_DELETE), ">", TEXT_(T_HK_DELETE), MENU_FUNC menu_list_ext, menu _del_ext, 1, 0 }, { TEXT_(T_DELETE), ">", TEXT_(T_HK_DELETE), MENU_FUNC menu_list_ext, menu _del_ext, 1, 0 },
{ NULL, NULL, 0, NULL, NULL, 0, 0 }, { NULL, NULL, 0, NULL, NULL, 0, 0 },
}; };
static void menu_write_config(struct terminal *term, void *xxx, void *yyy)
{
write_config(term);
}
struct menu_item setup_menu[] = { struct menu_item setup_menu[] = {
{ TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_l ist, NULL, 1, 0 }, { TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_l ist, NULL, 1, 0 },
{ TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC chars et_list, (void *)1, 1, 0 }, { TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC chars et_list, (void *)1, 1, 0 },
{ TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 }, { TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 },
{ TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC ne t_options, NULL, 0, 0 }, { TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC ne t_options, NULL, 0, 0 },
{ TEXT_(T_CACHE), "", TEXT_(T_HK_CACHE), MENU_FUNC cache_opt, NULL, 0, 0 }, { TEXT_(T_CACHE), "", TEXT_(T_HK_CACHE), MENU_FUNC cache_opt, NULL, 0, 0 },
{ TEXT_(T_MAIL_AND_TELNEL), "", TEXT_(T_HK_MAIL_AND_TELNEL), MENU_FUNC ne t_programs, NULL, 0, 0 }, { TEXT_(T_MAIL_AND_TELNEL), "", TEXT_(T_HK_MAIL_AND_TELNEL), MENU_FUNC ne t_programs, NULL, 0, 0 },
{ TEXT_(T_ASSOCIATIONS), ">", TEXT_(T_HK_ASSOCIATIONS), MENU_FUNC do_menu , assoc_menu, 1, 0 }, { TEXT_(T_ASSOCIATIONS), ">", TEXT_(T_HK_ASSOCIATIONS), MENU_FUNC do_menu , assoc_menu, 1, 0 },
{ TEXT_(T_FILE_EXTENSIONS), ">", TEXT_(T_HK_FILE_EXTENSIONS), MENU_FUNC d o_menu, ext_menu, 1, 0 }, { TEXT_(T_FILE_EXTENSIONS), ">", TEXT_(T_HK_FILE_EXTENSIONS), MENU_FUNC d o_menu, ext_menu, 1, 0 },
{ "", "", M_BAR, NULL, NULL, 0, 0 }, { "", "", M_BAR, NULL, NULL, 0, 0 },
{ TEXT_(T_SAVE_OPTIONS), "", TEXT_(T_HK_SAVE_OPTIONS), MENU_FUNC write_co nfig, NULL, 0, 0 }, { TEXT_(T_SAVE_OPTIONS), "", TEXT_(T_HK_SAVE_OPTIONS), MENU_FUNC menu_wri te_config, NULL, 0, 0 },
{ NULL, NULL, 0, NULL, NULL, 0, 0 }, { NULL, NULL, 0, NULL, NULL, 0, 0 },
}; };
struct menu_item setup_menu_anon[] = { struct menu_item setup_menu_anon[] = {
{ TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_l ist, NULL, 1, 0 }, { TEXT_(T_LANGUAGE), ">", TEXT_(T_HK_LANGUAGE), MENU_FUNC menu_language_l ist, NULL, 1, 0 },
{ TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC chars et_list, (void *)1, 1, 0 }, { TEXT_(T_CHARACTER_SET), ">", TEXT_(T_HK_CHARACTER_SET), MENU_FUNC chars et_list, (void *)1, 1, 0 },
{ TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 }, { TEXT_(T_TERMINAL_OPTIONS), "", TEXT_(T_HK_TERMINAL_OPTIONS), MENU_FUNC terminal_options, NULL, 0, 0 },
/*{ TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC net_options, NULL, 0, 0,}*/ /*{ TEXT_(T_NETWORK_OPTIONS), "", TEXT_(T_HK_NETWORK_OPTIONS), MENU_FUNC net_options, NULL, 0, 0,}*/
{ NULL, NULL, 0, NULL, NULL, 0, 0 }, { NULL, NULL, 0, NULL, NULL, 0, 0 },
}; };
skipping to change at line 1261 skipping to change at line 1342
} }
struct history file_history = { 0, { &file_history.items, &file_history.items } }; struct history file_history = { 0, { &file_history.items, &file_history.items } };
void query_file(struct session *ses, unsigned char *url, void (*std)(struct sess ion *, unsigned char *), void (*cancel)(struct session *)) void query_file(struct session *ses, unsigned char *url, void (*std)(struct sess ion *, unsigned char *), void (*cancel)(struct session *))
{ {
unsigned char *file, *def; unsigned char *file, *def;
int dfl = 0; int dfl = 0;
int l; int l;
get_filename_from_url(url, &file, &l); get_filename_from_url(url, &file, &l);
file = memacpy(file, l);
check_filename(&file);
def = init_str(); def = init_str();
add_to_str(&def, &dfl, download_dir); add_to_str(&def, &dfl, download_dir);
if (*def && !dir_sep(def[strlen(def) - 1])) add_chr_to_str(&def, &dfl, '/ '); if (*def && !dir_sep(def[strlen(def) - 1])) add_chr_to_str(&def, &dfl, '/ ');
add_bytes_to_str(&def, &dfl, file, l); add_to_str(&def, &dfl, file);
mem_free(file);
input_field(ses->term, NULL, TEXT_(T_DOWNLOAD), TEXT_(T_SAVE_TO_FILE), TE XT_(T_OK), TEXT_(T_CANCEL), ses, &file_history, MAX_INPUT_URL_LEN, def, 0, 0, NU LL, (void (*)(void *, unsigned char *))std, (void (*)(void *))cancel); input_field(ses->term, NULL, TEXT_(T_DOWNLOAD), TEXT_(T_SAVE_TO_FILE), TE XT_(T_OK), TEXT_(T_CANCEL), ses, &file_history, MAX_INPUT_URL_LEN, def, 0, 0, NU LL, (void (*)(void *, unsigned char *))std, (void (*)(void *))cancel);
mem_free(def); mem_free(def);
} }
struct history search_history = { 0, { &search_history.items, &search_history.it ems } }; struct history search_history = { 0, { &search_history.items, &search_history.it ems } };
void search_back_dlg(struct session *ses, struct f_data_c *f, int a) void search_back_dlg(struct session *ses, struct f_data_c *f, int a)
{ {
input_field(ses->term, NULL, TEXT_(T_SEARCH_BACK), TEXT_(T_SEARCH_FOR_TEX T), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &search_history, MAX_INPUT_URL_LEN, "", 0 , 0, NULL, (void (*)(void *, unsigned char *)) search_for_back, NULL); input_field(ses->term, NULL, TEXT_(T_SEARCH_BACK), TEXT_(T_SEARCH_FOR_TEX T), TEXT_(T_OK), TEXT_(T_CANCEL), ses, &search_history, MAX_INPUT_URL_LEN, "", 0 , 0, NULL, (void (*)(void *, unsigned char *)) search_for_back, NULL);
} }
 End of changes. 34 change blocks. 
86 lines changed or deleted 164 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)