mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
138 lines
2.7 KiB
Plaintext
138 lines
2.7 KiB
Plaintext
/*
|
|
* 92/02/01 07:30:28
|
|
* @(#) mytinfo term.tail 3.2 92/02/01 public domain, By Ross Ridge
|
|
*
|
|
*/
|
|
|
|
#if defined(_USE_TERMIO) || defined(_USE_TERMIOS)
|
|
#ifndef ICANON
|
|
#ifdef _USE_TERMIO
|
|
#include <termio.h>
|
|
#else
|
|
#include <termios.h>
|
|
#endif
|
|
#endif
|
|
#if defined(_USE_WINSZ) && defined(__FreeBSD__)
|
|
#include <sys/ioctl.h>
|
|
#endif
|
|
#if defined(_USE_WINSZ) && defined(xenix)
|
|
#include <sys/stream.h>
|
|
#include <sys/ptem.h>
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef _USE_SGTTY
|
|
#ifndef CBREAK
|
|
#include <sgtty.h>
|
|
#endif
|
|
#endif
|
|
|
|
typedef struct _terminal {
|
|
int fd;
|
|
#ifdef _USE_SMALLMEM
|
|
#ifdef _USE_TERMIOS
|
|
speed_t baudrate;
|
|
#else
|
|
unsigned short baudrate;
|
|
#endif
|
|
unsigned pad:1, xon:1, termcap:1;
|
|
#else
|
|
int pad;
|
|
int xon;
|
|
int termcap;
|
|
#ifdef _USE_TERMIOS
|
|
speed_t baudrate;
|
|
#else
|
|
long baudrate;
|
|
#endif
|
|
#endif
|
|
char padch;
|
|
short true_lines, true_columns;
|
|
struct strbuf {
|
|
struct strbuf *next;
|
|
#ifdef _USE_SMALLMEM
|
|
short len;
|
|
#else
|
|
int len;
|
|
#endif
|
|
char buf[_MAX_CHUNK];
|
|
} *strbuf;
|
|
char *name, *name_long, *name_all;
|
|
#ifdef _USE_SGTTY
|
|
struct sgtty_str {
|
|
struct sgttyb v6;
|
|
#ifdef TIOCGETC
|
|
struct tchars v7;
|
|
#endif
|
|
#ifdef TIOCLGET
|
|
int bsd;
|
|
#endif
|
|
#ifdef TIOCGLTC
|
|
struct ltchars bsd_new;
|
|
#endif
|
|
} prog_mode, shell_mode;
|
|
#else /* _USE_SGTTY */
|
|
#ifdef _USE_TERMIOS
|
|
struct termios prog_mode, shell_mode;
|
|
#else
|
|
#ifdef _USE_TERMIO
|
|
struct termio prog_mode, shell_mode;
|
|
#endif
|
|
#endif
|
|
#endif /* else _USE_SGTTY */
|
|
#ifdef _USE_WINSZ
|
|
#ifdef TIOCGWINSZ
|
|
struct winsize prog_winsz, shell_winsz;
|
|
#endif
|
|
#endif
|
|
char bools[NUM_OF_BOOLS];
|
|
short nums[NUM_OF_NUMS];
|
|
char *strs[NUM_OF_STRS];
|
|
} TERMINAL;
|
|
|
|
#ifndef _CUR_TERM
|
|
#ifdef SINGLE
|
|
#define _CUR_TERM _term_buf
|
|
#else
|
|
#define _CUR_TERM (*cur_term)
|
|
#endif
|
|
#endif
|
|
|
|
extern TERMINAL *cur_term;
|
|
extern TERMINAL _term_buf;
|
|
|
|
#ifndef __P
|
|
#if defined(_USE_PROTOTYPES) && (defined(__STDC__) || defined(__cplusplus))
|
|
#define __P(protos) protos /* full-blown ANSI C */
|
|
#else
|
|
#define __P(protos) () /* traditional C preprocessor */
|
|
#endif
|
|
#endif
|
|
|
|
extern char *tparm __P((const char *, ...));
|
|
extern int setupterm __P((char *, int, int *)), set_curterm __P((TERMINAL *));
|
|
extern int del_curterm __P((TERMINAL *)), tputs __P((const char *, int, int (*)(int)));
|
|
extern int putp __P((char *));
|
|
extern int tigetflag __P((char *)), tigetnum __P((char *));
|
|
extern char *tigetstr __P((char *));
|
|
extern int def_prog_mode __P((void)), def_shell_mode __P((void));
|
|
extern int reset_prog_mode __P((void)), reset_shell_mode __P((void));
|
|
|
|
extern char *boolnames[], *boolcodes[], *boolfnames[];
|
|
extern char *numnames[], *numcodes[], *numfnames[];
|
|
extern char *strnames[], *strcodes[], *strfnames[];
|
|
|
|
#ifndef OK
|
|
#undef ERR
|
|
#define OK (0)
|
|
#define ERR (-1)
|
|
#endif
|
|
|
|
/* Compatibility */
|
|
#define Filedes fd
|
|
#define Ottyb shell_mode
|
|
#define Nttyb prog_mode
|
|
#define TTY struct termios
|
|
|
|
#endif /* _TERM_H_ */
|