From 388572c1ff69b9019476a3414211559f1bf6fa5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torleif=20Sk=C3=A5r?= <16509259+tskaar@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:10:22 +0200 Subject: [PATCH] utils/magsgtty.h: Refactor header includes --- utils/magsgtty.h | 48 +++++++++++------------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/utils/magsgtty.h b/utils/magsgtty.h index 59e0678a..a0847d74 100644 --- a/utils/magsgtty.h +++ b/utils/magsgtty.h @@ -21,44 +21,18 @@ #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 +#if defined(HAVE_TERMIOS_H) /* POSIX */ +# include +#elif defined(HAVE_TERMIO_H) /* SYSV */ +# include +# include +#else /* Fallback for older BSD/V7 systems */ +# if defined(HAVE_SGTTY_H) +# include +# elif defined(HAVE_SYS_IOCTL_COMPAT_H) +# include # endif - -/* unclear what platform requires this OpenBSD/FreeBSD ? */ -# ifndef COMPAT_43TTY -# define COMPAT_43TTY -# endif - -#ifdef HAVE_SYS_IOCTL_H -#include +# include #endif -#if defined(HAVE_TERMIOS_H) -#include -#elif defined(HAVE_SYS_IOCTL_COMPAT_H) -/* unclear which platform(s) require 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 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 /* replaced sgtty.h */ -#elif defined(HAVE_SGTTY_H) -#include /* legacy - struct sgttyb{} defn */ -#endif - -#else - -#if defined(HAVE_TERMIO_H) -#include -#endif - -#endif /* !SYSV && !CYGWIN */ - #endif /* _MAGIC__UTILS__MAGSGTTY_H */