#include <string.h>
#include <errno.h>
#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
#include <unistd.h>
+/* On solaris, curses.h must come before both termios.h and term.h */
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif
+/* Needed for FIONREAD under solaris */
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
#ifndef PLATFORM_WIN32
#ifndef TIOCGWINSZ
#include <sys/ioctl.h>