1 --- main.c.orig 2016-11-04 21:41:21 UTC 2 +++ main.c 3 @@ -211,7 +211,9 @@ static Bool IsPts = False; 4 #undef FIOCLEX 5 #undef FIONCLEX 6 #define setpgrp2 setpgrp 7 +#ifndef USE_POSIX_TERMIOS 8 #include <sgtty.h> 9 +#endif 10 #include <sys/resource.h> 11 #endif 12 #ifdef sco 13 @@ -237,7 +239,7 @@ static Bool IsPts = False; 14 #define HAS_UTMP_UT_HOST 15 #endif 16 #else /* } !SYSV { */ /* BSD systems */ 17 -#ifndef linux 18 +#if !defined(linux) && !defined(USE_POSIX_TERMIOS) 19 #include <sgtty.h> 20 #endif 21 #include <sys/resource.h> 22 @@ -294,7 +296,7 @@ extern Time_t time (); 23 #define ttyslot() 1 24 #endif /* apollo */ 25 26 -#ifdef SVR4 27 +#if defined(SVR4) || (defined(__FreeBSD__) && __FreeBSD_version >= 900007) 28 #include <utmpx.h> 29 #define setutent setutxent 30 #define getutent getutxent 31 @@ -320,6 +322,10 @@ extern struct utmp *getutid __((struct utmp *_Id)); 32 int Ptyfd; 33 #endif /* PUCC_PTYD */ 34 35 +#ifdef __FreeBSD__ 36 +#include <libutil.h> /* openpty() */ 37 +#endif 38 + 39 #ifdef sequent 40 #define USE_GET_PSEUDOTTY 41 #endif 42 @@ -1360,6 +1366,8 @@ char **argv; 43 d_tio.c_cc[VDISCARD] = CFLUSH; 44 d_tio.c_cc[VWERASE] = CWERASE; 45 d_tio.c_cc[VLNEXT] = CLNEXT; 46 + d_tio.c_cc[VMIN] = 1; 47 + d_tio.c_cc[VTIME] = 0; 48 #endif /* } */ 49 #ifdef TIOCSLTC /* { */ 50 d_ltc.t_suspc = CSUSP; /* t_suspc */ 51 @@ -1408,6 +1416,8 @@ char **argv; 52 d_tio.c_cc[VQUIT] = CQUIT; /* '^\' */ 53 d_tio.c_cc[VEOF] = CEOF; /* '^D' */ 54 d_tio.c_cc[VEOL] = CEOL; /* '^@' */ 55 + d_tio.c_cc[VMIN] = 1; 56 + d_tio.c_cc[VTIME] = 0; 57 #ifdef VSWTCH 58 d_tio.c_cc[VSWTCH] = CSWTCH; /* usually '^Z' */ 59 #endif 60 @@ -1722,11 +1732,11 @@ char **argv; 61 case 'u': case 'U': 62 term->flags |= UTF8_KANJI; 63 update_utf8mode(); 64 - make_unicode_map(); 65 break; 66 default: 67 break; 68 } 69 + make_unicode_map(); 70 } 71 #endif /* KTERM_KANJIMODE */ 72 73 @@ -1973,6 +1983,10 @@ char *name; 74 get_pty (pty) 75 int *pty; 76 { 77 +#if 1 78 + int tty; 79 + return (openpty(pty, &tty, ttydev, NULL, NULL)); 80 +#else 81 #ifdef __osf__ 82 int tty; 83 return (openpty(pty, &tty, ttydev, NULL, NULL)); 84 @@ -2076,6 +2090,7 @@ get_pty (pty) 85 #endif /* __sgi or umips else */ 86 #endif /* USE_GET_PSEUDOTTY else */ 87 #endif /* ATT else */ 88 +#endif /* !0 */ 89 } 90 91 /* 92