links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 4f9ce9dba2a2779ce32bf89b2cfb649ce2891ecd
Parent: 2214b4c99172f53d28644307bf475bb541a52d5f
Author: opask
Date:   Sat, 28 Jul 2018 19:14:08 -0600

cleanup up some constants

Diffstat:
Mkbd.c | 19+++++++++----------
Mlinks.h | 4++--
Mmain.c | 8++++----
3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/kbd.c b/kbd.c @@ -280,14 +280,14 @@ static void setcooked(int ctl) ttcsetattr(ctl, TCSANOW, &saved_termios); } -void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in, void *init_string, int init_len) +void handle_trm(int sock_out, void *init_string, int init_len) { int x, y; struct itrm *itrm; struct links_event ev = { EV_INIT, 80, 24, 0 }; unsigned char *ts; int xwin, def_charset; - if (get_terminal_size(ctl_in, &x, &y)) { + if (get_terminal_size(0, &x, &y)) { error("ERROR: could not get terminal size"); return; } @@ -295,22 +295,21 @@ void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in, itrm->queue_event = queue_event; itrm->free_trm = free_trm; ditrm = itrm; - itrm->std_in = std_in; - itrm->std_out = std_out; - itrm->sock_in = sock_in; + itrm->std_in = 0; + itrm->std_out = 1; + itrm->sock_in = 1; itrm->sock_out = sock_out; - itrm->ctl_in = ctl_in; + itrm->ctl_in = 0; itrm->blocked = 0; itrm->qlen = 0; itrm->tm = NULL; itrm->ev_queue = NULL; itrm->eqlen = 0; setraw(itrm->ctl_in, 1); - set_handlers(std_in, in_kbd, NULL, itrm); - if (sock_in != std_out) set_handlers(sock_in, in_sock, NULL, itrm); + set_handlers(0, in_kbd, NULL, itrm); ev.x = x; ev.y = y; - handle_terminal_resize(ctl_in, resize_terminal); + handle_terminal_resize(0, resize_terminal); queue_event(itrm, (unsigned char *)&ev, sizeof(struct links_event)); xwin = is_xterm() * ENV_XWIN + is_twterm() * ENV_TWIN + is_screen() * ENV_SCREEN; itrm->flags = 0; @@ -343,7 +342,7 @@ void handle_trm(int std_in, int std_out, int sock_in, int sock_out, int ctl_in, queue_event(itrm, (unsigned char *)init_string, init_len); itrm->orig_title = get_window_title(); set_window_title(cast_uchar "Links"); - send_init_sequence(std_out, itrm->flags); + send_init_sequence(1, itrm->flags); itrm->mouse_h = NULL; } diff --git a/links.h b/links.h @@ -1011,7 +1011,7 @@ void mailto_func(struct session *, unsigned char *); #define KBD_ALT 4 #define KBD_PASTE 8 -void handle_trm(int, int, int, int, int, void *, int); +void handle_trm(int, void *, int); void free_all_itrms(void); void dispatch_special(unsigned char *); void kbd_ctrl_c(void); @@ -1688,7 +1688,7 @@ void sig_tstp(void *t); void sig_cont(void *t); void unhandle_terminal_signals(struct terminal *term); -int attach_terminal(int, int, int, void *, int); +int attach_terminal(void *, int); #ifdef G int attach_g_terminal(unsigned char *, void *, int); void gfx_connection(int); diff --git a/main.c b/main.c @@ -205,14 +205,14 @@ static void unhandle_basic_signals(struct terminal *term) int terminal_pipe[2] = { -1, -1 }; -int attach_terminal(int in, int out, int ctl, void *info, int len) +int attach_terminal(void *info, int len) { struct terminal *term; set_nonblock(terminal_pipe[0]); set_nonblock(terminal_pipe[1]); - handle_trm(in, out, out, terminal_pipe[1], ctl, info, len); + handle_trm(terminal_pipe[1], info, len); free(info); - if ((term = init_term(terminal_pipe[0], out, win_func))) { + if ((term = init_term(terminal_pipe[0], 1, win_func))) { handle_basic_signals(term); /* OK, this is race condition, but it must be so; GPM installs it's own buggy TSTP handler */ return terminal_pipe[1]; } @@ -427,7 +427,7 @@ static void init(void) initialize_all_subsystems_2(); info = create_session_info(base_session, u, default_target, &len); if (!F) { - if (attach_terminal(0, 1, 0, info, len) < 0) + if (attach_terminal(info, len) < 0) fatal_exit("Could not open initial session"); } #ifdef G