mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Retry revert
I had a local modification before my revert. Try reverting one more time.
This commit is contained in:
parent
500cd2d6a1
commit
cebbed43bb
1 changed files with 52 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
|||
# include <termios.h>
|
||||
# endif
|
||||
#endif
|
||||
#if defined(TERMIO) || defined(TERMIOS)
|
||||
# ifndef TAB3
|
||||
# ifdef OXTABS
|
||||
# define TAB3 OXTABS
|
||||
|
|
@ -43,6 +44,7 @@
|
|||
# define TAB3 0
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#include <curses.h>
|
||||
#include <termcap.h>
|
||||
#include "screen.h"
|
||||
|
|
@ -73,12 +75,18 @@ char *end_standout;
|
|||
char *terminal_init;
|
||||
char *terminal_end;
|
||||
|
||||
#ifdef SGTTY
|
||||
static struct sgttyb old_settings;
|
||||
static struct sgttyb new_settings;
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
static struct termio old_settings;
|
||||
static struct termio new_settings;
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
static struct termios old_settings;
|
||||
static struct termios new_settings;
|
||||
#endif
|
||||
static char is_a_terminal = No;
|
||||
#ifdef TOStop
|
||||
static int old_lword;
|
||||
|
|
@ -209,18 +217,24 @@ int interactive;
|
|||
get_screensize();
|
||||
|
||||
/* if stdout is not a terminal, pretend we are a dumb terminal */
|
||||
#ifdef SGTTY
|
||||
if (ioctl(STDOUT, TIOCGETP, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
if (ioctl(STDOUT, TCGETA, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
if (tcgetattr(STDOUT, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -228,6 +242,7 @@ 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 */
|
||||
|
|
@ -256,6 +271,8 @@ init_screen()
|
|||
/* 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 */
|
||||
|
|
@ -278,6 +295,8 @@ init_screen()
|
|||
/* 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 */
|
||||
|
|
@ -300,6 +319,7 @@ init_screen()
|
|||
/* send the termcap initialization string */
|
||||
putcap(terminal_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!is_a_terminal)
|
||||
{
|
||||
|
|
@ -324,12 +344,18 @@ end_screen()
|
|||
/* 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -340,12 +366,18 @@ 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 */
|
||||
|
|
@ -360,6 +392,7 @@ get_screensize()
|
|||
|
||||
{
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
|
||||
struct winsize ws;
|
||||
|
||||
|
|
@ -375,6 +408,25 @@ get_screensize()
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef TIOCGSIZE
|
||||
|
||||
struct ttysize ts;
|
||||
|
||||
if (ioctl (1, TIOCGSIZE, &ts) != -1)
|
||||
{
|
||||
if (ts.ts_lines != 0)
|
||||
{
|
||||
screen_length = ts.ts_lines;
|
||||
}
|
||||
if (ts.ts_cols != 0)
|
||||
{
|
||||
screen_width = ts.ts_cols - 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* TIOCGSIZE */
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
(void) strncpy(lower_left, tgoto(cursor_motion, 0, screen_length - 1),
|
||||
sizeof(lower_left) - 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue