コード例 #1
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
end_screen()

{
	/* move to the lower left, clear the line and send "te" */
	if (smart_terminal)
	{
		putcap(lower_left);
		putcap(clear_line);
		fflush(stdout);
		putcap(terminal_end);
	}

	/* if we have settings to reset, then do so */
	if (is_a_terminal)
	{
#ifdef SGTTY
		(void) ioctl(STDOUT, TIOCSETP, &old_settings);
#ifdef TOStop
		(void) ioctl(STDOUT, TIOCLSET, &old_lword);
#endif
#endif
#ifdef TERMIO
		(void) ioctl(STDOUT, TCSETA, &old_settings);
#endif
#ifdef TERMIOS
		(void) tcsetattr(STDOUT, TCSADRAIN, &old_settings);
#endif
	}
}
コード例 #2
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
standout(char *msg)

{
	if (smart_terminal)
	{
		putcap(start_standout);
		fputs(msg, stdout);
		putcap(end_standout);
	}
	else
	{
		fputs(msg, stdout);
	}
}
コード例 #3
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
reinit_screen()

{
	/* install our settings if it is a terminal */
	if (is_a_terminal)
	{
#ifdef SGTTY
		(void) ioctl(STDOUT, TIOCSETP, &new_settings);
#ifdef TOStop
		(void) ioctl(STDOUT, TIOCLSET, &new_lword);
#endif
#endif
#ifdef TERMIO
		(void) ioctl(STDOUT, TCSETA, &new_settings);
#endif
#ifdef TERMIOS
		(void) tcsetattr(STDOUT, TCSADRAIN, &new_settings);
#endif
	}

	/* send init string */
	if (smart_terminal)
	{
		putcap(terminal_init);
	}
}
コード例 #4
0
ファイル: screen.c プロジェクト: AhmadTux/DragonFlyBSD
void
screen_cleareol(int len)

{
    int i;

    if (smart_terminal && !tc_overstrike && len > 0)
    {
	if (tc_clear_line)
	{
	    putcap(tc_clear_line);
	    return;
	}
	else
	{
	    i = 0;
	    while (i++ < 0)
	    {
		putchar(' ');
	    }
	    i = 0;
	    while (i++ < 0)
	    {
		putchar('\b');
	    }
	    return;
	}
    }
    return;
}
コード例 #5
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
go_home()

{
	if (smart_terminal)
	{
		putcap(home);
	}
}
コード例 #6
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
clear()

{
	if (smart_terminal)
	{
		putcap(clear_screen);
	}
}
コード例 #7
0
ファイル: screen.c プロジェクト: AhmadTux/DragonFlyBSD
void
screen_home()

{
    if (smart_terminal)
    {
	putcap(home);
    }
}
コード例 #8
0
ファイル: screen.c プロジェクト: AhmadTux/DragonFlyBSD
void
screen_clear()

{
    if (smart_terminal)
    {
	putcap(tc_clear_screen);
    }
}
コード例 #9
0
ファイル: screen.c プロジェクト: AhmadTux/DragonFlyBSD
int
screen_cte()

{
    if (smart_terminal)
    {
	if (tc_clear_to_end)
	{
	    putcap(tc_clear_to_end);
	    return(Yes);
	}
    }
    return(No);
}
コード例 #10
0
ファイル: screen.c プロジェクト: xrg/pg_top
int
clear_eol(int len)

{
	if (smart_terminal && !overstrike && len > 0)
	{
		if (clear_line)
		{
			putcap(clear_line);
			return (0);
		}
		else
		{
			while (len-- > 0)
			{
				putchar(' ');
			}
			return (1);
		}
	}
	return (-1);
}
コード例 #11
0
ファイル: screen.c プロジェクト: xrg/pg_top
void
init_screen()

{
	/* get the old settings for safe keeping */
#ifdef SGTTY
	if (ioctl(STDOUT, TIOCGETP, &old_settings) != -1)
	{
		/* copy the settings so we can modify them */
		new_settings = old_settings;

		/* turn on CBREAK and turn off character echo and tab expansion */
		new_settings.sg_flags |= CBREAK;
		new_settings.sg_flags &= ~(ECHO | XTABS);
		(void) ioctl(STDOUT, TIOCSETP, &new_settings);

		/* remember the erase and kill characters */
		ch_erase = old_settings.sg_erase;
		ch_kill = old_settings.sg_kill;

#ifdef TOStop
		/* get the local mode word */
		(void) ioctl(STDOUT, TIOCLGET, &old_lword);

		/* modify it */
		new_lword = old_lword | LTOSTOP;
		(void) ioctl(STDOUT, TIOCLSET, &new_lword);
#endif
		/* remember that it really is a terminal */
		is_a_terminal = Yes;

		/* send the termcap initialization string */
		putcap(terminal_init);
	}
#endif
#ifdef TERMIO
	if (ioctl(STDOUT, TCGETA, &old_settings) != -1)
	{
		/* copy the settings so we can modify them */
		new_settings = old_settings;

		/* turn off ICANON, character echo and tab expansion */
		new_settings.c_lflag &= ~(ICANON | ECHO);
		new_settings.c_oflag &= ~(TAB3);
		new_settings.c_cc[VMIN] = 1;
		new_settings.c_cc[VTIME] = 0;
		(void) ioctl(STDOUT, TCSETA, &new_settings);

		/* remember the erase and kill characters */
		ch_erase = old_settings.c_cc[VERASE];
		ch_kill = old_settings.c_cc[VKILL];

		/* remember that it really is a terminal */
		is_a_terminal = Yes;

		/* send the termcap initialization string */
		putcap(terminal_init);
	}
#endif
#ifdef TERMIOS
	if (tcgetattr(STDOUT, &old_settings) != -1)
	{
		/* copy the settings so we can modify them */
		new_settings = old_settings;

		/* turn off ICANON, character echo and tab expansion */
		new_settings.c_lflag &= ~(ICANON | ECHO);
		new_settings.c_oflag &= ~(TAB3);
		new_settings.c_cc[VMIN] = 1;
		new_settings.c_cc[VTIME] = 0;
		(void) tcsetattr(STDOUT, TCSADRAIN, &new_settings);

		/* remember the erase and kill characters */
		ch_erase = old_settings.c_cc[VERASE];
		ch_kill = old_settings.c_cc[VKILL];

		/* remember that it really is a terminal */
		is_a_terminal = Yes;

		/* send the termcap initialization string */
		putcap(terminal_init);
	}
#endif

	if (!is_a_terminal)
	{
		/* not a terminal at all---consider it dumb */
		smart_terminal = No;
	}
}