tin  2.4.5
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.4.5.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

getline.c File Reference
#include "tin.h"
#include "tcurses.h"
Include dependency graph for getline.c:

Go to the source code of this file.

Macros

#define BUF_SIZE   1024
 
#define TAB_SIZE   4
 
#define CTRL_A   '\001'
 
#define CTRL_B   '\002'
 
#define CTRL_D   '\004'
 
#define CTRL_E   '\005'
 
#define CTRL_F   '\006'
 
#define CTRL_H   '\010'
 
#define CTRL_K   '\013'
 
#define CTRL_L   '\014'
 
#define CTRL_R   '\022'
 
#define CTRL_N   '\016'
 
#define CTRL_P   '\020'
 
#define CTRL_U   '\025'
 
#define CTRL_W   '\027'
 
#define TAB   '\t'
 
#define DEL   '\177'
 

Functions

static void gl_addchar (int c)
 
static int gl_tab (char *buf, int offset, int *loc)
 
static void gl_del (int loc)
 
static void gl_fixup (int change, int cursor)
 
static void gl_newline (int w)
 
static void gl_kill (void)
 
static void gl_kill_back_word (void)
 
static void hist_add (int w)
 
static void hist_next (int w)
 
static void hist_prev (int w)
 
char * tin_getline (const char *prompt, int number_only, const char *str, int max_chars, t_bool passwd, int which_hist)
 
void gl_redraw (void)
 

Variables

static char gl_buf [1024]
 
static const char * gl_prompt
 
static int gl_width = 0
 
static int gl_pos
 
static int gl_cnt = 0
 
static t_bool is_passwd
 
static int(* gl_in_hook )(char *)=0
 
static int(* gl_out_hook )(char *)=0
 
static int(* gl_tab_hook )(char *, int, int *) = gl_tab
 

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE   1024

Definition at line 25 of file getline.c.

◆ CTRL_A

#define CTRL_A   '\001'

Definition at line 28 of file getline.c.

◆ CTRL_B

#define CTRL_B   '\002'

Definition at line 29 of file getline.c.

◆ CTRL_D

#define CTRL_D   '\004'

Definition at line 30 of file getline.c.

◆ CTRL_E

#define CTRL_E   '\005'

Definition at line 31 of file getline.c.

◆ CTRL_F

#define CTRL_F   '\006'

Definition at line 32 of file getline.c.

◆ CTRL_H

#define CTRL_H   '\010'

Definition at line 33 of file getline.c.

◆ CTRL_K

#define CTRL_K   '\013'

Definition at line 34 of file getline.c.

◆ CTRL_L

#define CTRL_L   '\014'

Definition at line 35 of file getline.c.

◆ CTRL_N

#define CTRL_N   '\016'

Definition at line 37 of file getline.c.

◆ CTRL_P

#define CTRL_P   '\020'

Definition at line 38 of file getline.c.

◆ CTRL_R

#define CTRL_R   '\022'

Definition at line 36 of file getline.c.

◆ CTRL_U

#define CTRL_U   '\025'

Definition at line 39 of file getline.c.

◆ CTRL_W

#define CTRL_W   '\027'

Definition at line 40 of file getline.c.

◆ DEL

#define DEL   '\177'

Definition at line 42 of file getline.c.

◆ TAB

#define TAB   '\t'

Definition at line 41 of file getline.c.

◆ TAB_SIZE

#define TAB_SIZE   4

Definition at line 26 of file getline.c.

Function Documentation

◆ gl_addchar()

static void gl_addchar ( int  c)
static

Definition at line 340 of file getline.c.

References BUF_SIZE, gl_buf, gl_cnt, gl_fixup(), and gl_pos.

Referenced by tin_getline().

◆ gl_del()

static void gl_del ( int  loc)
static

Definition at line 421 of file getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_pos, and ring_bell().

Referenced by tin_getline().

◆ gl_fixup()

static void gl_fixup ( int  change,
int  cursor 
)
static

◆ gl_kill()

static void gl_kill ( void  )
static

Definition at line 439 of file getline.c.

References gl_buf, gl_cnt, gl_fixup(), gl_pos, and ring_bell().

Referenced by tin_getline().

◆ gl_kill_back_word()

static void gl_kill_back_word ( void  )
static

Definition at line 458 of file getline.c.

References gl_buf, gl_fixup(), gl_pos, and ring_bell().

Referenced by tin_getline().

◆ gl_newline()

static void gl_newline ( int  w)
static

Definition at line 377 of file getline.c.

References BUF_SIZE, error_message(), giveup(), gl_buf, gl_cnt, gl_fixup(), gl_out_hook, gl_width, hist_add(), and tin_progname.

Referenced by tin_getline().

◆ gl_redraw()

void gl_redraw ( void  )

Definition at line 512 of file getline.c.

References BUF_SIZE, clear_message(), cursoron(), gl_fixup(), gl_pos, gl_prompt, and my_fputs.

Referenced by handle_resize(), and tin_getline().

◆ gl_tab()

static int gl_tab ( char *  buf,
int  offset,
int *  loc 
)
static

Definition at line 648 of file getline.c.

References buf, offset, and TAB_SIZE.

◆ hist_add()

static void hist_add ( int  w)
static

Definition at line 681 of file getline.c.

References FreeAndNull, gl_buf, hist_last, HIST_NONE, hist_pos, HIST_SIZE, input_history, and my_strdup().

Referenced by gl_newline().

◆ hist_next()

static void hist_next ( int  w)
static

Definition at line 753 of file getline.c.

References BUF_SIZE, gl_buf, gl_fixup(), gl_in_hook, hist_last, HIST_NONE, hist_pos, HIST_SIZE, input_history, and ring_bell().

Referenced by tin_getline().

◆ hist_prev()

static void hist_prev ( int  w)
static

Definition at line 716 of file getline.c.

References BUF_SIZE, gl_buf, gl_fixup(), gl_in_hook, hist_last, HIST_NONE, hist_pos, HIST_SIZE, input_history, and ring_bell().

Referenced by tin_getline().

◆ tin_getline()

Variable Documentation

◆ gl_buf

char gl_buf[1024]
static

◆ gl_cnt

int gl_cnt = 0
static

Definition at line 52 of file getline.c.

Referenced by gl_addchar(), gl_del(), gl_fixup(), gl_kill(), gl_newline(), and tin_getline().

◆ gl_in_hook

int(* gl_in_hook) (char *)=0 ( char *  )
static

Definition at line 79 of file getline.c.

Referenced by hist_next(), hist_prev(), and tin_getline().

◆ gl_out_hook

int(* gl_out_hook) (char *)=0 ( char *  )
static

Definition at line 80 of file getline.c.

Referenced by gl_newline().

◆ gl_pos

int gl_pos
static

Definition at line 52 of file getline.c.

Referenced by gl_addchar(), gl_del(), gl_fixup(), gl_kill(), gl_kill_back_word(), gl_redraw(), and tin_getline().

◆ gl_prompt

const char* gl_prompt
static

Definition at line 50 of file getline.c.

Referenced by gl_redraw(), and tin_getline().

◆ gl_tab_hook

int(* gl_tab_hook) (char *, int, int *) ( char *  ,
int  ,
int *   
) = gl_tab
static

Definition at line 81 of file getline.c.

Referenced by tin_getline().

◆ gl_width

int gl_width = 0
static

Definition at line 51 of file getline.c.

Referenced by gl_fixup(), gl_newline(), and tin_getline().

◆ is_passwd

t_bool is_passwd
static

Definition at line 53 of file getline.c.

Referenced by gl_fixup(), and tin_getline().