comparison src/sysdep.c @ 361:7347b34c275b r21-1-10

Import from CVS: tag r21-1-10
author cvs
date Mon, 13 Aug 2007 10:58:40 +0200
parents 8e84bee8ddd0
children a4f53d9b3154
comparison
equal deleted inserted replaced
360:0f00b38cfccb 361:7347b34c275b
767 so that the function works even fd is not a pty. */ 767 so that the function works even fd is not a pty. */
768 768
769 int 769 int
770 get_pty_max_bytes (int fd) 770 get_pty_max_bytes (int fd)
771 { 771 {
772 int pty_max_bytes; 772 /* DEC OSF fpathconf returns 255, but xemacs hangs on long shell
773 773 input lines if we return 253. 252 is OK!. So let's leave a bit
774 of slack for the newline that xemacs will insert, and for those
775 inevitable vendor off-by-one-or-two-or-three bugs. */
776 #define MAX_CANON_SLACK 10
777 #define SAFE_MAX_CANON 120
774 #if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) 778 #if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
775 pty_max_bytes = fpathconf (fd, _PC_MAX_CANON); 779 {
776 if (pty_max_bytes < 0) 780 int max_canon = fpathconf (fd, _PC_MAX_CANON);
777 #endif 781 return (max_canon < 0 ? SAFE_MAX_CANON :
778 pty_max_bytes = 250; 782 max_canon > SAFE_MAX_CANON ? max_canon - MAX_CANON_SLACK :
779 783 max_canon);
780 /* Deduct one, to leave space for the eof. */ 784 }
781 pty_max_bytes--; 785 #elif defined (_POSIX_MAX_CANON)
782 786 return (_POSIX_MAX_CANON > SAFE_MAX_CANON ?
783 return pty_max_bytes; 787 _POSIX_MAX_CANON - MAX_CANON_SLACK :
788 _POSIX_MAX_CANON);
789 #else
790 return SAFE_MAX_CANON;
791 #endif
784 } 792 }
785 793
786 /* Figure out the eof character for the FD. */ 794 /* Figure out the eof character for the FD. */
787 795
788 Bufbyte 796 Bufbyte