tnftp  20200705
About: tnftp is an enhanced ftp client (prior name "lukemftp").
  Fossies Dox: tnftp-20200705.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tty.c File Reference
#include "config.h"
#include "el.h"
#include "fcns.h"
#include "parse.h"
Include dependency graph for tty.c:

Go to the source code of this file.

Data Structures

struct  ttymodes_t
 
struct  ttymap_t
 

Macros

#define tty__gettabs(td)   ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)
 
#define tty__geteightbit(td)   (((td)->c_cflag & CSIZE) == CS8)
 
#define tty__cooked_mode(td)   ((td)->c_lflag & ICANON)
 
#define t_qu   t_ts
 

Typedefs

typedef struct ttymodes_t ttymodes_t
 
typedef struct ttymap_t ttymap_t
 

Functions

static int tty_getty (EditLine *, struct termios *)
 
static int tty_setty (EditLine *, int, const struct termios *)
 
static int tty__getcharindex (int)
 
static void tty__getchar (struct termios *, unsigned char *)
 
static void tty__setchar (struct termios *, unsigned char *)
 
static speed_t tty__getspeed (struct termios *)
 
static int tty_setup (EditLine *)
 
static void tty_setup_flags (EditLine *, struct termios *, int)
 
int tty_init (EditLine *el)
 
void tty_end (EditLine *el, int how)
 
void tty_bind_char (EditLine *el, int force)
 
static tcflag_t * tty__get_flag (struct termios *t, int kind)
 
static tcflag_t tty_update_flag (EditLine *el, tcflag_t f, int mode, int kind)
 
static void tty_update_flags (EditLine *el, int kind)
 
static void tty_update_char (EditLine *el, int mode, int c)
 
int tty_rawmode (EditLine *el)
 
int tty_cookedmode (EditLine *el)
 
int tty_quotemode (EditLine *el)
 
int tty_noquotemode (EditLine *el)
 
int tty_stty (EditLine *el, int argc, const wchar_t **argv)
 
int tty_get_signal_character (EditLine *el, int sig)
 

Variables

static const ttyperm_t ttyperm
 
static const ttychar_t ttychar
 
static const ttymap_t tty_map []
 
static const ttymodes_t ttymodes []
 

Macro Definition Documentation

◆ t_qu

#define t_qu   t_ts

Definition at line 474 of file tty.c.

◆ tty__cooked_mode

#define tty__cooked_mode (   td)    ((td)->c_lflag & ICANON)

Definition at line 463 of file tty.c.

◆ tty__geteightbit

#define tty__geteightbit (   td)    (((td)->c_cflag & CSIZE) == CS8)

Definition at line 462 of file tty.c.

◆ tty__gettabs

#define tty__gettabs (   td)    ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)

Definition at line 461 of file tty.c.

Typedef Documentation

◆ ttymap_t

typedef struct ttymap_t ttymap_t

◆ ttymodes_t

typedef struct ttymodes_t ttymodes_t

Function Documentation

◆ tty__get_flag()

static tcflag_t* tty__get_flag ( struct termios *  t,
int  kind 
)
static

Definition at line 947 of file tty.c.

References MD_CTL, MD_INP, MD_LIN, and MD_OUT.

Referenced by tty_get_signal_character(), tty_setup_flags(), and tty_update_flags().

◆ tty__getchar()

static void tty__getchar ( struct termios *  td,
unsigned char *  s 
)
static

◆ tty__getcharindex()

static int tty__getcharindex ( int  i)
static

◆ tty__getspeed()

static speed_t tty__getspeed ( struct termios *  td)
static

Definition at line 617 of file tty.c.

Referenced by tty_rawmode(), and tty_setup().

◆ tty__setchar()

static void tty__setchar ( struct termios *  td,
unsigned char *  s 
)
static

◆ tty_bind_char()

◆ tty_cookedmode()

◆ tty_end()

void tty_end ( EditLine el,
int  how 
)

◆ tty_get_signal_character()

int tty_get_signal_character ( EditLine el,
int  sig 
)

Definition at line 1351 of file tty.c.

References ECHOCTL, ED_IO, el, editline::el_tty, MD_INP, el_tty_t::t_c, and tty__get_flag().

Referenced by rl_echo_signal_char().

◆ tty_getty()

static int tty_getty ( EditLine el,
struct termios *  t 
)
static

Definition at line 480 of file tty.c.

References el, and editline::el_infd.

Referenced by tty_rawmode(), and tty_setup().

◆ tty_init()

◆ tty_noquotemode()

int tty_noquotemode ( EditLine el)

◆ tty_quotemode()

int tty_quotemode ( EditLine el)

◆ tty_rawmode()

◆ tty_setty()

static int tty_setty ( EditLine el,
int  action,
const struct termios *  t 
)
static

Definition at line 492 of file tty.c.

References el, and editline::el_infd.

Referenced by tty_cookedmode(), tty_end(), tty_noquotemode(), tty_quotemode(), tty_rawmode(), tty_setup(), and tty_stty().

◆ tty_setup()

◆ tty_setup_flags()

static void tty_setup_flags ( EditLine el,
struct termios *  tios,
int  mode 
)
static

Definition at line 1341 of file tty.c.

References el, MD_INP, MD_LIN, mode, tty__get_flag(), and tty_update_flag().

Referenced by tty_quotemode(), tty_setup(), and tty_stty().

◆ tty_stty()

◆ tty_update_char()

static void tty_update_char ( EditLine el,
int  mode,
int  c 
)
static

◆ tty_update_flag()

static tcflag_t tty_update_flag ( EditLine el,
tcflag_t  f,
int  mode,
int  kind 
)
static

Definition at line 965 of file tty.c.

References el, editline::el_tty, mode, ttyperm_t::t_clrmask, ttyperm_t::t_setmask, and el_tty_t::t_t.

Referenced by tty_setup_flags(), and tty_update_flags().

◆ tty_update_flags()

static void tty_update_flags ( EditLine el,
int  kind 
)
static

Definition at line 974 of file tty.c.

References ED_IO, el, editline::el_tty, EX_IO, MD_CTL, el_tty_t::t_ts, tty__get_flag(), and tty_update_flag().

Referenced by tty_rawmode().

Variable Documentation

◆ tty_map

const ttymap_t tty_map[]
static

Definition at line 134 of file tty.c.

Referenced by tty_bind_char().

◆ ttychar

const ttychar_t ttychar
static
Initial value:
= {
{
(( 'c' ) & 037) , 034 , 0177 , (( 'u' ) & 037) ,
(( 'd' ) & 037) , ((unsigned char) -1) , ((unsigned char) -1) , ((unsigned char) -1) ,
((unsigned char) -1) , ((unsigned char) -1) , (( 'q' ) & 037) , (( 's' ) & 037) ,
(( 'w' ) & 037) , (( 'z' ) & 037) , (( 'y' ) & 037) , (( 'r' ) & 037) ,
(( 'o' ) & 037) , (( 'v' ) & 037) , (( 't' ) & 037) , ' ' ,
(( 'm' ) & 037) , ((unsigned char) -1) , 0377 , (( 'd' ) & 037) ,
((unsigned char) -1)
},
{
(( 'c' ) & 037) , 034 , 0177 , (( 'u' ) & 037) ,
((unsigned char) -1) , ((unsigned char) -1) , ((unsigned char) -1) , ((unsigned char) -1) ,
((unsigned char) -1) , ((unsigned char) -1) , (( 'q' ) & 037) , (( 's' ) & 037) ,
((unsigned char) -1) , (( 'z' ) & 037) , ((unsigned char) -1) , ((unsigned char) -1) ,
(( 'o' ) & 037) , ((unsigned char) -1) , ((unsigned char) -1) , ((unsigned char) -1) ,
((unsigned char) -1) , ((unsigned char) -1) , ((unsigned char) -1) , 1,
0
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0
}
}

Definition at line 104 of file tty.c.

Referenced by tty_init().

◆ ttymodes

const ttymodes_t ttymodes[]
static

Definition at line 171 of file tty.c.

Referenced by tty_stty().

◆ ttyperm

const ttyperm_t ttyperm
static
Initial value:
= {
{
{"iflag:", ICRNL, (INLCR | IGNCR)},
{"oflag:", (OPOST | 0 ), 0 },
{"cflag:", 0, 0},
{"lflag:", (ISIG | ICANON | ECHO | ECHOE | 0 | 0 ),
(NOFLSH | ECHONL | 0 | 0 )},
{"chars:", 0, 0},
},
{
{"iflag:", (INLCR | ICRNL), IGNCR},
{"oflag:", (OPOST | 0 ), 0 },
{"cflag:", 0, 0},
{"lflag:", ISIG,
(NOFLSH | ICANON | ECHO | ECHOK | ECHONL | 0 | 0 | 0 )},
{"chars:", (((unsigned int)(1 << ( 23 ))) | ((unsigned int)(1 << ( 24 ))) | ((unsigned int)(1 << ( 7 ))) | ((unsigned int)(1 << ( 8 ))) |
((unsigned int)(1 << ( 13 ))) | ((unsigned int)(1 << ( 14 ))) | ((unsigned int)(1 << ( 5 ))) | ((unsigned int)(1 << ( 16 ))) |
((unsigned int)(1 << ( 20 ))) | ((unsigned int)(1 << ( 19 ))) | ((unsigned int)(1 << ( 18 )))), 0}
},
{
{"iflag:", 0, IXON | IXOFF | INLCR | ICRNL},
{"oflag:", 0, 0},
{"cflag:", 0, 0},
{"lflag:", 0, ISIG | 0 },
{"chars:", 0, 0},
}
}

Definition at line 76 of file tty.c.

Referenced by tty_init().