utils/magsgtty.h removal and fixup
This commit is contained in:
parent
2f26237b8b
commit
1bb5316d8d
|
|
@ -63,7 +63,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include <unistd.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/hash.h"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "graphics/graphics.h"
|
||||
#include "windows/windows.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <X11/Xlib.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "windows/windows.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include <X11/Xutil.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "textio/txcommands.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <X11/Xlib.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
|
|
|||
|
|
@ -42,20 +42,6 @@ typedef struct {
|
|||
#define TX_PROMPT '>'
|
||||
#define TX_CMD_PROMPT ":"
|
||||
|
||||
/* all of the state associated with a tty terminal */
|
||||
#if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN)
|
||||
#if defined(HAVE_SYS_IOCTL_COMPAT_H) || defined(HAVE_SGTTY_H)
|
||||
#if defined(HAVE_SYS_IOCTL_COMPAT_H)
|
||||
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
|
||||
#elif defined(HAVE_SGTTY_H)
|
||||
#include <sgtty.h>/* legacy - struct sgttyb{} defn */
|
||||
#endif
|
||||
typedef struct {
|
||||
struct sgttyb tx_i_sgtty;
|
||||
struct tchars tx_i_tchars;
|
||||
} txTermState;
|
||||
#endif /* HAVE_SYS_IOCTL_COMPAT_H || HAVE_SGTTY_H */
|
||||
#endif /* SYSV */
|
||||
|
||||
extern bool TxGetInputEvent(bool block, bool returnOnSigWinch);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ static char rcsid[] __attribute__ ((unused)) ="$Header: /usr/cvsroot/magic-8.0/t
|
|||
#endif
|
||||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/magic.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
|
|
|
|||
125
textio/txInput.c
125
textio/txInput.c
|
|
@ -32,14 +32,13 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include <dirent.h>
|
||||
|
||||
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/main.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "textio/txcommands.h"
|
||||
#include "textio/textioInt.h"
|
||||
#include "utils/magsgtty.h" /* txTermState */
|
||||
#include "utils/dqueue.h"
|
||||
#include "utils/macros.h"
|
||||
#include "utils/hash.h"
|
||||
|
|
@ -1225,36 +1224,21 @@ TxGetLine(
|
|||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
|
||||
void
|
||||
txGetTermState(
|
||||
struct termio *buf)
|
||||
{
|
||||
ioctl( fileno( stdin ), TCGETA, buf);
|
||||
}
|
||||
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
|
||||
void
|
||||
txGetTermState(
|
||||
struct termios *buf)
|
||||
{
|
||||
(void) tcgetattr(fileno(stdin), buf);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
txGetTermState(
|
||||
txTermState *buf)
|
||||
{
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
(void) tcgetattr(fileno(stdin), &buf->termios);
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
ioctl(fileno(stdin), TCGETA, &buf->termio);
|
||||
#else /* sgtty */
|
||||
ASSERT(TxStdinIsatty, "txGetTermState");
|
||||
/* save the current terminal characteristics */
|
||||
(void) ioctl(fileno(stdin), TIOCGETP, (char *) &(buf->tx_i_sgtty) );
|
||||
(void) ioctl(fileno(stdin), TIOCGETC, (char *) &(buf->tx_i_tchars) );
|
||||
(void) ioctl(fileno(stdin), TIOCGETP, (char *) &buf->tx_i_sgtty);
|
||||
(void) ioctl(fileno(stdin), TIOCGETC, (char *) &buf->tx_i_tchars);
|
||||
#endif
|
||||
}
|
||||
#endif /* SYSV */
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -1273,24 +1257,17 @@ txGetTermState(
|
|||
|
||||
void
|
||||
txSetTermState(
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
struct termio *buf
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
struct termios *buf
|
||||
#else
|
||||
txTermState *buf
|
||||
#endif /* SYSV */
|
||||
)
|
||||
txTermState *buf)
|
||||
{
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
ioctl( fileno(stdin), TCSETAF, buf );
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
(void) tcsetattr( fileno(stdin), TCSANOW, buf );
|
||||
#else
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
(void) tcsetattr(fileno(stdin), TCSANOW, &buf->termios);
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
ioctl(fileno(stdin), TCSETAF, &buf->termio);
|
||||
#else /* sgtty */
|
||||
/* set the current terminal characteristics */
|
||||
(void) ioctl(fileno(stdin), TIOCSETN, (char *) &(buf->tx_i_sgtty) );
|
||||
(void) ioctl(fileno(stdin), TIOCSETC, (char *) &(buf->tx_i_tchars) );
|
||||
#endif /* SYSV */
|
||||
(void) ioctl(fileno(stdin), TIOCSETN, (char *) &buf->tx_i_sgtty);
|
||||
(void) ioctl(fileno(stdin), TIOCSETC, (char *) &buf->tx_i_tchars);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1313,37 +1290,27 @@ txSetTermState(
|
|||
|
||||
void
|
||||
txInitTermRec(
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
struct termio *buf
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
struct termios *buf
|
||||
#else
|
||||
txTermState *buf
|
||||
#endif /* SYSV */
|
||||
)
|
||||
txTermState *buf)
|
||||
{
|
||||
#if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
|
||||
buf->c_cc[ VMIN ] = 1;
|
||||
buf->c_cc[ VTIME ] = 0;
|
||||
#else
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
buf->termios.c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
|
||||
buf->termios.c_cc[ VMIN ] = 1;
|
||||
buf->termios.c_cc[ VTIME ] = 0;
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
buf->termio.c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
|
||||
buf->termio.c_cc[ VMIN ] = 1;
|
||||
buf->termio.c_cc[ VTIME ] = 0;
|
||||
#else /* sgtty */
|
||||
/* set things up for us, turn off echo, turn on cbreak, no EOF */
|
||||
buf->tx_i_sgtty.sg_flags |= CBREAK;
|
||||
buf->tx_i_sgtty.sg_flags &= ~ECHO;
|
||||
buf->tx_i_tchars.t_eofc = -1;
|
||||
|
||||
#endif /* SYSV */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
struct termio closeTermState;
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
struct termios closeTermState;
|
||||
#else
|
||||
static txTermState closeTermState;
|
||||
#endif /* SYSV */
|
||||
|
||||
static bool haveCloseState = FALSE;
|
||||
|
||||
|
|
@ -1366,21 +1333,21 @@ static bool haveCloseState = FALSE;
|
|||
void
|
||||
txSaveTerm(void)
|
||||
{
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
ioctl( fileno( stdin ), TCGETA, &closeTermState);
|
||||
txEraseChar = closeTermState.c_cc[VERASE];
|
||||
txKillChar = closeTermState.c_cc[VKILL];
|
||||
TxEOFChar = closeTermState.c_cc[VEOF];
|
||||
TxInterruptChar = closeTermState.c_cc[VINTR];
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
(void) tcgetattr(fileno(stdin), &closeTermState.termios);
|
||||
txEraseChar = closeTermState.termios.c_cc[VERASE];
|
||||
txKillChar = closeTermState.termios.c_cc[VKILL];
|
||||
TxEOFChar = closeTermState.termios.c_cc[VEOF];
|
||||
TxInterruptChar = closeTermState.termios.c_cc[VINTR];
|
||||
haveCloseState = TRUE;
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
(void) tcgetattr( fileno( stdin ), &closeTermState);
|
||||
txEraseChar = closeTermState.c_cc[VERASE];
|
||||
txKillChar = closeTermState.c_cc[VKILL];
|
||||
TxEOFChar = closeTermState.c_cc[VEOF];
|
||||
TxInterruptChar = closeTermState.c_cc[VINTR];
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
ioctl(fileno(stdin), TCGETA, &closeTermState.termio);
|
||||
txEraseChar = closeTermState.termio.c_cc[VERASE];
|
||||
txKillChar = closeTermState.termio.c_cc[VKILL];
|
||||
TxEOFChar = closeTermState.termio.c_cc[VEOF];
|
||||
TxInterruptChar = closeTermState.termio.c_cc[VINTR];
|
||||
haveCloseState = TRUE;
|
||||
#else
|
||||
#else /* sgtty */
|
||||
struct ltchars lt;
|
||||
txGetTermState(&closeTermState);
|
||||
(void) ioctl(fileno(stdin), TIOCGLTC, (char *) <);
|
||||
|
|
@ -1393,7 +1360,7 @@ txSaveTerm(void)
|
|||
TxEOFChar = closeTermState.tx_i_tchars.t_eofc;
|
||||
TxInterruptChar = closeTermState.tx_i_tchars.t_intrc;
|
||||
haveCloseState = TRUE;
|
||||
#endif /* SYSV */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1414,13 +1381,7 @@ txSaveTerm(void)
|
|||
void
|
||||
TxSetTerminal(void)
|
||||
{
|
||||
#if defined(SYSV) || defined(CYGWIN)
|
||||
struct termio buf;
|
||||
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
|
||||
struct termios buf;
|
||||
#else
|
||||
txTermState buf;
|
||||
#endif /* SYSV */
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
/* If using Tk console, don't mess with the terminal settings; */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/magic.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/magic.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
|
|
|
|||
|
|
@ -21,44 +21,54 @@
|
|||
#ifndef _MAGIC__UTILS__MAGSGTTY_H
|
||||
#define _MAGIC__UTILS__MAGSGTTY_H
|
||||
|
||||
/* maybe this can be #ifndef HAVE_TERMIO_H */
|
||||
#if !defined(SYSV) && !defined(CYGWIN)
|
||||
|
||||
# ifdef ALPHA
|
||||
# undef MAX
|
||||
# undef MIN
|
||||
# endif
|
||||
|
||||
/* unclear what platform requires this OpenBSD/FreeBSD ? */
|
||||
# ifndef COMPAT_43TTY
|
||||
# define COMPAT_43TTY
|
||||
# endif
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
#include <termios.h>
|
||||
#elif defined(HAVE_SYS_IOCTL_COMPAT_H)
|
||||
/* unclear which platform(s) require <sys/ioctl_compat.h> and the structure
|
||||
* of this file is such that it will try to include it by default, better
|
||||
* to invert the #if and only select this on the known platforms that need
|
||||
* it so that <termios.h> goes by default, which exists on MacOSX, Linux, etc..
|
||||
* many possible solutions to make this work by default:
|
||||
* HAVE_SYS_IOCTL_COMPAT_H ? HAVE_TERMIOS_H ? !defined(linux) at top (MaxOSX is BSD type)
|
||||
*/
|
||||
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
|
||||
#elif defined(HAVE_SGTTY_H)
|
||||
#include <sgtty.h> /* legacy - struct sgttyb{} defn */
|
||||
/* In modern times everything has POSIX */
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
/* Linux glibx 2.x - present
|
||||
* FreeBSD 14.3-RELEASE - present
|
||||
* Solaris 11.4 - present
|
||||
*/
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
/* Linux glibx 2.x - present (just includes termios.h & sys/ioctl.h)
|
||||
* Linux glibc 2.45+ - not present
|
||||
* FreeBSD 14.3-RELEASE - not present
|
||||
* Solaris 11.4 - present
|
||||
*/
|
||||
#include <termio.h>
|
||||
#else /* sgtty */
|
||||
#if defined(HAVE_SYS_IOCTL_COMPAT_H)
|
||||
/* Linux glibc2.x - not present
|
||||
* FreeBSD 14.3-RELEASE - not present
|
||||
* Solaris 11.4 - not present
|
||||
*/
|
||||
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
|
||||
#elif defined(HAVE_SGTTY_H)
|
||||
/* Linux glibc2.x - present (includes sys/ioctl.h)
|
||||
* FreeBSD 14.3-RELEASE - not present
|
||||
* Solaris 11.4 - present
|
||||
*/
|
||||
#include <sgtty.h> /* legacy - struct sgttyb{} defn */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(HAVE_TERMIO_H)
|
||||
#include <termio.h>
|
||||
/* all of the state associated with a tty terminal */
|
||||
typedef struct {
|
||||
#if defined(HAVE_TERMIOS_H)
|
||||
struct termios termios;
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
struct termio termio;
|
||||
#else /* sgtty */
|
||||
struct sgttyb tx_i_sgtty;
|
||||
struct tchars tx_i_tchars;
|
||||
#endif
|
||||
} txTermState;
|
||||
|
||||
#endif /* !SYSV && !CYGWIN */
|
||||
|
||||
#endif /* _MAGIC__UTILS__MAGSGTTY_H */
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/malloc.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "utils/hash.h"
|
||||
#include "utils/macros.h"
|
||||
#include "textio/textio.h"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/signals.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue