ELinks 0.18.0
terminal.c File Reference

Terminal interface - low-level displaying implementation. More...

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include "elinks.h"
#include "bookmarks/bookmarks.h"
#include "config/options.h"
#include "main/main.h"
#include "main/module.h"
#include "main/object.h"
#include "main/select.h"
#include "osdep/osdep.h"
#include "osdep/signals.h"
#include "session/download.h"
#include "session/session.h"
#include "terminal/draw.h"
#include "terminal/event.h"
#include "terminal/hardio.h"
#include "terminal/kbd.h"
#include "terminal/screen.h"
#include "terminal/terminal.h"
#include "terminal/window.h"
#include "util/error.h"
#include "util/hash.h"
#include "util/memory.h"
#include "util/string.h"
#include "viewer/text/textarea.h"
Include dependency graph for terminal.c:

Functions

static void check_if_no_terminal (void)
void clean_temporary_files (void)
long get_number_of_temporary_files (void)
static void save_temporary_filename (const char *filename)
void redraw_terminal (struct terminal *term)
void redraw_terminal_cls (struct terminal *term)
void cls_redraw_all_terminals (void)
struct terminalget_default_terminal (void)
 Get the terminal in which message boxes should be displayed, if there is no specific reason to use some other terminal.
struct terminalinit_term (int fdin, int fdout)
int get_terminal_codepage (const struct terminal *term)
 Get the codepage of a terminal.
void redraw_all_terminals (void)
void destroy_terminal (struct terminal *term)
void destroy_all_terminals (void)
void exec_thread (char *path, int p)
void close_handle (void *h)
static void unblock_terminal (struct terminal *term)
void assert_terminal_ptr_not_dangling (const struct terminal *suspect)
static void exec_on_master_terminal (struct terminal *term, const char *path, int plen, const char *delete_, int dlen, term_exec_T fg)
static void exec_on_slave_terminal (struct terminal *term, const char *path, int plen, const char *delete_, int dlen, term_exec_T fg)
void exec_on_terminal (struct terminal *term, const char *path, const char *delete_, term_exec_T fg)
void exec_shell (struct terminal *term)
void do_terminal_function (struct terminal *term, unsigned char code, const char *data)
int set_terminal_title (struct terminal *term, char *title)
int check_terminal_pipes (void)
void close_terminal_pipes (void)
struct terminalattach_terminal (int in, int out, int ctl, void *info, int len)

Variables

struct terminal list terminals = { D_LIST_HEAD_EL(terminals) }
 We keep track about all the terminals in this list.
struct hashtemporary_files
static int terminal_pipe [2]
static struct moduleterminal_submodules []
struct module terminal_module

Detailed Description

Terminal interface - low-level displaying implementation.

Function Documentation

◆ assert_terminal_ptr_not_dangling()

void assert_terminal_ptr_not_dangling ( const struct terminal * suspect)

◆ attach_terminal()

struct terminal * attach_terminal ( int in,
int out,
int ctl,
void * info,
int len )

◆ check_if_no_terminal()

void check_if_no_terminal ( void )
static

◆ check_terminal_pipes()

int check_terminal_pipes ( void )

◆ clean_temporary_files()

void clean_temporary_files ( void )

◆ close_handle()

void close_handle ( void * h)

◆ close_terminal_pipes()

void close_terminal_pipes ( void )

◆ cls_redraw_all_terminals()

void cls_redraw_all_terminals ( void )

◆ destroy_all_terminals()

void destroy_all_terminals ( void )

◆ destroy_terminal()

void destroy_terminal ( struct terminal * term)

◆ do_terminal_function()

void do_terminal_function ( struct terminal * term,
unsigned char code,
const char * data )

◆ exec_on_master_terminal()

void exec_on_master_terminal ( struct terminal * term,
const char * path,
int plen,
const char * delete_,
int dlen,
term_exec_T fg )
static

◆ exec_on_slave_terminal()

void exec_on_slave_terminal ( struct terminal * term,
const char * path,
int plen,
const char * delete_,
int dlen,
term_exec_T fg )
static

◆ exec_on_terminal()

void exec_on_terminal ( struct terminal * term,
const char * path,
const char * delete_,
term_exec_T fg )

◆ exec_shell()

void exec_shell ( struct terminal * term)

◆ exec_thread()

void exec_thread ( char * path,
int p )

◆ get_default_terminal()

struct terminal * get_default_terminal ( void )

Get the terminal in which message boxes should be displayed, if there is no specific reason to use some other terminal.

This returns NULL if all terminals have been closed. (ELinks keeps running anyway if ui.sessions.keep_session_active is true.)

◆ get_number_of_temporary_files()

long get_number_of_temporary_files ( void )

◆ get_terminal_codepage()

int get_terminal_codepage ( const struct terminal * term)

Get the codepage of a terminal.

The UTF-8 I/O option does not affect this.

Todo
Perhaps cache the value in struct terminal?
Bug
Bug 1064: If the charset has been set as "System", this should apply the locale environment variables of the slave ELinks process, not those of the master ELinks process that parsed the configuration file. That is why the parameter points to struct terminal and not merely to its option tree (term->spec).
See also
get_translation_table(), get_cp_mime_name()

◆ init_term()

struct terminal * init_term ( int fdin,
int fdout )

◆ redraw_all_terminals()

void redraw_all_terminals ( void )

◆ redraw_terminal()

void redraw_terminal ( struct terminal * term)

◆ redraw_terminal_cls()

void redraw_terminal_cls ( struct terminal * term)

◆ save_temporary_filename()

void save_temporary_filename ( const char * filename)
static

◆ set_terminal_title()

int set_terminal_title ( struct terminal * term,
char * title )
Returns
negative on error; zero or positive on success.

◆ unblock_terminal()

void unblock_terminal ( struct terminal * term)
static

Variable Documentation

◆ temporary_files

struct hash* temporary_files

◆ terminal_module

struct module terminal_module
Initial value:
"Terminal",
)
#define NULL
Definition explodename.c:35
#define struct_module(name, options, hooks, submods, data, init, done, getname)
Definition module.h:47
static struct module * terminal_submodules[]
Definition terminal.c:588

◆ terminal_pipe

int terminal_pipe[2]
static

◆ terminal_submodules

struct module* terminal_submodules[]
static
Initial value:
= {
}
struct module terminal_screen_module
Definition screen.c:1640

◆ terminals

struct terminal list terminals = { D_LIST_HEAD_EL(terminals) }

We keep track about all the terminals in this list.

The list is sorted so that terminals.next is the terminal from which ELinks most recently got an event. But please call get_default_terminal() for that.