|
|
int P4_fcntl_F_GETFL(int fd, int arg)
{
static seen;
if (! seen)
{
P4_warn2 ( |
int P4_fcntl_F_SETFL(int fd, int arg)
{
static seen;
if (! seen)
{
P4_warn2 ( |
|
|
|
static int c_interrupt_key (char ch); static int c_prepare_terminal (void); static void c_cleanup_terminal (void); static void c_interactive_terminal (void); static void c_system_terminal (void); static void c_query_winsize (void); static int c_keypressed (void); static int c_getkey (void); static void c_putc_noflush (char c); static void c_put_flush (void); static void c_putc (char c); static void c_puts (const char *s); static void c_gotoxy (int x, int y); static void c_wherexy (int *x, int *y); static void c_tput (int); |
|
|
|
static int saved_fcntl[3] = {0}; |
|
static void |
static void |
|
|
|
|
|
|
int
c_interrupt_key (char ch)
|
|
|
|
static void tty_interactive (void) { |
|
|
|
static struct
{
struct sgttyb sg;
struct tchars tc;
int lc; |
|
static int
c_interrupt_key (char ch)
|
|
static void tty_interactive (void) { struct sgttyb sg = tty_system.sg; struct tchars tc = tty_system.tc; int flags; if (! isatty (STDIN_FILENO)) return; sg.sg_flags &= ~C_FLAGS_OFF; sg.sg_flags |= C_FLAGS_ON; tc.t_intrc = INTR_KEY; tc.t_quitc = QUIT_KEY; tc.t_startc = -1; tc.t_stopc = -1; ioctl (STDIN_FILENO, TIOCSETP, &sg); ioctl (STDIN_FILENO, TIOCSETC, &tc); flags = L_FLAGS_ON; ioctl (STDIN_FILENO, TIOCLBIS, &flags); } |
|
|
|
static int c_interrupt_key (char ch) { return 0; } |
static void tty_interactive (void) { ioctl (0, FIOSETOPTIONS, ioctl (0, FIOGETOPTIONS, 0) & ~OPT_LINE); ioctl (0, FIOSETOPTIONS, ioctl (0, FIOGETOPTIONS, 0) & ~OPT_ECHO); } |
|
|
|
|
|
|
|
|
static char tckeycode[][3] = { |
|
static char tcctlcode[][3] = { |
|
|
extern char const * p4_vt100_controls[]; extern char const * p4_vt100_rawkeys[]; |
static void t_puts (int cap, int n) { fputs (PFE.control_string[cap], stdout); } |
static char * tparm (int cap, int x, int y) |
|
|
|
|
|
static int query_database (void) |
static int |
static void t_puts (int tcidx, int n) |
|
p4_term_struct p4_term_ios =
{
|
|
|
|
static int query_database (void) { int errret; static char erase[] = |
static int |
static void |
|
p4_term_struct p4_term_ios =
{
|
|
static int |
static void
c_cleanup_terminal (void)
{
return; |
static void |
static void |
|
|
static void c_query_winsize (void) { struct winsize size; if (ioctl (1, TIOCGWINSZ, (char *) &size) >= 0) { PFE.rows = size.ws_row; PFE.cols = size.ws_col; PFE.xmax = size.ws_xpixel; PFE.ymax = size.ws_ypixel; } } |
|
static void c_query_winsize (void) { } |
|
|
|
|
|
static unsigned short |
|
nxch = NOCH; |
|
static int
nextch (void)
|
static int c_keypressed (void) |
static int c_getkey (void) { fflush (stdout); if (PFE.wait_for_stdin) PFE.wait_for_stdin (); return nextch (); } |
|
static int row, col; |
|
static void |
static void c_put_flush (void) { fflush (stdout); } |
static void c_putc (char c) { c_putc_noflush (c); fflush (stdout); } |
static void c_puts (const char *s) { while (*s) c_putc_noflush (*s++); fflush (stdout); } |
static void c_gotoxy (int x, int y) { tputs (tparm (cursor_address, y, x), 1, t_putc); fflush (stdout); col = x; row = y; } |
static void c_wherexy (int *x, int *y) { *x = col; *y = row; } |
static void
c_tput (int attr)
{
switch (attr)
{
case P4_TERM_GOLEFT: t_puts (cursor_left, 0); --col; break;
case P4_TERM_GORIGHT: t_puts (cursor_right, 0); ++col; break;
case P4_TERM_GOUP: t_puts (cursor_up, 0); --row; break;
case P4_TERM_GODOWN: t_puts (cursor_down, 0); ++row; break;
case P4_TERM_CLRSCR: t_puts (clear_screen, PFE.rows); |
|