Merged in a bunch of patches that I got as reaction to the 3.99 release.
See the ChangeLog for details
diff --git a/term.c b/term.c
index 5850e33..e60f0ed 100644
--- a/term.c
+++ b/term.c
@@ -29,10 +29,12 @@
 
 #include "defs.h"
 
-#ifdef __GLIBC__
+#ifdef HAVE_TERMIO_H
 #include <termio.h>
-#endif /* __GLIBC__ */
+#endif /* HAVE_TERMIO_H */
+
 #include <termios.h>
+
 #ifdef HAVE_SYS_FILIO_H
 #include <sys/filio.h>
 #endif
@@ -331,6 +333,12 @@
 #ifdef TIOCSINTR
 	case TIOCSINTR:
 #endif
+#ifdef TIOCSPTLCK
+	case TIOCSPTLCK:
+#endif
+#ifdef TIOCGPTN
+	case TIOCGPTN:
+#endif
 		tprintf(", ");
 		printnum(tcp, arg, "%d");
 		return 1;