--- src/term.c.orig Sat Jan 25 00:03:58 1997 +++ src/term.c Sun Sep 19 05:01:34 2004 @@ -33,7 +33,13 @@ #include #elif defined(__FreeBSD__) #include -#include +#include +#if __FreeBSD_version >= 410000 +# include +# include +#else +# include +#endif #define termio termios #endif #include @@ -201,11 +207,14 @@ } if (FD_ISSET(0, &readFds)) { i = read(0, buff, BUFSIZ); +#if defined(__FreeBSD__) + i = cons25tovt100(buff, i, BUFSIZ); +#endif if (i > 0) write(masterPty, buff, i); PollCursor(TRUE); } if (FD_ISSET(sockFd, &readFds)) SocketInterface(sockFd); - if (mInfo.has_mouse) { + if (mInfo.has_mouse && mouseFd > 0) { if (FD_ISSET(mouseFd, &readFds) && con.active) { i = read(mouseFd, buff, BUFSIZ); if (i > 0) MouseGetPacket(buff, i); @@ -449,11 +458,18 @@ PerrorExit("/dev/console"); } #elif defined(__FreeBSD__) +#if __FreeBSD_version >= 501100 + cfd = open("/dev/ttyv0", O_WRONLY); + if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) { + PerrorExit("/dev/ttyv0"); + } +#else cfd = open("/dev/vga", O_WRONLY); if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) { PerrorExit("/dev/vga"); } #endif +#endif ioctl(cfd, VT_ACTIVATE, orgVtNum); close(cfd); } @@ -471,9 +487,15 @@ if (cfd < 0 && (cfd = open("/dev/console", O_RDONLY)) < 0) fatal("can't open /dev/console"); #elif defined(__FreeBSD__) +#if __FreeBSD_version >= 501100 + cfd = open("/dev/ttyv0", O_WRONLY); + if (cfd < 0 && (cfd = open("/dev/ttyv0", O_RDONLY)) < 0) + fatal("can't open /dev/ttyv0"); +#else cfd = open("/dev/vga", O_WRONLY); if (cfd < 0 && (cfd = open("/dev/vga", O_RDONLY)) < 0) fatal("can't open /dev/vga"); +#endif #endif ioctl(cfd, KDGETMODE, &mode); if (mode == KD_TEXT) {