]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/makebuf.c.patch
Libc-498.tar.gz
[apple/libc.git] / stdio / FreeBSD / makebuf.c.patch
1 --- makebuf.c.orig 2006-10-11 20:54:06.000000000 -0700
2 +++ makebuf.c 2006-10-12 10:09:09.000000000 -0700
3 @@ -49,6 +49,8 @@
4 #include "local.h"
5 #include "un-namespace.h"
6
7 +#define TTYBUFSIZE 4096
8 +
9 /*
10 * Allocate a file buffer, or switch to unbuffered I/O.
11 * Per the ANSI C standard, ALL tty devices default to line buffered.
12 @@ -71,6 +73,12 @@
13 return;
14 }
15 flags = __swhatbuf(fp, &size, &couldbetty);
16 + if (couldbetty && isatty(fp->_file)) {
17 + flags |= __SLBF;
18 + /* st_blksize for ttys is 128K, so make it more reasonable */
19 + if (size > TTYBUFSIZE)
20 + fp->_blksize = size = TTYBUFSIZE;
21 + }
22 if ((p = malloc(size)) == NULL) {
23 fp->_flags |= __SNBF;
24 fp->_bf._base = fp->_p = fp->_nbuf;
25 @@ -81,8 +89,6 @@
26 flags |= __SMBF;
27 fp->_bf._base = fp->_p = p;
28 fp->_bf._size = size;
29 - if (couldbetty && isatty(fp->_file))
30 - flags |= __SLBF;
31 fp->_flags |= flags;
32 }
33