File: tty.h

package info (click to toggle)
cftp 0.9-10
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 848 kB
  • ctags: 576
  • sloc: ansic: 6,985; sh: 329; makefile: 82
file content (89 lines) | stat: -rw-r--r-- 2,671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef HAD_TTY_H
#define HAD_TTY_H

/*
  tty.h -- lowlevel tty handling
  Copyright (C) 1996, 1997 Dieter Baron

  This file is part of cftp, a fullscreen ftp client
  The author can be contacted at <dillo@giga.or.at>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/



enum {
    _TTY_cl, _TTY_ho, _TTY_cd, _TTY_ce, _TTY_so, _TTY_se, _TTY_vi,
    _TTY_ve, _TTY_cs, _TTY_sf, _TTY_sr, _TTY_SF, _TTY_SR,
    _TTY_ll,
    _TTY_al, _TTY_dl, _TTY_AL, _TTY_DL   
};
extern char *_tty_caps[];
extern int fputchar();

#define TTY_CAP(cap)	(_tty_caps[(_TTY_##cap)])
#define tty_put0(cap, lines)  \
		(tputs(TTY_CAP(cap), (lines), fputchar))

#define tty_clear()	(tty_put0(cl, tty_lines))
#define tty_home()	(tty_put0(ho, 1))
#define tty_clreos(l)	(tty_put0(cd, (l)))
#define tty_clreol()	(tty_put0(ce, 1))
#define tty_standout()	(tty_put0(so, 1))
#define tty_standend()	(tty_put0(se, 1))
#define tty_hidecrsr()	(tty_put0(vi, 1))
#define tty_showcrsr()	(tty_put0(ve, 1))

void tty_lowleft(void);

#define tty_scregion(s, e)	(tty_putp(TTY_CAP(cs), 1, s, e, 0, 0))

#define tty_scrollup(n, l)	(tty_parp(TTY_CAP(sf), TTY_CAP(SF), (n), (l)))
#define tty_scrolldown(n, l)	(tty_parp(TTY_CAP(sr), TTY_CAP(SR), (n), (l)))
#define tty_inslines(n, l)	(tty_parp(TTY_CAP(al), TTY_CAP(AL), (n), (l)))
#define tty_dellines(n, l)	(tty_parp(TTY_CAP(dl), TTY_CAP(DL), (n), (l)))



extern volatile int tty_cols, tty_lines;

enum tty_am { TTY_AMNONE, TTY_AMXN, TTY_AM };

enum tty_am tty_am;

extern int tty_metap, tty_noLP,
	   tty_verase, tty_vwerase, tty_vkill;

extern void (*tty_redraw)(void);



int tty_init(void);
int tty_setup(void);
int tty_restore(void);
void tty_put(char *name, int lines);
void tty_goto(int x, int y);
int tty_noecho(void);
int tty_echo(void);
int tty_cbreak(void);
int tty_readkey(void);
int tty_vmin(int min, int tim);
char *tty_getcap(char *name);
int tty_iscap(char *name);
void tty_putp(char *cap, int line, int arg0, int arg1, int arg2, int arg3);
void tty_parp(char *cap, char *pcap, int n, int pad);

#endif /* tty.h */