Commit: 970d6962b259ea8656de7c82c7955ef6db12c7fb
Parent: a576c69a2daf0a668ddac6e52de257b9faed5267
Author: 0x766F6964
Date: Sun, 2 Aug 2020 08:55:27 -0600
remove #define F 0 line and related code
Diffstat:
M | bfu.c | | | 226 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
M | html.c | | | 166 | ++++++++++++++++++++++++++++++++++++++----------------------------------------- |
M | html_r.c | | | 33 | ++++++++++++++++----------------- |
M | html_tbl.c | | | 143 | ++++++++++++++++++++++++++++++++++--------------------------------------------- |
M | http.c | | | 2 | +- |
M | links.h | | | 20 | ++++++++------------ |
M | listedit.c | | | 32 | +++++++++++++------------------- |
M | main.c | | | 32 | ++++++++++++-------------------- |
M | menu.c | | | 105 | +++++++++++++++++++++++++++++++++++-------------------------------------------- |
M | select.c | | | 10 | ++++------ |
M | session.c | | | 51 | ++++++++++++++++++++++----------------------------- |
M | setup.h | | | 4 | ++-- |
M | terminal.c | | | 124 | ++++++++++++++++++++++++++++++++++++------------------------------------------- |
M | view.c | | | 149 | ++++++++++++++++++++++++++++++++++++------------------------------------------- |
14 files changed, 503 insertions(+), 594 deletions(-)
diff --git a/bfu.c b/bfu.c
@@ -471,41 +471,40 @@ void do_mainmenu(struct terminal *term, struct menu_item *items, void *data, int
static void display_mainmenu(struct terminal *term, void *menu_)
{
struct mainmenu *menu = (struct mainmenu *)menu_;
- if (!F) {
- int i;
- int p = 2;
- fill_area(term, 0, 0, term->x, 1, ' ', COLOR_MAINMENU);
- for (i = 0; i < menu->ni; i++) {
- int s = 0;
- unsigned c;
- unsigned char *tmptext = get_text_translation(menu->items[i].text, term);
- unsigned char co;
- if (i == menu->selected) {
+ int i;
+ int p = 2;
+ fill_area(term, 0, 0, term->x, 1, ' ', COLOR_MAINMENU);
+ for (i = 0; i < menu->ni; i++) {
+ int s = 0;
+ unsigned c;
+ unsigned char *tmptext = get_text_translation(menu->items[i].text, term);
+ unsigned char co;
+ if (i == menu->selected) {
+ s = 1;
+ co = COLOR_MAINMENU_SELECTED;
+ } else {
+ co = COLOR_MAINMENU;
+ }
+ if (i == menu->selected) {
+ fill_area(term, p, 0, 2, 1, ' ', co);
+ menu->sp = p;
+ set_cursor(term, p, 0, term->x - 1, term->y - 1);
+ set_window_ptr(menu->win, p, 1);
+ }
+ p += 2;
+ for (;; p++) {
+ c = GET_TERM_CHAR(term, &tmptext);
+ if (!c) break;
+ if (!s && charset_upcase(c, term_charset(term)) == menu->hotkeys[i]) {
s = 1;
- co = COLOR_MAINMENU_SELECTED;
- } else
- co = COLOR_MAINMENU;
- if (i == menu->selected) {
- fill_area(term, p, 0, 2, 1, ' ', co);
- menu->sp = p;
- set_cursor(term, p, 0, term->x - 1, term->y - 1);
- set_window_ptr(menu->win, p, 1);
- }
- p += 2;
- for (;; p++) {
- c = GET_TERM_CHAR(term, &tmptext);
- if (!c) break;
- if (!s && charset_upcase(c, term_charset(term)) == menu->hotkeys[i]) {
- s = 1;
- set_char(term, p, 0, c, COLOR_MAINMENU_HOTKEY);
- } else
- set_char(term, p, 0, c, co);
- }
- if (i == menu->selected) {
- fill_area(term, p, 0, 2, 1, ' ', co);
+ set_char(term, p, 0, c, COLOR_MAINMENU_HOTKEY);
+ } else {
+ set_char(term, p, 0, c, co);
}
- p += 2;
}
+ if (i == menu->selected)
+ fill_area(term, p, 0, 2, 1, ' ', co);
+ p += 2;
}
}
@@ -674,67 +673,70 @@ void do_dialog(struct terminal *term, struct dialog *dlg, struct memory_list *ml
void display_dlg_item(struct dialog_data *dlg, struct dialog_item_data *di, int sel)
{
struct terminal *term = dlg->win->term;
- if (!F) switch (di->item->type) {
- unsigned char co;
- unsigned char *text, *t;
- int vposlen, cposlen;
- case D_CHECKBOX:
- /* radio or checkbox */
- if (di->checked) print_text(term, di->x, di->y, 3, cast_uchar "[X]", COLOR_DIALOG_CHECKBOX);
- else print_text(term, di->x, di->y, 3, cast_uchar "[ ]", COLOR_DIALOG_CHECKBOX);
- if (sel) {
- set_cursor(term, di->x + 1, di->y, di->x + 1, di->y);
- set_window_ptr(dlg->win, di->x, di->y);
- }
- break;
- case D_FIELD:
- case D_FIELD_PASS:
- fill_area(term, di->x, di->y, di->l, 1, ' ', COLOR_DIALOG_FIELD);
- if (di->vpos > di->cpos) di->vpos = di->cpos;
- vposlen = strlen((char *)(di->cdata + di->vpos));
- cposlen = strlen((char *)(di->cdata + di->cpos));
- if (!di->l) {
- di->vpos = di->cpos;
- vposlen = cposlen;
- } else {
- while (vposlen - cposlen > di->l - 1) {
- t = di->cdata + di->vpos;
- GET_TERM_CHAR(term, &t);
- di->vpos = (int)(t - di->cdata);
- vposlen--;
- }
- }
- if (di->item->type == D_FIELD_PASS) {
- t = xmalloc(vposlen + 1);
- memset(t, '*', vposlen);
- t[vposlen] = 0;
- } else {
+ unsigned char co;
+ unsigned char *text, *t;
+ int vposlen, cposlen;
+
+ switch (di->item->type) {
+ case D_CHECKBOX:
+ /* radio or checkbox */
+ if (di->checked)
+ print_text(term, di->x, di->y, 3, cast_uchar "[X]", COLOR_DIALOG_CHECKBOX);
+ else
+ print_text(term, di->x, di->y, 3, cast_uchar "[ ]", COLOR_DIALOG_CHECKBOX);
+ if (sel) {
+ set_cursor(term, di->x + 1, di->y, di->x + 1, di->y);
+ set_window_ptr(dlg->win, di->x, di->y);
+ }
+ break;
+ case D_FIELD:
+ case D_FIELD_PASS:
+ fill_area(term, di->x, di->y, di->l, 1, ' ', COLOR_DIALOG_FIELD);
+ if (di->vpos > di->cpos) di->vpos = di->cpos;
+ vposlen = strlen((char *)(di->cdata + di->vpos));
+ cposlen = strlen((char *)(di->cdata + di->cpos));
+ if (!di->l) {
+ di->vpos = di->cpos;
+ vposlen = cposlen;
+ } else {
+ while (vposlen - cposlen > di->l - 1) {
t = di->cdata + di->vpos;
+ GET_TERM_CHAR(term, &t);
+ di->vpos = (int)(t - di->cdata);
+ vposlen--;
}
- print_text(term, di->x, di->y, di->l, t, COLOR_DIALOG_FIELD_TEXT);
- if (di->item->type == D_FIELD_PASS)
- free(t);
- if (sel) {
- set_cursor(term, di->x + vposlen - cposlen,
- di->y, di->x + vposlen - cposlen, di->y);
- set_window_ptr(dlg->win, di->x, di->y);
- }
- break;
- case D_BUTTON:
- co = sel ? COLOR_DIALOG_BUTTON_SELECTED : COLOR_DIALOG_BUTTON;
- text = get_text_translation(di->item->text, term);
- print_text(term, di->x, di->y, 2, cast_uchar "[ ", co);
- print_text(term, di->x + 2, di->y, strlen((char *)text), text, co);
- print_text(term, di->x + 2 + strlen((char *)text),
- di->y, 2, cast_uchar " ]", co);
- if (sel) {
- set_cursor(term, di->x + 2, di->y, di->x + 2,
- di->y);
- set_window_ptr(dlg->win, di->x, di->y);
- }
- break;
- default:
- internal("display_dlg_item: unknown item: %d", di->item->type);
+ }
+ if (di->item->type == D_FIELD_PASS) {
+ t = xmalloc(vposlen + 1);
+ memset(t, '*', vposlen);
+ t[vposlen] = 0;
+ } else {
+ t = di->cdata + di->vpos;
+ }
+ print_text(term, di->x, di->y, di->l, t, COLOR_DIALOG_FIELD_TEXT);
+ if (di->item->type == D_FIELD_PASS)
+ free(t);
+ if (sel) {
+ set_cursor(term, di->x + vposlen - cposlen,
+ di->y, di->x + vposlen - cposlen, di->y);
+ set_window_ptr(dlg->win, di->x, di->y);
+ }
+ break;
+ case D_BUTTON:
+ co = sel ? COLOR_DIALOG_BUTTON_SELECTED : COLOR_DIALOG_BUTTON;
+ text = get_text_translation(di->item->text, term);
+ print_text(term, di->x, di->y, 2, cast_uchar "[ ", co);
+ print_text(term, di->x + 2, di->y, strlen((char *)text), text, co);
+ print_text(term, di->x + 2 + strlen((char *)text),
+ di->y, 2, cast_uchar " ]", co);
+ if (sel) {
+ set_cursor(term, di->x + 2, di->y, di->x + 2,
+ di->y);
+ set_window_ptr(dlg->win, di->x, di->y);
+ }
+ break;
+ default:
+ internal("display_dlg_item: unknown item: %d", di->item->type);
}
}
@@ -847,7 +849,7 @@ static int dlg_mouse(struct dialog_data *dlg, struct dialog_item_data *di, struc
if (!*t) break;
GET_UTF_8(t, u);
if (!u) continue;
- if (!F) p++;
+ p++;
if (p > ev->x) break;
}
}
@@ -1427,22 +1429,21 @@ void center_dlg(struct dialog_data *dlg)
void draw_dlg(struct dialog_data *dlg)
{
- if (!F) {
- int i, tpos;
- struct terminal *term = dlg->win->term;
- fill_area(term, dlg->x, dlg->y, dlg->xw, dlg->yw, ' ',
- COLOR_DIALOG);
- draw_frame(term, dlg->x + DIALOG_LEFT_BORDER,
- dlg->y + DIALOG_TOP_BORDER,
- dlg->xw - 2 * DIALOG_LEFT_BORDER,
- dlg->yw - 2 * DIALOG_TOP_BORDER, COLOR_DIALOG_FRAME,
- DIALOG_FRAME);
- i = strlen((char *)get_text_translation(dlg->dlg->title, term));
- tpos = (dlg->xw - i) / 2;
- print_text(term, tpos + dlg->x - 1, dlg->y + DIALOG_TOP_BORDER, 1, cast_uchar " ", COLOR_DIALOG_TITLE);
- print_text(term, tpos + dlg->x, dlg->y + DIALOG_TOP_BORDER, i, get_text_translation(dlg->dlg->title, term), COLOR_DIALOG_TITLE);
- print_text(term, tpos + dlg->x + i, dlg->y + DIALOG_TOP_BORDER, 1, cast_uchar " ", COLOR_DIALOG_TITLE);
- }
+ int i, tpos;
+ struct terminal *term = dlg->win->term;
+
+ fill_area(term, dlg->x, dlg->y, dlg->xw, dlg->yw, ' ',
+ COLOR_DIALOG);
+ draw_frame(term, dlg->x + DIALOG_LEFT_BORDER,
+ dlg->y + DIALOG_TOP_BORDER,
+ dlg->xw - 2 * DIALOG_LEFT_BORDER,
+ dlg->yw - 2 * DIALOG_TOP_BORDER, COLOR_DIALOG_FRAME,
+ DIALOG_FRAME);
+ i = strlen((char *)get_text_translation(dlg->dlg->title, term));
+ tpos = (dlg->xw - i) / 2;
+ print_text(term, tpos + dlg->x - 1, dlg->y + DIALOG_TOP_BORDER, 1, cast_uchar " ", COLOR_DIALOG_TITLE);
+ print_text(term, tpos + dlg->x, dlg->y + DIALOG_TOP_BORDER, i, get_text_translation(dlg->dlg->title, term), COLOR_DIALOG_TITLE);
+ print_text(term, tpos + dlg->x + i, dlg->y + DIALOG_TOP_BORDER, 1, cast_uchar " ", COLOR_DIALOG_TITLE);
}
void max_text_width(struct terminal *term, unsigned char *text, int *width, int align)
@@ -1457,7 +1458,7 @@ void max_text_width(struct terminal *term, unsigned char *text, int *width, int
} else {
int u;
GET_UTF_8(text, u);
- if (!F) c++;
+ c++;
}
}
if (c > *width) *width = c;
@@ -1476,7 +1477,7 @@ void min_text_width(struct terminal *term, unsigned char *text, int *width, int
} else {
int u;
GET_UTF_8(text, u);
- if (!F) c++;
+ c++;
}
}
if (c > *width) *width = c;
@@ -1487,7 +1488,7 @@ int dlg_format_text(struct dialog_data *dlg, struct terminal *term, unsigned cha
{
int xx = x;
text = get_text_translation(text, dlg->win->term);
- if (!F) while (1) {
+ for (;;) {
unsigned char *t1;
unsigned ch;
int cx, lbr;
@@ -1680,8 +1681,7 @@ void dlg_format_group(struct dialog_data *dlg, struct terminal *term, unsigned c
(*y) += 2 * LL;
}
if (term) {
- if (!F)
- print_text(term, x + nx + 4 * (item->item->type == D_CHECKBOX), *y, strlen((char *)get_text_translation(texts[0], dlg->win->term)), get_text_translation(texts[0], dlg->win->term), COLOR_DIALOG_TEXT);
+ print_text(term, x + nx + 4 * (item->item->type == D_CHECKBOX), *y, strlen((char *)get_text_translation(texts[0], dlg->win->term)), get_text_translation(texts[0], dlg->win->term), COLOR_DIALOG_TEXT);
item->x = x + nx + sl * (item->item->type != D_CHECKBOX);
item->y = *y;
if (item->item->type == D_FIELD || item->item->type == D_FIELD_PASS) item->l = gf_val(item->item->dlen, item->item->dlen * G_DIALOG_FIELD_WIDTH);
diff --git a/html.c b/html.c
@@ -944,14 +944,14 @@ static void html_a_special(unsigned char *a, unsigned char *next, unsigned char
static void html_sub(unsigned char *a)
{
- if (!F) put_chrs(cast_uchar "_", 1);
+ put_chrs(cast_uchar "_", 1);
format_.fontsize = 1;
format_.baseline = -1;
}
static void html_sup(unsigned char *a)
{
- if (!F) put_chrs(cast_uchar "^", 1);
+ put_chrs(cast_uchar "^", 1);
format_.fontsize = 1;
if (format_.baseline <= 0) format_.baseline = format_.fontsize;
}
@@ -1002,8 +1002,7 @@ static void html_img(unsigned char *a)
unsigned char *s;
unsigned char *orig_link = NULL;
int ismap, usemap = 0;
- /*put_chrs(cast_uchar " ", 1);*/
- if ((!F || !d_opt->display_images) && ((al = get_url_val(a, cast_uchar "usemap")))) {
+ if ((al = get_url_val(a, cast_uchar "usemap"))) {
unsigned char *u;
usemap = 1;
html_stack_dup();
@@ -1016,7 +1015,7 @@ static void html_img(unsigned char *a)
free(u);
free(al);
}
- ismap = format_.link && (F || !has_attr(a, cast_uchar "usemap")) && has_attr(a, cast_uchar "ismap");
+ ismap = format_.link && !has_attr(a, cast_uchar "usemap") && has_attr(a, cast_uchar "ismap");
free(format_.image);
format_.image = NULL;
if ((s = get_url_val_img(a, cast_uchar "data-defer-src"))
@@ -1041,48 +1040,47 @@ static void html_img(unsigned char *a)
skip_img:
orig_link = s;
}
- if (!F || !d_opt->display_images) {
- if ((!(al = get_attr_val(a, cast_uchar "alt"))
- && !(al = get_attr_val(a, cast_uchar "title")))
- || !*al) {
- free(al);
- if (!d_opt->images && !format_.link)
- goto ret;
- if (d_opt->image_names && s) {
- unsigned char *ss;
- al = stracpy(cast_uchar "[");
- if (!(ss = cast_uchar strrchr(cast_const_char s, '/')))
- ss = s;
- else
- ss++;
- add_to_strn(&al, ss);
- if ((ss = cast_uchar strchr(cast_const_char al, '?')))
- *ss = 0;
- if ((ss = cast_uchar strchr(cast_const_char al, '&')))
- *ss = 0;
- add_to_strn(&al, cast_uchar "]");
- } else if (usemap)
- al = stracpy(cast_uchar "[USEMAP]");
- else if
- (ismap) al = stracpy(cast_uchar "[ISMAP]");
+ if ((!(al = get_attr_val(a, cast_uchar "alt"))
+ && !(al = get_attr_val(a, cast_uchar "title")))
+ || !*al) {
+ free(al);
+ if (!d_opt->images && !format_.link)
+ goto ret;
+ if (d_opt->image_names && s) {
+ unsigned char *ss;
+ al = stracpy(cast_uchar "[");
+ if (!(ss = cast_uchar strrchr(cast_const_char s, '/')))
+ ss = s;
else
- al = stracpy(cast_uchar "[IMG]");
- }
- if (al) {
- if (ismap) {
- unsigned char *h;
- html_stack_dup();
- h = stracpy(format_.link);
- add_to_strn(&h, cast_uchar "?0,0");
- free(format_.link);
- format_.link = h;
- }
- html_format_changed = 1;
- put_chrs(al, (int)strlen(cast_const_char al));
- if (ismap) kill_html_stack_item(&html_top);
+ ss++;
+ add_to_strn(&al, ss);
+ if ((ss = cast_uchar strchr(cast_const_char al, '?')))
+ *ss = 0;
+ if ((ss = cast_uchar strchr(cast_const_char al, '&')))
+ *ss = 0;
+ add_to_strn(&al, cast_uchar "]");
+ } else if (usemap) {
+ al = stracpy(cast_uchar "[USEMAP]");
+ } else if (ismap) {
+ al = stracpy(cast_uchar "[ISMAP]");
+ } else {
+ al = stracpy(cast_uchar "[IMG]");
}
- free(al);
}
+ if (al) {
+ if (ismap) {
+ unsigned char *h;
+ html_stack_dup();
+ h = stracpy(format_.link);
+ add_to_strn(&h, cast_uchar "?0,0");
+ free(format_.link);
+ format_.link = h;
+ }
+ html_format_changed = 1;
+ put_chrs(al, (int)strlen(cast_const_char al));
+ if (ismap) kill_html_stack_item(&html_top);
+ }
+ free(al);
ret:
free(format_.image);
format_.image = NULL;
@@ -1137,10 +1135,6 @@ static void html_body(unsigned char *a)
get_color(a, cast_uchar "text", &format_.fg);
get_color(a, cast_uchar "link", &format_.clink);
if (has_attr(a, cast_uchar "onload")) special_f(ff, SP_SCRIPT, NULL);
- /*
- get_bgcolor(a, &format_.bg);
- get_bgcolor(a, &par_format.bgcolor);
- */
}
static void html_skip(unsigned char *a)
@@ -1182,7 +1176,7 @@ static void html_style(unsigned char *a)
static void html_center(unsigned char *a)
{
par_format.align = AL_CENTER;
- if (!table_level && !F) par_format.leftmargin = par_format.rightmargin = 0;
+ if (!table_level) par_format.leftmargin = par_format.rightmargin = 0;
}
static void html_linebrk(unsigned char *a)
@@ -1193,7 +1187,7 @@ static void html_linebrk(unsigned char *a)
if (!casestrcmp(al, cast_uchar "right")) par_format.align = AL_RIGHT;
if (!casestrcmp(al, cast_uchar "center")) {
par_format.align = AL_CENTER;
- if (!table_level && !F) par_format.leftmargin = par_format.rightmargin = 0;
+ if (!table_level) par_format.leftmargin = par_format.rightmargin = 0;
}
if (!casestrcmp(al, cast_uchar "justify")) par_format.align = AL_BLOCK;
free(al);
@@ -1300,25 +1294,28 @@ static void html_hr(unsigned char *a)
{
int i;
int q = get_num(a, cast_uchar "size");
+ unsigned char r = 205;
+
html_stack_dup();
par_format.align = AL_CENTER;
free(format_.link);
format_.link = NULL;
format_.form = NULL;
html_linebrk(a);
- if (par_format.align == AL_BLOCK) par_format.align = AL_CENTER;
+ if (par_format.align == AL_BLOCK)
+ par_format.align = AL_CENTER;
par_format.leftmargin = margin;
par_format.rightmargin = margin;
i = get_width(a, cast_uchar "width", 1);
- if (!F) {
- unsigned char r = 205;
- if (q >= 0 && q < 2) r = 196;
- if (i < 0) i = par_format.width - 2 * margin - 4;
- format_.attr = AT_GRAPHICS;
- special_f(ff, SP_NOWRAP, 1);
- while (i-- > 0) put_chrs(&r, 1);
- special_f(ff, SP_NOWRAP, 0);
- }
+ if (q >= 0 && q < 2)
+ r = 196;
+ if (i < 0)
+ i = par_format.width - 2 * margin - 4;
+ format_.attr = AT_GRAPHICS;
+ special_f(ff, SP_NOWRAP, 1);
+ while (i-- > 0)
+ put_chrs(&r, 1);
+ special_f(ff, SP_NOWRAP, 0);
ln_break(2);
kill_html_stack_item(&html_top);
}
@@ -1406,7 +1403,7 @@ static void html_ol(unsigned char *a)
if (!strcmp(cast_const_char al, "I")) par_format.flags = P_ROMAN;
free(al);
}
- if (!F) if ((par_format.leftmargin += (par_format.list_level > 1)) > par_format.width * 2 / 3 && !table_level)
+ if ((par_format.leftmargin += (par_format.list_level > 1)) > par_format.width * 2 / 3 && !table_level)
par_format.leftmargin = par_format.width * 2 / 3;
par_format.align = AL_LEFT;
html_top.dontkill = 1;
@@ -1420,7 +1417,7 @@ static void html_li(unsigned char *a)
if ((par_format.flags & P_LISTMASK) == P_O) x[0] = 'o';
if ((par_format.flags & P_LISTMASK) == P_PLUS) x[0] = '+';
put_chrs(x, 7);
- if (!F) par_format.leftmargin += 2;
+ par_format.leftmargin += 2;
par_format.align = AL_LEFT;
putsp = -1;
} else {
@@ -1448,7 +1445,7 @@ static void html_li(unsigned char *a)
} else sprintf(cast_char n, "%d", par_format.list_number);
put_chrs((unsigned char *)n, strlen(n));
put_chrs(cast_uchar ". ", 7);
- if (!F) par_format.leftmargin += (int)strlen(cast_const_char n) + c + 2;
+ par_format.leftmargin += (int)strlen(cast_const_char n) + c + 2;
par_format.align = AL_LEFT;
list_struct(html_top.list_entry.next, struct html_element)->parattr.list_number = par_format.list_number + 1;
par_format.list_number = 0;
@@ -1663,11 +1660,9 @@ static void set_max_textarea_width(int *w)
} else {
limit = gf_val(d_opt->xw - 2, d_opt->xw - G_SCROLL_BAR_WIDTH - 2 * G_HTML_MARGIN * d_opt->margin);
}
- if (!F) {
- if (*w > limit) {
- *w = limit;
- if (*w < HTML_MINIMAL_TEXTAREA_WIDTH) *w = HTML_MINIMAL_TEXTAREA_WIDTH;
- }
+ if (*w > limit) {
+ *w = limit;
+ if (*w < HTML_MINIMAL_TEXTAREA_WIDTH) *w = HTML_MINIMAL_TEXTAREA_WIDTH;
}
}
@@ -1749,19 +1744,19 @@ static void html_input(unsigned char *a)
put_chrs(cast_uchar "[ ]", 8);
break;
case FC_IMAGE:
- if (!F || !d_opt->display_images) {
- free(format_.image);
- format_.image = NULL;
- if ((al = get_url_val(a, cast_uchar "src")) || (al = get_url_val(a, cast_uchar "dynsrc"))) {
- format_.image = join_urls(format_.href_base, al);
- free(al);
- }
- format_.attr |= AT_BOLD | AT_FIXED;
- put_chrs(cast_uchar "[ ", 7);
- if (fc->alt) put_chrs(fc->alt, (int)strlen(cast_const_char fc->alt));
- else put_chrs(cast_uchar "Submit", 6);
- put_chrs(cast_uchar " ]", 7);
- } else html_img(a);
+ free(format_.image);
+ format_.image = NULL;
+ if ((al = get_url_val(a, cast_uchar "src")) || (al = get_url_val(a, cast_uchar "dynsrc"))) {
+ format_.image = join_urls(format_.href_base, al);
+ free(al);
+ }
+ format_.attr |= AT_BOLD | AT_FIXED;
+ put_chrs(cast_uchar "[ ", 7);
+ if (fc->alt)
+ put_chrs(fc->alt, (int)strlen(cast_const_char fc->alt));
+ else
+ put_chrs(cast_uchar "Submit", 6);
+ put_chrs(cast_uchar " ]", 7);
break;
case FC_SUBMIT:
case FC_RESET:
@@ -2252,11 +2247,10 @@ static void do_html_textarea(unsigned char *attr, unsigned char *html, unsigned
cols++;
set_max_textarea_width(&cols);
if ((rows = get_num(attr, cast_uchar "rows")) <= 0) rows = HTML_DEFAULT_TEXTAREA_HEIGHT;
- if (!F) {
- if (rows > d_opt->yw) {
- rows = d_opt->yw;
- if (rows <= 0) rows = 1;
- }
+ if (rows > d_opt->yw) {
+ rows = d_opt->yw;
+ if (rows <= 0)
+ rows = 1;
}
fc->cols = cols;
fc->rows = rows;
diff --git a/html_r.c b/html_r.c
@@ -110,9 +110,8 @@ static void clear_formatted(struct f_data *scr)
free(l->pos);
}
free(scr->links);
- if (!F)
- for (y = 0; y < scr->y; y++)
- free(scr->data[y].d);
+ for (y = 0; y < scr->y; y++)
+ free(scr->data[y].d);
free(scr->data);
free(scr->lines1);
free(scr->lines2);
@@ -1156,6 +1155,8 @@ void really_format_html(struct cache_entry *ce, unsigned char *start, unsigned c
unsigned char *bg = NULL, *bgcolor = NULL;
int implicit_pre_wrap;
int bg_col, fg_col;
+ struct part *rp;
+
current_f_data = screen;
d_opt = &screen->opt;
screen->use_tag = ce->count;
@@ -1185,25 +1186,23 @@ void really_format_html(struct cache_entry *ce, unsigned char *start, unsigned c
last_form_tag = NULL;
last_form_attr = NULL;
last_input_tag = NULL;
- if (!F) {
- struct part *rp;
- if ((rp = format_html_part(start, end, par_format.align, par_format.leftmargin, screen->opt.xw, screen, 0, 0, head, 1)))
- free(rp);
- }
+ if ((rp = format_html_part(start, end, par_format.align, par_format.leftmargin, screen->opt.xw, screen, 0, 0, head, 1)))
+ free(rp);
free(head);
free(bg);
free(bgcolor);
- if (!F) {
- screen->x = 0;
- for (i = screen->y - 1; i >= 0; i--) {
- if (!screen->data[i].l) {
- free(screen->data[i].d);
- screen->y--;
- } else
- break;
+ screen->x = 0;
+ for (i = screen->y - 1; i >= 0; i--) {
+ if (!screen->data[i].l) {
+ free(screen->data[i].d);
+ screen->y--;
+ } else {
+ break;
}
- for (i = 0; i < screen->y; i++) if (screen->data[i].l > screen->x) screen->x = screen->data[i].l;
}
+ for (i = 0; i < screen->y; i++)
+ if (screen->data[i].l > screen->x)
+ screen->x = screen->data[i].l;
free(form.action);
free(form.target);
free(form.form_name);
diff --git a/html_tbl.c b/html_tbl.c
@@ -629,19 +629,23 @@ static struct table *parse_table(unsigned char *html, unsigned char *eof, unsign
static void get_cell_width(struct table *t, struct table_cell *c, int w, int a, int *min, int *max, int *n_links)
{
- if (min) *min = -1;
- if (max) *max = -1;
- if (n_links) *n_links = c->link_num;
- if (!F) {
- struct part *p;
- if (!(p = format_html_part(c->start, c->end, c->align == AL_NO || c->align == AL_NO_BREAKABLE ? c->align : AL_LEFT, t->cellpd, w, NULL, !!a, !!a, NULL, c->link_num))) return;
- if (min) *min = p->x;
- if (max) *max = p->xmax;
- if (n_links) *n_links = p->link_num;
- free(p);
- }
- /*debug("get_cell_width: %d < %d", *min, *max);*/
- /*if (min && max && *min > *max) internal("get_cell_width: %d > %d", *min, *max);*/
+ struct part *p;
+
+ if (min)
+ *min = -1;
+ if (max)
+ *max = -1;
+ if (n_links)
+ *n_links = c->link_num;
+ if (!(p = format_html_part(c->start, c->end, c->align == AL_NO || c->align == AL_NO_BREAKABLE ? c->align : AL_LEFT, t->cellpd, w, NULL, !!a, !!a, NULL, c->link_num)))
+ return;
+ if (min)
+ *min = p->x;
+ if (max)
+ *max = p->xmax;
+ if (n_links)
+ *n_links = p->link_num;
+ free(p);
}
#define g_c_w(cc) \
@@ -744,10 +748,8 @@ static int get_column_widths(struct table *t)
/*int pp = t->max_c[i];*/
int m = 0;
for (k = 1; k < s; k++) {
- if (!F) {
- if (get_vline_width(t, i + k) >= 0)
- p = safe_add(p, 1);
- }
+ if (get_vline_width(t, i + k) >= 0)
+ p = safe_add(p, 1);
}
dst_width(t->min_c + i, s, c->min_width - p, t->max_c + i);
dst_width(t->max_c + i, s, c->max_width - p - m, NULL);
@@ -763,19 +765,16 @@ static void get_table_width(struct table *t)
int i, vl;
int min = 0, max = 0;
for (i = 0; i < t->x; i++) {
- if (!F)
- vl = get_vline_width(t, i) >= 0;
+ vl = get_vline_width(t, i) >= 0;
min = safe_add(min, vl);
max = safe_add(max, vl);
min = safe_add(min, t->min_c[i]);
if (t->xcols[i] > t->max_c[i]) max = safe_add(max, t->xcols[i]);
max = safe_add(max, t->max_c[i]);
}
- if (!F) {
- vl = (!!(t->frame & F_LHS) + !!(t->frame & F_RHS)) * !!t->border;
- min = safe_add(min, vl);
- max = safe_add(max, vl);
- }
+ vl = (!!(t->frame & F_LHS) + !!(t->frame & F_RHS)) * !!t->border;
+ min = safe_add(min, vl);
+ max = safe_add(max, vl);
t->min_t = min;
t->max_t = max;
}
@@ -999,23 +998,17 @@ static void get_table_heights(struct table *t)
struct part *p;
int xw = 0, sp;
if (!cell->used || cell->spanned) continue;
- /*
- fprintf(stderr, "i==%d, w_c[i]==%d, min_c[i]==%d, max_c[i]==%d\n", i, t->w_c[i], t->min_c[i], t->max_c[i]);
- */
for (sp = 0; sp < cell->colspan; sp++) {
xw = safe_add(xw, t->w_c[i + sp]);
if (sp < cell->colspan - 1) {
- if (!F) {
- if (get_vline_width(t, i + sp + 1) >= 0)
- xw = safe_add(xw, 1);
- }
+ if (get_vline_width(t, i + sp + 1) >= 0)
+ xw = safe_add(xw, 1);
}
}
- if (!F) {
- if (!(p = format_html_part(cell->start, cell->end, cell->align, t->cellpd, xw, NULL, 2, 2, NULL, cell->link_num))) return;
- cell->height = p->y;
- free(p);
- }
+ if (!(p = format_html_part(cell->start, cell->end, cell->align, t->cellpd, xw, NULL, 2, 2, NULL, cell->link_num)))
+ return;
+ cell->height = p->y;
+ free(p);
}
}
s = 1;
@@ -1028,23 +1021,19 @@ static void get_table_heights(struct table *t)
if (cell->rowspan == s) {
int k, p = 0;
for (k = 1; k < s; k++) {
- if (!F) {
- if (get_hline_width(t, j + k) >= 0)
- p = safe_add(p, 1);
- }
+ if (get_hline_width(t, j + k) >= 0)
+ p = safe_add(p, 1);
}
dst_width(t->r_heights + j, s, cell->height - p, NULL);
} else if (cell->rowspan > s && cell->rowspan < ns) ns = cell->rowspan;
}
}
} while ((s = ns) != INT_MAX);
- if (!F) {
- t->rh = (!!(t->frame & F_ABOVE) + !!(t->frame & F_BELOW)) * !!t->border;
- for (j = 0; j < t->y; j++) {
- t->rh = safe_add(t->rh, t->r_heights[j]);
- if (j && get_hline_width(t, j) >= 0)
- t->rh = safe_add(t->rh, 1);
- }
+ t->rh = (!!(t->frame & F_ABOVE) + !!(t->frame & F_BELOW)) * !!t->border;
+ for (j = 0; j < t->y; j++) {
+ t->rh = safe_add(t->rh, t->r_heights[j]);
+ if (j && get_hline_width(t, j) >= 0)
+ t->rh = safe_add(t->rh, 1);
}
}
@@ -1147,12 +1136,6 @@ static void get_table_frame(struct table *t, short *fv, short *fh)
if ((ysp = cell->rowspan) == 0) ysp = t->y - j;
if (t->rules != R_NONE && t->rules != R_COLS) for (x = 0; x < xsp; x++) {H_LINE_X(i + x, j) = t->cellsp; H_LINE_X(i + x, j + ysp) = t->cellsp;}
if (t->rules != R_NONE && t->rules != R_ROWS) for (y = 0; y < ysp; y++) {V_LINE_X(i, j + y) = t->cellsp; V_LINE_X(i + xsp, j + y) = t->cellsp;}
- if (F) {
- for (x = 0; x < xsp; x++) for (y = 1; y < ysp; y++)
- H_LINE_X(i + x, j + y) = -2;
- for (x = 1; x < xsp; x++) for (y = 0; y < ysp; y++)
- V_LINE_X(i + x, j + y) = -2;
- }
}
if (t->rules == R_GROUPS) {
for (i = 1; i < t->x; i++) {
@@ -1228,7 +1211,8 @@ static void display_table_frames(struct table *t, int x, int y)
void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof, unsigned char **end, void *f)
{
- struct part *p = !F ? f : NULL;
+ struct part *p = f;
+ int bg, fg;
int border, cellsp, vcellpd, cellpd, align;
int frame, rules, width, wf;
struct rgb bgcolor;
@@ -1245,31 +1229,29 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
table_level++;
memcpy(&bgcolor, &par_format.bgcolor, sizeof(struct rgb));
get_bgcolor(attr, &bgcolor);
- if (!F) {
- int bg = find_nearest_color(&bgcolor, 8);
- int fg = find_nearest_color(&d_opt->default_fg, 16);
- /*fg = fg_color(fg, bg);*/
- AF = ATTR_FRAME | get_attribute(fg, bg);
- }
+ bg = find_nearest_color(&bgcolor, 8);
+ fg = find_nearest_color(&d_opt->default_fg, 16);
+ AF = ATTR_FRAME | get_attribute(fg, bg);
html_stack_dup();
html_top.dontkill = 1;
par_format.align = AL_LEFT;
if ((border = get_num(attr, cast_uchar "border")) == -1) border = has_attr(attr, cast_uchar "border") || has_attr(attr, cast_uchar "rules") || has_attr(attr, cast_uchar "frame");
- /*if (!border) border = 1;*/
if ((cellsp = get_num(attr, cast_uchar "cellspacing")) == -1) cellsp = gf_val(1, 2);
if ((cellpd = get_num(attr, cast_uchar "cellpadding")) == -1) {
vcellpd = gf_val(0, 1);
cellpd = gf_val(!!border, 1);
} else {
- if (!F) {
- vcellpd = cellpd >= HTML_CHAR_HEIGHT / 2 + 1;
- cellpd = cellpd >= HTML_CHAR_WIDTH / 2 + 1;
- } else vcellpd = cellpd;
- }
- if (!F && !border) cellsp = 0;
- else if (!F && !cellsp) cellsp = 1;
- if (!F && border > 2) border = 2;
- if (!F && cellsp > 2) cellsp = 2;
+ vcellpd = cellpd >= HTML_CHAR_HEIGHT / 2 + 1;
+ cellpd = cellpd >= HTML_CHAR_WIDTH / 2 + 1;
+ }
+ if (!border)
+ cellsp = 0;
+ else if (!cellsp)
+ cellsp = 1;
+ if (border > 2)
+ border = 2;
+ if (cellsp > 2)
+ cellsp = 2;
align = par_format.align;
if (align == AL_NO || align == AL_NO_BREAKABLE || align == AL_BLOCK) align = AL_LEFT;
if ((al = get_attr_val(attr, cast_uchar "summary"))) {
@@ -1352,7 +1334,7 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
if (safe_add(t->min_t, safe_add(par_format.leftmargin, par_format.rightmargin) * gf_val(1, G_HTML_MARGIN)) > gf_val(p->x, gp->x)) *gf_val(&p->x, &gp->x) = t->min_t + (par_format.leftmargin + par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
goto ret2;
}
- if (!F && !cpd_pass && t->min_t > width && t->cellpd) {
+ if (!cpd_pass && t->min_t > width && t->cellpd) {
t->cellpd = 0;
cpd_pass = 1;
cpd_width = t->min_t;
@@ -1363,11 +1345,10 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
cpd_pass = 2;
goto again;
}
- /*debug("%d %d %d", t->min_t, t->max_t, width);*/
if (t->min_t >= width) distribute_widths(t, t->min_t);
else if (t->max_t < width && wf) distribute_widths(t, t->max_t);
else distribute_widths(t, width);
- if (!F && !p->data && p->xp == 1) {
+ if (!p->data && p->xp == 1) {
int ww = safe_add(t->rw, safe_add(par_format.leftmargin, par_format.rightmargin));
if (ww > par_format.width) ww = par_format.width;
if (ww < t->rw) ww = t->rw;
@@ -1376,7 +1357,7 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
goto ret2;
}
#ifdef HTML_TABLE_2ND_PASS
- if (!F) check_table_widths(t);
+ check_table_widths(t);
#endif
get_table_heights(t);
@@ -1405,7 +1386,8 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
ret2:
*gf_val(&p->link_num, &gp->link_num) = t->link_num;
- if (!F) if (p->cy > p->y) p->y = p->cy;
+ if (p->cy > p->y)
+ p->y = p->cy;
if (t) free_table(t);
kill_html_stack_item(&html_top);
table_level--;
@@ -1448,11 +1430,9 @@ void *find_table_cache_entry(unsigned char *start, unsigned char *end, int align
struct table_cache_entry *tce;
for (tce = table_cache_hash[hash]; tce; tce = tce->hash_next) {
if (tce->start == start && tce->end == end && tce->align == align && tce->m == m && tce->width == width && tce->xs == xs && tce->link_num == link_num) {
- if (!F) {
- struct part *p = xmalloc(sizeof(struct part));
- memcpy(p, &tce->u.p, sizeof(struct part));
- return p;
- }
+ struct part *p = xmalloc(sizeof(struct part));
+ memcpy(p, &tce->u.p, sizeof(struct part));
+ return p;
}
}
return NULL;
@@ -1469,8 +1449,7 @@ void add_table_cache_entry(unsigned char *start, unsigned char *end, int align,
tce->width = width;
tce->xs = xs;
tce->link_num = link_num;
- if (!F)
- memcpy(&tce->u.p, p, sizeof(struct part));
+ memcpy(&tce->u.p, p, sizeof(struct part));
hash = make_hash(start, xs);
tce->hash_next = table_cache_hash[hash];
table_cache_hash[hash] = tce;
diff --git a/http.c b/http.c
@@ -419,7 +419,7 @@ static void add_user_agent(unsigned char **hdr, int *l, const char *url)
add_to_str(hdr, l, cast_uchar("Links (" VERSION "; "));
add_to_str(hdr, l, system_name);
add_to_str(hdr, l, cast_uchar "; ");
- if (!F && !list_empty(terminals)) {
+ if (!list_empty(terminals)) {
unsigned char *t = cast_uchar "text";
add_to_str(hdr, l, t);
} else {
diff --git a/links.h b/links.h
@@ -72,8 +72,6 @@ do { \
(ret_) = (call_); \
} while (!(ret_) && errno == EINTR)
-#define F 0
-
#define gf_val(x, y) (x)
#define MAX_STR_LEN 1024
@@ -1456,16 +1454,14 @@ static inline void ds2do(struct document_setup *ds, struct document_options *doo
doo->display_images = ds->display_images;
doo->image_scale = ds->image_scale;
doo->porn_enable = ds->porn_enable;
- if (!F) {
- if (!col) {
- doo->default_fg = palette_16_colors[7];
- doo->default_bg = palette_16_colors[0];
- doo->default_link = palette_16_colors[15];
- } else {
- doo->default_fg = palette_16_colors[ds->t_text_color];
- doo->default_bg = palette_16_colors[ds->t_background_color];
- doo->default_link = palette_16_colors[ds->t_link_color];
- }
+ if (!col) {
+ doo->default_fg = palette_16_colors[7];
+ doo->default_bg = palette_16_colors[0];
+ doo->default_link = palette_16_colors[15];
+ } else {
+ doo->default_fg = palette_16_colors[ds->t_text_color];
+ doo->default_bg = palette_16_colors[ds->t_background_color];
+ doo->default_link = palette_16_colors[ds->t_link_color];
}
}
diff --git a/listedit.c b/listedit.c
@@ -790,9 +790,7 @@ static void redraw_list_element(struct terminal *term, struct dialog_data *dlg,
int b;
unsigned char element;
- if (!F) {
- color = l == ld->current_pos ? COLOR_MENU_SELECTED : COLOR_MENU_TEXT;
- }
+ color = l == ld->current_pos ? COLOR_MENU_SELECTED : COLOR_MENU_TEXT;
txt = ld->type_item(term, l, 1);
if (!txt) {
@@ -856,12 +854,10 @@ static void redraw_list_element(struct terminal *term, struct dialog_data *dlg,
}
}
- if (!F) {
- print_text(term, dlg->x + x + DIALOG_LB, y, w-x, txt, color);
- x += strlen((char *)txt);
- fill_area(term, dlg->x+DIALOG_LB+x, y, w-x, 1, ' ', 0);
- set_line_color(term, dlg->x + DIALOG_LB + x, y, w-x, color);
- }
+ print_text(term, dlg->x + x + DIALOG_LB, y, w-x, txt, color);
+ x += strlen((char *)txt);
+ fill_area(term, dlg->x+DIALOG_LB+x, y, w-x, 1, ' ', 0);
+ set_line_color(term, dlg->x + DIALOG_LB + x, y, w-x, color);
free(txt);
}
@@ -873,7 +869,7 @@ static void redraw_list(struct terminal *term, void *bla)
struct dialog_data *dlg = rd->dlg;
int y, a;
struct list *l;
- int w = dlg->xw - 2 * DIALOG_LB - (F ? sirka_scrollovadla : 0);
+ int w = dlg->xw - 2 * DIALOG_LB;
y = dlg->y + DIALOG_TB;
for (a = 0, l = ld->win_offset; a < ld->n_items; ) {
@@ -883,7 +879,7 @@ static void redraw_list(struct terminal *term, void *bla)
y += gf_val(1, G_BFU_FONT_SIZE);
if (l == ld->list) break;
}
- if (!F) fill_area(term, dlg->x + DIALOG_LB, y, w, ld->n_items-a, ' ', COLOR_MENU_TEXT);
+ fill_area(term, dlg->x + DIALOG_LB, y, w, ld->n_items-a, ' ', COLOR_MENU_TEXT);
}
@@ -895,12 +891,12 @@ static void redraw_list_line(struct terminal *term, void *bla)
struct list_description *ld = rd->ld;
struct dialog_data *dlg = rd->dlg;
int direction = rd->n;
- int w = dlg->xw - 2 * DIALOG_LB - (F ? sirka_scrollovadla : 0);
+ int w = dlg->xw - 2 * DIALOG_LB;
int y = dlg->y + DIALOG_TB + gf_val(ld->win_pos, ld->win_pos * G_BFU_FONT_SIZE);
struct list *l;
redraw_list_element(term, dlg, y, w, ld, ld->current_pos);
- if (!F && !term->spec->block_cursor) {
+ if (!term->spec->block_cursor) {
set_cursor(term, dlg->x + DIALOG_LB, y, dlg->x + DIALOG_LB, y);
}
y += gf_val(direction, direction * G_BFU_FONT_SIZE);
@@ -928,9 +924,7 @@ static void redraw_list_line(struct terminal *term, void *bla)
/* direction: -1=up, 1=down */
static void scroll_list(struct terminal *term, void *bla)
{
- if (!F) {
- redraw_list(term, bla);
- }
+ redraw_list(term, bla);
}
@@ -954,7 +948,7 @@ static void list_find_next(struct redraw_data *rd, int direction)
if (l!=item) l->type|=2;
draw_to_window(dlg->win,redraw_list,rd);
- if (!F && !ses->term->spec->block_cursor)
+ if (!ses->term->spec->block_cursor)
set_cursor(ses->term, dlg->x + DIALOG_LB,
dlg->y + DIALOG_TB + ld->win_pos,
dlg->x + DIALOG_LB,
@@ -1219,7 +1213,7 @@ static int list_event_handler(struct dialog_data *dlg, struct links_event *ev)
(ev->y)<(dlg->y+DIALOG_TB)||
(ev->y)>=(dlg->y+DIALOG_TB+gf_val(ld->n_items,G_BFU_FONT_SIZE*(ld->n_items)))||
(ev->x)<(dlg->x+DIALOG_LB)||
- (ev->x)>(dlg->x+dlg->xw-DIALOG_LB-(F?sirka_scrollovadla:0))
+ (ev->x)>(dlg->x+dlg->xw-DIALOG_LB)
)break; /* out of the dialog */
n=(ev->y-dlg->y-DIALOG_TB)/gf_val(1,G_BFU_FONT_SIZE);
@@ -1251,7 +1245,7 @@ static int list_event_handler(struct dialog_data *dlg, struct links_event *ev)
(ev->y)<(dlg->y+DIALOG_TB)||
(ev->y)>=(dlg->y+DIALOG_TB+gf_val(ld->n_items,G_BFU_FONT_SIZE*(ld->n_items)))||
(ev->x)<(dlg->x+DIALOG_LB)||
- (ev->x)>(dlg->x+dlg->xw-DIALOG_LB-(F?sirka_scrollovadla:0))
+ (ev->x)>(dlg->x+dlg->xw-DIALOG_LB)
)goto skip_item_click; /* out of the dialog */
n=(ev->y-dlg->y-DIALOG_TB)/gf_val(1,G_BFU_FONT_SIZE);
diff --git a/main.c b/main.c
@@ -97,8 +97,7 @@ void sig_tstp(void *t_)
struct terminal *t = (struct terminal *)t_;
pid_t pid, newpid;
EINTRLOOP(pid, getpid());
- if (!F)
- block_itrm(1);
+ block_itrm(1);
EINTRLOOP(newpid, fork());
if (!newpid) {
while (1) {
@@ -124,8 +123,7 @@ static void poll_fg(void *t_)
struct terminal *t = (struct terminal *)t_;
int r;
fg_poll_timer = NULL;
- if (!F)
- r = unblock_itrm(1);
+ r = unblock_itrm(1);
if (r == -1)
fg_poll_timer = install_timer(FG_POLL_TIME, poll_fg, t);
if (r == -2) {
@@ -136,25 +134,23 @@ static void poll_fg(void *t_)
void sig_cont(void *t_)
{
- if (!F)
- unblock_itrm(1);
+ unblock_itrm(1);
}
static void handle_basic_signals(struct terminal *term)
{
install_signal_handler(SIGHUP, sig_intr, term, 0);
- if (!F) install_signal_handler(SIGINT, sig_ctrl_c, term, 0);
- /*install_signal_handler(SIGTERM, sig_terminate, term, 0);*/
- if (!F) install_signal_handler(SIGTSTP, sig_tstp, term, 0);
- if (!F) install_signal_handler(SIGTTIN, sig_tstp, term, 0);
+ install_signal_handler(SIGINT, sig_ctrl_c, term, 0);
+ install_signal_handler(SIGTSTP, sig_tstp, term, 0);
+ install_signal_handler(SIGTTIN, sig_tstp, term, 0);
install_signal_handler(SIGTTOU, sig_ign, term, 0);
- if (!F) install_signal_handler(SIGCONT, sig_cont, term, 0);
+ install_signal_handler(SIGCONT, sig_cont, term, 0);
}
void unhandle_terminal_signals(struct terminal *term)
{
install_signal_handler(SIGHUP, NULL, NULL, 0);
- if (!F) install_signal_handler(SIGINT, NULL, NULL, 0);
+ install_signal_handler(SIGINT, NULL, NULL, 0);
install_signal_handler(SIGTSTP, NULL, NULL, 0);
install_signal_handler(SIGTTIN, NULL, NULL, 0);
install_signal_handler(SIGTTOU, NULL, NULL, 0);
@@ -168,8 +164,7 @@ void unhandle_terminal_signals(struct terminal *term)
static void unhandle_basic_signals(struct terminal *term)
{
install_signal_handler(SIGHUP, NULL, NULL, 0);
- if (!F) install_signal_handler(SIGINT, NULL, NULL, 0);
- /*install_signal_handler(SIGTERM, NULL, NULL, 0);*/
+ install_signal_handler(SIGINT, NULL, NULL, 0);
install_signal_handler(SIGTSTP, NULL, NULL, 0);
install_signal_handler(SIGTTIN, NULL, NULL, 0);
install_signal_handler(SIGTTOU, NULL, NULL, 0);
@@ -325,10 +320,8 @@ static void init(void)
load_url_history();
initialize_all_subsystems_2();
info = create_session_info(base_session, u, default_target, &len);
- if (!F) {
- if (attach_terminal(info, len) < 0)
- fatal_exit("Could not open initial session");
- }
+ if (attach_terminal(info, len) < 0)
+ fatal_exit("Could not open initial session");
} else {
unsigned char *uu, *uuu, *wd;
initialize_all_subsystems_2();
@@ -372,8 +365,7 @@ static void terminate_all_subsystems(void)
check_bottom_halves();
destroy_all_terminals();
check_bottom_halves();
- if (!F)
- free_all_itrms();
+ free_all_itrms();
release_object(&dump_obj);
abort_all_connections();
diff --git a/menu.c b/menu.c
@@ -199,7 +199,7 @@ void query_exit(struct session *ses)
ses->exit_query = 1;
msg_box(ses->term, NULL, TEXT_(T_EXIT_LINKS), AL_CENTER,
only_one_term && are_there_downloads() ? TEXT_(T_DO_YOU_REALLY_WANT_TO_EXIT_LINKS_AND_TERMINATE_ALL_DOWNLOADS) :
- !F || only_one_term ? TEXT_(T_DO_YOU_REALLY_WANT_TO_EXIT_LINKS) :
+ 1 || only_one_term ? TEXT_(T_DO_YOU_REALLY_WANT_TO_EXIT_LINKS) :
TEXT_(T_DO_YOU_REALLY_WANT_TO_CLOSE_WINDOW),
MSG_BOX_END,
(void *)ses, 2, TEXT_(T_YES), really_exit_prog, B_ENTER, TEXT_(T_NO), dont_exit_prog, B_ESC);
@@ -1455,8 +1455,7 @@ void dialog_html_options(struct session *ses)
int a;
snprint(marg_str, 2, ses->ds.margin);
- if (!F)
- d = mem_calloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
+ d = mem_calloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
d->title = TEXT_(T_HTML_OPTIONS);
d->fn = group_fn;
d->udata = (void *)gf_val(html_texts, html_texts_g);
@@ -1484,16 +1483,14 @@ void dialog_html_options(struct session *ses)
d->items[a].data = (unsigned char *) &ses->ds.image_names;
d->items[a].dlen = sizeof(int);
a++;
- if (!F) {
- d->items[a].type = D_CHECKBOX;
- d->items[a].data = (unsigned char *) &ses->ds.table_order;
- d->items[a].dlen = sizeof(int);
- a++;
- d->items[a].type = D_CHECKBOX;
- d->items[a].data = (unsigned char *) &ses->ds.num_links;
- d->items[a].dlen = sizeof(int);
- a++;
- }
+ d->items[a].type = D_CHECKBOX;
+ d->items[a].data = (unsigned char *) &ses->ds.table_order;
+ d->items[a].dlen = sizeof(int);
+ a++;
+ d->items[a].type = D_CHECKBOX;
+ d->items[a].data = (unsigned char *) &ses->ds.num_links;
+ d->items[a].dlen = sizeof(int);
+ a++;
d->items[a].type = D_CHECKBOX;
d->items[a].data = (unsigned char *) &ses->ds.auto_refresh;
d->items[a].dlen = sizeof(int);
@@ -1585,28 +1582,26 @@ static void menu_color(struct terminal *term, void *xxx, void *ses_)
d->refresh = html_color_refresh;
d->refresh_data = ses;
- if (!F) {
- d->items[0].type = D_BUTTON;
- d->items[0].gid = 0;
- d->items[0].text = TEXT_(T_TEXT_COLOR);
- d->items[0].fn = select_color_16;
- d->items[0].data = (unsigned char *)&ses->ds.t_text_color;
- d->items[0].dlen = sizeof(int);
-
- d->items[1].type = D_BUTTON;
- d->items[1].gid = 0;
- d->items[1].text = TEXT_(T_LINK_COLOR);
- d->items[1].fn = select_color_16;
- d->items[1].data = (unsigned char *)&ses->ds.t_link_color;
- d->items[1].dlen = sizeof(int);
-
- d->items[2].type = D_BUTTON;
- d->items[2].gid = 0;
- d->items[2].text = TEXT_(T_BACKGROUND_COLOR);
- d->items[2].fn = select_color_8;
- d->items[2].data = (unsigned char *)&ses->ds.t_background_color;
- d->items[2].dlen = sizeof(int);
- }
+ d->items[0].type = D_BUTTON;
+ d->items[0].gid = 0;
+ d->items[0].text = TEXT_(T_TEXT_COLOR);
+ d->items[0].fn = select_color_16;
+ d->items[0].data = (unsigned char *)&ses->ds.t_text_color;
+ d->items[0].dlen = sizeof(int);
+
+ d->items[1].type = D_BUTTON;
+ d->items[1].gid = 0;
+ d->items[1].text = TEXT_(T_LINK_COLOR);
+ d->items[1].fn = select_color_16;
+ d->items[1].data = (unsigned char *)&ses->ds.t_link_color;
+ d->items[1].dlen = sizeof(int);
+
+ d->items[2].type = D_BUTTON;
+ d->items[2].gid = 0;
+ d->items[2].text = TEXT_(T_BACKGROUND_COLOR);
+ d->items[2].fn = select_color_8;
+ d->items[2].data = (unsigned char *)&ses->ds.t_background_color;
+ d->items[2].dlen = sizeof(int);
d->items[3].type = D_CHECKBOX;
d->items[3].data = (unsigned char *) gf_val(&ses->ds.t_ignore_document_color, &ses->ds.g_ignore_document_color);
@@ -1650,8 +1645,8 @@ static void miscopt_fn(struct dialog_data *dlg)
int a=0;
int bmk=!anonymous;
- max_text_width(term, labels[F?7:0], &max, AL_LEFT);
- min_text_width(term, labels[F?7:0], &min, AL_LEFT);
+ max_text_width(term, labels[0], &max, AL_LEFT);
+ min_text_width(term, labels[0], &min, AL_LEFT);
if (bmk)
{
max_buttons_width(term, dlg->items + dlg->n - 3 - a - bmk, 1, &max);
@@ -1676,7 +1671,7 @@ static void miscopt_fn(struct dialog_data *dlg)
rw = 0;
if (bmk) {
- dlg_format_text_and_field(dlg, NULL, labels[F?7:0], dlg->items + dlg->n - 4 - a - bmk, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
+ dlg_format_text_and_field(dlg, NULL, labels[0], dlg->items + dlg->n - 4 - a - bmk, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
y += LL;
}
if (bmk) {
@@ -1694,7 +1689,7 @@ static void miscopt_fn(struct dialog_data *dlg)
y = dlg->y + DIALOG_TB;
y += LL;
if (bmk) {
- dlg_format_text_and_field(dlg, term, labels[F?7:0], dlg->items + dlg->n - 4 - a - bmk, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
+ dlg_format_text_and_field(dlg, term, labels[0], dlg->items + dlg->n - 4 - a - bmk, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
y += LL;
dlg_format_buttons(dlg, term, dlg->items + dlg->n - 3 - a - bmk, 1, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
@@ -1713,17 +1708,17 @@ static void miscelaneous_options(struct terminal *term, void *xxx, void *ses_)
struct dialog *d;
int a=0;
- if (anonymous&&!F) return; /* if you add something into text mode (or both text and graphics), remove this (and enable also miscelaneous_options in do_setup_menu) */
+ /* if you add something into text mode (or both text and graphics), remove this (and enable also miscelaneous_options in do_setup_menu) */
+ if (anonymous)
+ return;
safe_strncpy(new_bookmarks_file,bookmarks_file,MAX_STR_LEN);
- if (!F)
- d = mem_calloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
+ d = mem_calloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
d->title = TEXT_(T_MISCELANEOUS_OPTIONS);
d->refresh = refresh_misc;
d->refresh_data = ses;
d->fn=miscopt_fn;
- if (!F)
- d->udata = (void *)miscopt_labels;
+ d->udata = (void *)miscopt_labels;
d->udata2 = ses;
if (!anonymous) {
d->items[a].type = D_FIELD;
@@ -1801,10 +1796,8 @@ static void do_file_menu(struct terminal *term, void *xxx, void *ses_)
struct menu_item *file_menu, *e;
file_menu = xmalloc(sizeof(file_menu11) + sizeof(file_menu12) + sizeof(file_menu21) + sizeof(file_menu22) + sizeof(file_menu3) + 3 * sizeof(struct menu_item));
e = file_menu;
- if (!F) {
- memcpy(e, file_menu11, sizeof(file_menu11));
- e += sizeof(file_menu11) / sizeof(struct menu_item);
- }
+ memcpy(e, file_menu11, sizeof(file_menu11));
+ e += sizeof(file_menu11) / sizeof(struct menu_item);
if (!anonymous) {
memcpy(e, file_menu12, sizeof(file_menu12));
e += sizeof(file_menu12) / sizeof(struct menu_item);
@@ -1820,10 +1813,8 @@ static void do_file_menu(struct terminal *term, void *xxx, void *ses_)
e++;
}
if (!anonymous) {
- if (!F) {
- memcpy(e, file_menu21, sizeof(file_menu21));
- e += sizeof(file_menu21) / sizeof(struct menu_item);
- }
+ memcpy(e, file_menu21, sizeof(file_menu21));
+ e += sizeof(file_menu21) / sizeof(struct menu_item);
}
memcpy(e, file_menu22, sizeof(file_menu22));
e += sizeof(file_menu22) / sizeof(struct menu_item);
@@ -1917,7 +1908,7 @@ static const struct menu_item view_menu_anon_color[] = {
static void do_view_menu(struct terminal *term, void *xxx, void *ses_)
{
struct session *ses = (struct session *)ses_;
- if (F || term->spec->col) {
+ if (term->spec->col) {
if (!anonymous) do_menu(term, (struct menu_item *)view_menu_color, ses);
else do_menu(term, (struct menu_item *)view_menu_anon_color, ses);
} else {
@@ -2002,15 +1993,13 @@ static void do_setup_menu(struct terminal *term, void *xxx, void *ses_)
sizeof(setup_menu_8);
setup_menu = xmalloc(size);
e = setup_menu;
- if (!F) {
- memcpy(e, setup_menu_2, sizeof(setup_menu_2));
- e += sizeof(setup_menu_2) / sizeof(struct menu_item);
- }
+ memcpy(e, setup_menu_2, sizeof(setup_menu_2));
+ e += sizeof(setup_menu_2) / sizeof(struct menu_item);
if (!anonymous) {
memcpy(e, setup_menu_5, sizeof(setup_menu_5));
e += sizeof(setup_menu_5) / sizeof(struct menu_item);
}
- if (!anonymous || F) {
+ if (!anonymous) {
memcpy(e, setup_menu_6, sizeof(setup_menu_6));
e += sizeof(setup_menu_6) / sizeof(struct menu_item);
}
diff --git a/select.c b/select.c
@@ -762,11 +762,9 @@ void select_loop(void (*init)(void))
if (event_enabled) {
while (!terminate_loop) {
check_signals();
- if (!F) {
- do_event_loop(EVLOOP_NONBLOCK);
- check_signals();
- redraw_all_terminals();
- }
+ do_event_loop(EVLOOP_NONBLOCK);
+ check_signals();
+ redraw_all_terminals();
if (terminate_loop) break;
do_event_loop(EVLOOP_ONCE);
}
@@ -779,7 +777,7 @@ void select_loop(void (*init)(void))
struct timeval *tm = NULL;
check_signals();
check_timers();
- if (!F) redraw_all_terminals();
+ redraw_all_terminals();
if (!list_empty(timers)) {
uttime tt = list_struct(timers.next, struct timer)->interval + 1;
tv.tv_sec = tt / 1000 < INT_MAX ? (int)(tt / 1000) : INT_MAX;
diff --git a/session.c b/session.c
@@ -278,12 +278,10 @@ void change_screen_status(struct session *ses)
static void x_print_screen_status(struct terminal *term, void *ses_)
{
struct session *ses = (struct session *)ses_;
- if (!F) {
- unsigned char color = get_session_attribute(ses, proxies.only_proxies);
- fill_area(term, 0, term->y - 1, term->x, 1, ' ', color);
- if (ses->st)
- print_text(term, 0, term->y - 1, (int)strlen(cast_const_char ses->st), ses->st, COLOR_STATUS);
- }
+ unsigned char color = get_session_attribute(ses, proxies.only_proxies);
+ fill_area(term, 0, term->y - 1, term->x, 1, ' ', color);
+ if (ses->st)
+ print_text(term, 0, term->y - 1, (int)strlen(cast_const_char ses->st), ses->st, COLOR_STATUS);
}
static void x_print_screen_title(struct terminal *term, void *ses_)
@@ -311,8 +309,7 @@ void print_screen_status(struct session *ses)
unsigned char *m;
print_only_screen_status(ses);
- if (!F)
- draw_to_window(ses->win, x_print_screen_title, ses);
+ draw_to_window(ses->win, x_print_screen_title, ses);
m = stracpy(cast_uchar "Links");
if (ses->screen
@@ -324,7 +321,7 @@ void print_screen_status(struct session *ses)
}
set_terminal_title(ses->term, m);
- if (!F && ses->brl_cursor_mode) {
+ if (ses->brl_cursor_mode) {
if (ses->brl_cursor_mode == 1) set_cursor(ses->term, 0, 0, 0, 0);
if (ses->brl_cursor_mode == 2) set_cursor(ses->term, 0, ses->term->y - 1, 0, ses->term->y - 1);
}
@@ -557,7 +554,7 @@ void download_window_function(struct dialog_data *dlg)
int show_percentage = 0;
unsigned char *m, *u;
struct status *stat = &down->stat;
- if (!F) redraw_below_window(dlg->win);
+ redraw_below_window(dlg->win);
down->win = dlg->win;
if (stat->state == S_TRANS && stat->prg->elapsed / 100) {
int l = 0;
@@ -634,18 +631,16 @@ void download_window_function(struct dialog_data *dlg)
x = dlg->x + DIALOG_LB;
dlg_format_text(dlg, term, u, x, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
if (show_percentage) {
- if (!F) {
- unsigned char *q;
- int p = w - 6;
- y++;
- set_only_char(term, x, y, '[', 0);
- set_only_char(term, x + p + 1, y, ']', 0);
- fill_area(term, x + 1, y, download_meter(p, stat), 1, CHAR_DIALOG_METER, COLOR_DIALOG_METER);
- q = download_percentage(down, 1);
- print_text(term, x + p + 2, y, (int)strlen(cast_const_char q), q, COLOR_DIALOG_TEXT);
- free(q);
- y++;
- }
+ unsigned char *q;
+ int p = w - 6;
+ y++;
+ set_only_char(term, x, y, '[', 0);
+ set_only_char(term, x + p + 1, y, ']', 0);
+ fill_area(term, x + 1, y, download_meter(p, stat), 1, CHAR_DIALOG_METER, COLOR_DIALOG_METER);
+ q = download_percentage(down, 1);
+ print_text(term, x + p + 2, y, (int)strlen(cast_const_char q), q, COLOR_DIALOG_TEXT);
+ free(q);
+ y++;
}
y += gf_val(1, G_BFU_FONT_SIZE);
dlg_format_text(dlg, term, m, x, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
@@ -1580,7 +1575,7 @@ static void html_interpret(struct f_data_c *fd, int report_status)
oxw = oyw = oxp = oyp = -1;
}
memset(&o, 0, sizeof(struct document_options));
- ds2do(&fd->ses->ds, &o, F || fd->ses->term->spec->col);
+ ds2do(&fd->ses->ds, &o, fd->ses->term->spec->col);
if (!casecmp(fd->loc->url, cast_uchar "file://", 7) && !o.hard_assume) {
o.assume_cp = term_charset(fd->ses->term);
}
@@ -1602,12 +1597,10 @@ static void html_interpret(struct f_data_c *fd, int report_status)
}
o.scrolling = fd->scrolling;
if (fd->ses->term->spec) {
- if (!F) {
- if (!fd->ses->ds.t_ignore_document_color)
- o.col = fd->ses->term->spec->col;
- else
- o.col = 0;
- }
+ if (!fd->ses->ds.t_ignore_document_color)
+ o.col = fd->ses->term->spec->col;
+ else
+ o.col = 0;
o.cp = term_charset(fd->ses->term);
} else {
o.col = 3;
diff --git a/setup.h b/setup.h
@@ -96,8 +96,8 @@
#define G_LEFT_ARROW "\342\206\220"
#define G_RIGHT_ARROW "\342\206\222"
-#define MENU_SUBMENU (!F ? cast_uchar ">" : cast_uchar G_RIGHT_ARROW)
-#define CERT_RIGHT_ARROW (!F ? cast_uchar " -> " : cast_uchar " " G_RIGHT_ARROW " ")
+#define MENU_SUBMENU (cast_uchar ">")
+#define CERT_RIGHT_ARROW (cast_uchar " -> ")
#define G_SCROLL_BAR_WIDTH 12
#define G_SCROLL_BAR_MIN_SIZE 20
diff --git a/terminal.c b/terminal.c
@@ -175,7 +175,7 @@ void cls_redraw_all_terminals(void)
struct terminal *term = NULL;
struct list_head *lterm;
foreach(struct terminal, term, lterm, terminals) {
- if (!F) redraw_terminal_cls(term);
+ redraw_terminal_cls(term);
}
}
@@ -184,20 +184,18 @@ void draw_to_window(struct window *win, void (*fn)(struct terminal *term, void *
struct terminal *term = win->term;
struct window *w = NULL;
struct list_head *lw;
- if (!F) {
- pr(fn(term, data)) {};
- term = win->term;
- if (win->list_entry.prev == &term->windows || term->redrawing) return;
- term->redrawing = 1;
- {
- struct links_event ev = { EV_REDRAW, 0, 0, 0 };
- ev.x = term->x;
- ev.y = term->y;
- foreachbackfrom(struct window, w, lw, term->windows, win->list_entry.prev)
- w->handler(w, &ev, 0);
- }
- term->redrawing = 0;
- }
+ struct links_event ev = { EV_REDRAW, 0, 0, 0 };
+
+ pr(fn(term, data)) {};
+ term = win->term;
+ if (win->list_entry.prev == &term->windows || term->redrawing)
+ return;
+ term->redrawing = 1;
+ ev.x = term->x;
+ ev.y = term->y;
+ foreachbackfrom(struct window, w, lw, term->windows, win->list_entry.prev)
+ w->handler(w, &ev, 0);
+ term->redrawing = 0;
}
void add_window(struct terminal *term, void (*handler)(struct window *, struct links_event *, int), void *data)
@@ -222,7 +220,7 @@ void delete_window(struct window *win)
win->handler(win, &ev, 1);
del_from_list(win);
free(win->data);
- if (!F) redraw_terminal(term);
+ redraw_terminal(term);
free(win);
}
@@ -379,29 +377,27 @@ struct terminal *init_term(int fdin, int fdout, void (*root_window)(struct windo
static int process_utf_8(struct terminal *term, struct links_event *ev)
{
+ size_t l;
+ unsigned char *p;
+ unsigned c;
if (ev->ev == EV_KBD) {
- if (!F) {
- size_t l;
- unsigned char *p;
- unsigned c;
- if (ev->x <= 0 || ev->x >= 0x100) goto direct;
- if ((term->utf8_paste_mode ^ ev->y) & KBD_PASTING) {
- term->utf8_paste_mode = ev->y & KBD_PASTING;
- term->utf8_buffer[0] = 0;
- }
- if ((l = strlen(cast_const_char term->utf8_buffer))
- >= sizeof(term->utf8_buffer) - 1
- || ev->x < 0x80 || ev->x >= 0xc0) {
- term->utf8_buffer[0] = 0;
- l = 0;
- }
- term->utf8_buffer[l] = (unsigned char)ev->x;
- term->utf8_buffer[l + 1] = 0;
- p = term->utf8_buffer;
- GET_UTF_8(p, c);
- if (!c) return 0;
- ev->x = c;
+ if (ev->x <= 0 || ev->x >= 0x100) goto direct;
+ if ((term->utf8_paste_mode ^ ev->y) & KBD_PASTING) {
+ term->utf8_paste_mode = ev->y & KBD_PASTING;
+ term->utf8_buffer[0] = 0;
}
+ if ((l = strlen(cast_const_char term->utf8_buffer))
+ >= sizeof(term->utf8_buffer) - 1
+ || ev->x < 0x80 || ev->x >= 0xc0) {
+ term->utf8_buffer[0] = 0;
+ l = 0;
+ }
+ term->utf8_buffer[l] = (unsigned char)ev->x;
+ term->utf8_buffer[l + 1] = 0;
+ p = term->utf8_buffer;
+ GET_UTF_8(p, c);
+ if (!c) return 0;
+ ev->x = c;
direct:
term->utf8_buffer[0] = 0;
}
@@ -666,8 +662,7 @@ void redraw_all_terminals(void)
void flush_terminal(struct terminal *term)
{
- if (!F)
- redraw_screen(term);
+ redraw_screen(term);
}
void destroy_terminal(void *term_)
@@ -681,21 +676,19 @@ void destroy_terminal(void *term_)
del_from_list(term);
close_socket(&term->blocked);
free(term->title);
- if (!F) {
- free(term->screen);
- free(term->last_screen);
- free(term->input_queue);
- set_handlers(term->fdin, NULL, NULL, NULL);
- EINTRLOOP(rs, close(term->fdin));
- if (!term->master) {
- if (term->fdout != term->fdin)
- EINTRLOOP(rs, close(term->fdout));
- } else {
- unhandle_terminal_signals(term);
- free_all_itrms();
- if (!list_empty(terminals)) {
- os_detach_console();
- }
+ free(term->screen);
+ free(term->last_screen);
+ free(term->input_queue);
+ set_handlers(term->fdin, NULL, NULL, NULL);
+ EINTRLOOP(rs, close(term->fdin));
+ if (!term->master) {
+ if (term->fdout != term->fdin)
+ EINTRLOOP(rs, close(term->fdout));
+ } else {
+ unhandle_terminal_signals(term);
+ free_all_itrms();
+ if (!list_empty(terminals)) {
+ os_detach_console();
}
}
if (term->handle_to_close != -1) {
@@ -880,13 +873,11 @@ static void unblock_terminal(void *term_)
struct terminal *term = (struct terminal *)term_;
close_handle(&term->blocked);
term->blocked = -1;
- if (!F) {
- set_handlers(term->fdin, in_term, NULL, term);
- unblock_itrm(term->fdin);
- /* clear the dirty flag because unblock_itrm queued a resize
- event - so avoid double redraw */
- term->dirty = 0;
- }
+ set_handlers(term->fdin, in_term, NULL, term);
+ unblock_itrm(term->fdin);
+ /* clear the dirty flag because unblock_itrm queued a resize
+ event - so avoid double redraw */
+ term->dirty = 0;
}
void exec_on_terminal(struct terminal *term, unsigned char *path, unsigned char *delet, unsigned char fg)
@@ -896,7 +887,7 @@ void exec_on_terminal(struct terminal *term, unsigned char *path, unsigned char
if (!path) path = cast_uchar "";
if (term->master) {
if (!*path) {
- if (!F) dispatch_special(delet);
+ dispatch_special(delet);
} else {
int blockh;
unsigned char *param;
@@ -913,10 +904,10 @@ void exec_on_terminal(struct terminal *term, unsigned char *path, unsigned char
add_chr_to_str(¶m, ¶ml, 0);
add_to_str(¶m, ¶ml, delet);
if (fg == 1)
- if (!F) block_itrm(term->fdin);
+ block_itrm(term->fdin);
if ((blockh = start_thread(exec_thread, param, paraml + 1, *delet != 0)) == -1) {
if (fg == 1)
- if (!F) unblock_itrm(term->fdin);
+ unblock_itrm(term->fdin);
free(param);
return;
}
@@ -924,7 +915,7 @@ void exec_on_terminal(struct terminal *term, unsigned char *path, unsigned char
if (fg == 1) {
term->blocked = blockh;
set_handlers(blockh, unblock_terminal, NULL, term);
- if (!F) set_handlers(term->fdin, NULL, NULL, term);
+ set_handlers(term->fdin, NULL, NULL, term);
} else {
set_handlers(blockh, close_handle, NULL, &blockh);
}
@@ -967,8 +958,7 @@ void set_terminal_title(struct terminal *term, unsigned char *title)
if (term->title && !strcmp(cast_const_char title, cast_const_char term->title)) goto ret;
free(term->title);
term->title = stracpy(title);
- if (!F)
- do_terminal_function(term, TERM_FN_TITLE, title);
+ do_terminal_function(term, TERM_FN_TITLE, title);
ret:
free(title);
}
diff --git a/view.c b/view.c
@@ -84,13 +84,12 @@ void check_vs(struct f_data_c *f)
obx = f->vs->orig_brl_x;
oby = f->vs->orig_brl_y;
if (vs->current_link >= f->f_data->nlinks) vs->current_link = f->f_data->nlinks - 1;
- if (!F) {
- if (vs->current_link != -1 && !c_in_view(f)) {
- set_pos_x(f, &f->f_data->links[f->vs->current_link]);
- set_pos_y(f, &f->f_data->links[f->vs->current_link]);
- }
- if (vs->current_link == -1) find_link(f, 1, 0);
+ if (vs->current_link != -1 && !c_in_view(f)) {
+ set_pos_x(f, &f->f_data->links[f->vs->current_link]);
+ set_pos_y(f, &f->f_data->links[f->vs->current_link]);
}
+ if (vs->current_link == -1)
+ find_link(f, 1, 0);
f->vs->orig_view_posx = ovx;
f->vs->orig_view_pos = ovy;
f->vs->orig_link = ol;
@@ -131,7 +130,6 @@ static int comp_links(const void *l1_, const void *l2_)
void sort_links(struct f_data *f)
{
int i;
- if (F) return;
if (f->nlinks)
qsort(f->links, f->nlinks, sizeof(struct link), comp_links);
if ((unsigned)f->y > INT_MAX / sizeof(struct link *)) overalloc();
@@ -932,7 +930,7 @@ void draw_doc(struct terminal *t, void *scr_)
struct f_data_c *scr = (struct f_data_c *)scr_;
struct session *ses = scr->ses;
int active = scr->active;
- int y;
+ int n, y;
int xp = scr->xp;
int yp = scr->yp;
int xw = scr->xw;
@@ -940,31 +938,26 @@ void draw_doc(struct terminal *t, void *scr_)
struct view_state *vs;
int vx, vy;
if (!scr->vs || !scr->f_data) {
- if (!F) {
- if (active) {
- if (!scr->parent) set_cursor(t, 0, 0, 0, 0);
- else set_cursor(t, xp, yp, xp, yp);
- }
- fill_area(t, xp, yp, xw, yw, ' ', get_session_attribute(ses, 0));
+ if (active) {
+ if (!scr->parent)
+ set_cursor(t, 0, 0, 0, 0);
+ else
+ set_cursor(t, xp, yp, xp, yp);
}
+ fill_area(t, xp, yp, xw, yw, ' ', get_session_attribute(ses, 0));
if (active) set_window_ptr(ses->win, xp, yp);
return;
}
if (active) {
- if (!F) {
set_cursor(t, xp + xw - 1, yp + yw - 1, xp + xw - 1, yp + yw - 1);
set_window_ptr(ses->win, xp, yp);
- }
}
check_vs(scr);
if (scr->f_data->frame_desc) {
struct f_data_c *f = NULL;
struct list_head *lf;
- int n;
- if (!F) {
- fill_area(t, xp, yp, xw, yw, ' ', scr->f_data->y ? scr->f_data->bg : 0);
- draw_frame_lines(ses, scr->f_data->frame_desc, xp, yp);
- }
+ fill_area(t, xp, yp, xw, yw, ' ', scr->f_data->y ? scr->f_data->bg : 0);
+ draw_frame_lines(ses, scr->f_data->frame_desc, xp, yp);
n = 0;
foreach(struct f_data_c, f, lf, scr->subframes) {
f->active = active && n++ == scr->vs->frame_pos;
@@ -980,7 +973,7 @@ void draw_doc(struct terminal *t, void *scr_)
vs->orig_view_pos = vy;
vs->view_posx = 0;
vs->orig_view_posx = 0;
- if (!F) set_link(scr);
+ set_link(scr);
free(scr->went_to_position);
scr->went_to_position = scr->goto_position;
scr->goto_position = NULL;
@@ -995,44 +988,47 @@ void draw_doc(struct terminal *t, void *scr_)
vs->brl_y = vs->orig_brl_y;
ol = vs->orig_link;
if (ol < scr->f_data->nlinks) vs->current_link = ol;
- if (!F) {
- while (vs->view_pos >= scr->f_data->y) vs->view_pos -= yw ? yw : 1;
- if (vs->view_pos < 0) vs->view_pos = 0;
- }
- if (!F)
- set_link(scr);
+ while (vs->view_pos >= scr->f_data->y)
+ vs->view_pos -= yw ? yw : 1;
+ if (vs->view_pos < 0)
+ vs->view_pos = 0;
+ set_link(scr);
check_vs(scr);
vs->orig_link = ol;
}
- if (!F) {
- vx = vs->view_posx;
- vy = vs->view_pos;
- if (scr->xl == vx && scr->yl == vy && scr->xl != -1 && !ses->search_word) {
- clear_link(t, scr);
- draw_forms(t, scr);
- if (active) draw_current_link(t, scr);
- return;
- }
- free_link(scr);
- scr->xl = vx;
- scr->yl = vy;
- fill_area(t, xp, yp, xw, yw, ' ', scr->f_data->y ? scr->f_data->bg : get_session_attribute(ses, 0));
- if (!scr->f_data->y) return;
- while (vs->view_pos >= scr->f_data->y) vs->view_pos -= yw ? yw : 1;
- if (vs->view_pos < 0) vs->view_pos = 0;
- if (vy != vs->view_pos) {
- vy = vs->view_pos;
- check_vs(scr);
- }
- for (y = vy <= 0 ? 0 : vy; y < (-vy + scr->f_data->y <= yw ? scr->f_data->y : yw + vy); y++) {
- int st = vx <= 0 ? 0 : vx;
- int en = -vx + scr->f_data->data[y].l <= xw ? scr->f_data->data[y].l : xw + vx;
- set_line(t, xp + st - vx, yp + y - vy, en - st, &scr->f_data->data[y].d[st]);
- }
+ vx = vs->view_posx;
+ vy = vs->view_pos;
+ if (scr->xl == vx && scr->yl == vy && scr->xl != -1 && !ses->search_word) {
+ clear_link(t, scr);
draw_forms(t, scr);
- if (active) draw_current_link(t, scr);
- if (ses->search_word) scr->xl = scr->yl = -1;
+ if (active)
+ draw_current_link(t, scr);
+ return;
}
+ free_link(scr);
+ scr->xl = vx;
+ scr->yl = vy;
+ fill_area(t, xp, yp, xw, yw, ' ', scr->f_data->y ? scr->f_data->bg : get_session_attribute(ses, 0));
+ if (!scr->f_data->y)
+ return;
+ while (vs->view_pos >= scr->f_data->y)
+ vs->view_pos -= yw ? yw : 1;
+ if (vs->view_pos < 0)
+ vs->view_pos = 0;
+ if (vy != vs->view_pos) {
+ vy = vs->view_pos;
+ check_vs(scr);
+ }
+ for (y = vy <= 0 ? 0 : vy; y < (-vy + scr->f_data->y <= yw ? scr->f_data->y : yw + vy); y++) {
+ int st = vx <= 0 ? 0 : vx;
+ int en = -vx + scr->f_data->data[y].l <= xw ? scr->f_data->data[y].l : xw + vx;
+ set_line(t, xp + st - vx, yp + y - vy, en - st, &scr->f_data->data[y].d[st]);
+ }
+ draw_forms(t, scr);
+ if (active)
+ draw_current_link(t, scr);
+ if (ses->search_word)
+ scr->xl = scr->yl = -1;
}
static void clr_xl(struct f_data_c *fd)
@@ -1630,8 +1626,7 @@ static void encode_multipart(struct session *ses, struct list_head *l, unsigned
add_to_str(data, len, ct);
if (strlen(cast_const_char ct) >= 4 && !casecmp(ct, cast_uchar "text", 4)) {
add_to_str(data, len, cast_uchar "; charset=");
- if (!F)
- add_to_str(data, len, get_cp_mime_name(term_charset(ses->term)));
+ add_to_str(data, len, get_cp_mime_name(term_charset(ses->term)));
}
free(ct);
}
@@ -1805,7 +1800,8 @@ static unsigned char *get_link_url(struct session *ses, struct f_data_c *f, stru
{
if (l->type == L_LINK) {
if (!l->where) {
- if (l->where_img && (!F || (!f->f_data->opt.display_images && f->f_data->opt.plain != 2))) return stracpy(l->where_img);
+ if (l->where_img)
+ return stracpy(l->where_img);
return NULL;
}
if (ismap_link && strlen(cast_const_char l->where) >= 4 && !strcmp(cast_const_char(l->where + strlen(cast_const_char l->where) - 4), "?0,0")) {
@@ -1869,8 +1865,6 @@ static struct link *get_current_link(struct f_data_c *f)
if (!f || !f->f_data || !f->vs) return NULL;
if (f->vs->current_link >= 0 && f->vs->current_link < f->f_data->nlinks)
return &f->f_data->links[f->vs->current_link];
- if (F && f->f_data->opt.plain == 2 && f->f_data->nlinks == 1)
- return &f->f_data->links[0];
return NULL;
}
@@ -1940,10 +1934,9 @@ int enter(struct session *ses, struct f_data_c *f, int a)
}
if (link->type == L_FIELD || link->type == L_AREA) {
/* pri enteru v textovem policku se bude posilat vzdycky -- Brain */
- if (!has_form_submit(f->f_data, link->form) && (!a || !F))
+ if (!has_form_submit(f->f_data, link->form) && !a)
goto submit;
- if (!F)
- down(ses, f, 0);
+ down(ses, f, 0);
return 1;
}
internal("bad link type %d", link->type);
@@ -2239,7 +2232,7 @@ int field_op(struct session *ses, struct f_data_c *f, struct link *l, struct lin
}
} else if (ev->x == KBD_DEL || (upcase(ev->x) == 'D' && ev->y & KBD_CTRL)) {
int ll = 1;
- if (!F && ev->x == KBD_DEL && !f->last_captured)
+ if (ev->x == KBD_DEL && !f->last_captured)
return 0;
if (!f->f_data->opt.cp) {
unsigned char *p = fs->string+ fs->state;
@@ -2368,7 +2361,7 @@ int field_op(struct session *ses, struct f_data_c *f, struct link *l, struct lin
} else
r = 0;
done:
- if (!F && r) {
+ if (r) {
/* FIXME: test might be broken */
if ((ev->ev == EV_KBD && (ev->x == KBD_UP || ev->x == KBD_DOWN))
|| form->type != FC_TEXTAREA || textarea_adjust_viewport(f, l))
@@ -2490,7 +2483,7 @@ void find_next(struct session *ses, struct f_data_c *f, int a)
return;
}
p = f->vs->view_pos;
- if (!F && !a && ses->search_word) {
+ if (!a && ses->search_word) {
if (!(find_next_link_in_search(f, ses->search_direction))) return;
p += ses->search_direction * f->yw;
}
@@ -2637,7 +2630,7 @@ static int frame_ev(struct session *ses, struct f_data_c *fd, struct links_event
html_interpret_recursive(ses->screen);
draw_formatted(ses);
} else if (ev->x == 'i' && !(ev->y & KBD_ALT)) {
- if (!F || fd->f_data->opt.plain != 2) frm_view_image(ses, fd);
+ frm_view_image(ses, fd);
} else if (ev->x == 'I' && !(ev->y & KBD_ALT)) {
if (!anonymous) frm_download_image(ses, fd);
} else if (upcase(ev->x) == 'D' && !(ev->y & KBD_ALT)) {
@@ -2736,8 +2729,7 @@ static int send_to_frame(struct session *ses, struct links_event *ev)
if (!fd)
return 0;
- if (!F)
- r = frame_ev(ses, fd, ev);
+ r = frame_ev(ses, fd, ev);
if (r == 1) {
fd->active = 1;
draw_to_window(ses->win, draw_doc_c, fd);
@@ -2788,12 +2780,10 @@ void do_for_frame(struct session *ses, void (*f)(struct session *, struct f_data
if (!fd)
return;
f(ses, fd, a);
- if (!F) {
- fd->active = 1;
- draw_to_window(ses->win, draw_doc_c, fd);
- change_screen_status(ses);
- print_screen_status(ses);
- }
+ fd->active = 1;
+ draw_to_window(ses->win, draw_doc_c, fd);
+ change_screen_status(ses);
+ print_screen_status(ses);
}
static void do_mouse_event(struct session *ses, struct links_event *ev)
@@ -3282,9 +3272,7 @@ void link_menu(struct terminal *term, void *xxx, void *ses_)
if (!link) goto no_l;
if (link->type == L_LINK && link->where) {
if (strlen(cast_const_char link->where) >= 4 && !casecmp(link->where, cast_uchar "MAP@", 4)) {
- if (!F) {
- add_to_menu(&mi, TEXT_(T_DISPLAY_USEMAP), cast_uchar ">", TEXT_(T_HK_DISPLAY_USEMAP), send_enter, NULL, 1, -1);
- }
+ add_to_menu(&mi, TEXT_(T_DISPLAY_USEMAP), cast_uchar ">", TEXT_(T_HK_DISPLAY_USEMAP), send_enter, NULL, 1, -1);
} else {
int c = can_open_in_new(term);
add_to_menu(&mi, TEXT_(T_FOLLOW_LINK), cast_uchar "Enter", TEXT_(T_HK_FOLLOW_LINK), send_enter, NULL, 0, -1);
@@ -3292,8 +3280,6 @@ void link_menu(struct terminal *term, void *xxx, void *ses_)
if (!anonymous) add_to_menu(&mi, TEXT_(T_DOWNLOAD_LINK), cast_uchar "d", TEXT_(T_HK_DOWNLOAD_LINK), send_download, NULL, 0, -1);
if (clipboard_support(term))
add_to_menu(&mi, TEXT_(T_COPY_LINK_LOCATION), cast_uchar "", TEXT_(T_HK_COPY_LINK_LOCATION), copy_link_location, NULL, 0, -1);
- /*add_to_menu(&mi, TEXT_(T_ADD_BOOKMARK), cast_uchar "A", TEXT_(T_HK_ADD_BOOKMARK), menu_bookmark_manager, NULL, 0);*/
-
}
}
if ((link->type == L_CHECKBOX || link->type == L_SELECT || link->type == L_FIELD || link->type == L_AREA) && link->form) {
@@ -3315,8 +3301,7 @@ void link_menu(struct terminal *term, void *xxx, void *ses_)
}
}
if (link->where_img) {
- if (!F || f->f_data->opt.plain != 2)
- add_to_menu(&mi, TEXT_(T_VIEW_IMAGE), cast_uchar "i", TEXT_(T_HK_VIEW_IMAGE), send_image, NULL, 0, -1);
+ add_to_menu(&mi, TEXT_(T_VIEW_IMAGE), cast_uchar "i", TEXT_(T_HK_VIEW_IMAGE), send_image, NULL, 0, -1);
if (!anonymous)
add_to_menu(&mi, TEXT_(T_DOWNLOAD_IMAGE), cast_uchar "I", TEXT_(T_HK_DOWNLOAD_IMAGE), send_download_image, NULL, 0, -1);
}