diff --git a/include/termios.h b/include/termios.h --- a/include/termios.h +++ b/include/termios.h @@ -38,6 +38,9 @@ #include #include #include +#if __BSD_VISIBLE +#include +#endif #ifndef _PID_T_DECLARED typedef __pid_t pid_t; @@ -92,6 +95,9 @@ void cfmakeraw(struct termios *); void cfmakesane(struct termios *); int cfsetspeed(struct termios *, speed_t); + +int tcgetwinsize(int, struct winsize *); +int tcsetwinsize(int, const struct winsize *); #endif __END_DECLS diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -428,6 +428,8 @@ sigandset; sigisemptyset; sigorset; + tcgetwinsize; + tcsetwinsize; }; FBSDprivate_1.0 { diff --git a/lib/libc/gen/termios.c b/lib/libc/gen/termios.c --- a/lib/libc/gen/termios.c +++ b/lib/libc/gen/termios.c @@ -275,3 +275,17 @@ } /* NOTREACHED */ } + +int +tcgetwinsize(int fd, struct winsize *w) +{ + + return (_ioctl(fd, TIOCGWINSZ, w)); +} + +int +tcsetwinsize(int fd, const struct winsize *w) +{ + + return (_ioctl(fd, TIOCSWINSZ, w)); +} diff --git a/include/termios.h b/sys/sys/_winsize.h copy from include/termios.h copy to sys/sys/_winsize.h --- a/include/termios.h +++ b/sys/sys/_winsize.h @@ -28,76 +28,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)termios.h 8.3 (Berkeley) 3/28/94 + * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 * $FreeBSD$ */ -#ifndef _TERMIOS_H_ -#define _TERMIOS_H_ - -#include -#include -#include - -#ifndef _PID_T_DECLARED -typedef __pid_t pid_t; -#define _PID_T_DECLARED -#endif - -#if __BSD_VISIBLE -#define OXTABS TAB3 -#define MDMBUF CCAR_OFLOW -#endif - -#if __BSD_VISIBLE -#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) -#endif +#ifndef _SYS__WINSIZE_H_ +#define _SYS__WINSIZE_H_ /* - * Commands passed to tcsetattr() for setting the termios structure. + * Window/terminal size structure. This information is stored by the kernel + * in order to provide a consistent interface, but is not used by the kernel. */ -#define TCSANOW 0 /* make change immediate */ -#define TCSADRAIN 1 /* drain output, then change */ -#define TCSAFLUSH 2 /* drain output, flush input */ -#if __BSD_VISIBLE -#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ -#endif - -#define TCIFLUSH 1 -#define TCOFLUSH 2 -#define TCIOFLUSH 3 -#define TCOOFF 1 -#define TCOON 2 -#define TCIOFF 3 -#define TCION 4 - -__BEGIN_DECLS -speed_t cfgetispeed(const struct termios *); -speed_t cfgetospeed(const struct termios *); -int cfsetispeed(struct termios *, speed_t); -int cfsetospeed(struct termios *, speed_t); -int tcgetattr(int, struct termios *); -int tcsetattr(int, int, const struct termios *); -int tcdrain(int); -int tcflow(int, int); -int tcflush(int, int); -int tcsendbreak(int, int); - -#if __POSIX_VISIBLE >= 200112 -pid_t tcgetsid(int); -#endif -#if __BSD_VISIBLE -int tcsetsid(int, pid_t); - -void cfmakeraw(struct termios *); -void cfmakesane(struct termios *); -int cfsetspeed(struct termios *, speed_t); -#endif -__END_DECLS - -#endif /* !_TERMIOS_H_ */ - -#if __BSD_VISIBLE -#include -#include -#endif +struct winsize { + unsigned short ws_row; /* rows, in characters */ + unsigned short ws_col; /* columns, in characters */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ +}; + +#endif /* !_SYS__WINSIZE_H_ */ diff --git a/sys/sys/ttycom.h b/sys/sys/ttycom.h --- a/sys/sys/ttycom.h +++ b/sys/sys/ttycom.h @@ -41,23 +41,13 @@ #define _SYS_TTYCOM_H_ #include +#include /* * Tty ioctl's except for those supported only for backwards compatibility * with the old tty driver. */ -/* - * Window/terminal size structure. This information is stored by the kernel - * in order to provide a consistent interface, but is not used by the kernel. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; - /* 0-2 compat */ /* 3-7 unused */ /* 8-10 compat */