From f9bda2ce44de1d434aee3e985b0ea88d9306434b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Tue, 22 Aug 2017 18:43:38 +0200 Subject: [PATCH] Haiku patches --- include/c.h | 4 ++++ include/ttyutils.h | 36 ++++++++++++++++++++++++++++++++++++ lib/randutils.c | 2 ++ 3 files changed, 42 insertions(+) diff --git a/include/c.h b/include/c.h index a5162b9..d9ffef7 100644 --- a/include/c.h +++ b/include/c.h @@ -29,6 +29,10 @@ # define LOGIN_NAME_MAX 256 #endif +#ifndef _SC_HOST_NAME_MAX +#define _SC_HOST_NAME_MAX 72 +#endif + /* * Compiler-specific stuff */ diff --git a/include/ttyutils.h b/include/ttyutils.h index 7278d36..f0d902f 100644 --- a/include/ttyutils.h +++ b/include/ttyutils.h @@ -60,15 +60,23 @@ extern int get_terminal_name(const char **path, const char **name, static inline void reset_virtual_console(struct termios *tp, int flags) { /* Use defaults of for base settings */ +#ifdef TTYDEF_IFLAG tp->c_iflag |= TTYDEF_IFLAG; +#endif +#ifdef TTYDEF_OFLAG tp->c_oflag |= TTYDEF_OFLAG; +#endif +#ifdef TTYDEF_LFLAG tp->c_lflag |= TTYDEF_LFLAG; +#endif if ((flags & UL_TTY_KEEPCFLAGS) == 0) { #ifdef CBAUD tp->c_lflag &= ~CBAUD; #endif +#ifdef TTYDEF_CFLAG tp->c_cflag |= (B38400 | TTYDEF_CFLAG); +#endif } /* Sane setting, allow eight bit characters, no carriage return delay @@ -114,7 +122,11 @@ static inline void reset_virtual_console(struct termios *tp, int flags) # define FFDLY 0 #endif +#ifdef IMAXBEL tp->c_iflag |= (BRKINT | ICRNL | IMAXBEL); +#else + tp->c_iflag |= (BRKINT | ICRNL); +#endif tp->c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP); tp->c_oflag |= (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0); tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \ @@ -144,24 +156,48 @@ static inline void reset_virtual_console(struct termios *tp, int flags) */ tp->c_cc[VTIME] = 0; tp->c_cc[VMIN] = 1; +#ifdef CINTR tp->c_cc[VINTR] = CINTR; +#endif +#ifdef CQUIT tp->c_cc[VQUIT] = CQUIT; +#endif +#ifdef CERASE tp->c_cc[VERASE] = CERASE; /* ASCII DEL (0177) */ +#endif +#ifdef CKILL tp->c_cc[VKILL] = CKILL; +#endif +#ifdef CEOF tp->c_cc[VEOF] = CEOF; +#endif #ifdef VSWTC tp->c_cc[VSWTC] = _POSIX_VDISABLE; #elif defined(VSWTCH) tp->c_cc[VSWTCH] = _POSIX_VDISABLE; #endif +#ifdef CSTART tp->c_cc[VSTART] = CSTART; +#endif +#ifdef CSTOP tp->c_cc[VSTOP] = CSTOP; +#endif +#ifdef CSUSP tp->c_cc[VSUSP] = CSUSP; +#endif tp->c_cc[VEOL] = _POSIX_VDISABLE; +#ifdef VREPRINT tp->c_cc[VREPRINT] = CREPRINT; +#endif +#ifdef VDISCARD tp->c_cc[VDISCARD] = CDISCARD; +#endif +#ifdef VWERASE tp->c_cc[VWERASE] = CWERASE; +#endif +#ifdef CLNEXT tp->c_cc[VLNEXT] = CLNEXT; +#endif tp->c_cc[VEOL2] = _POSIX_VDISABLE; } diff --git a/lib/randutils.c b/lib/randutils.c index 09dd261..cc7ac1f 100644 --- a/lib/randutils.c +++ b/lib/randutils.c @@ -13,7 +13,9 @@ #include #include +#ifndef __HAIKU__ #include +#endif #include "c.h" #include "randutils.h" -- 2.14.1