2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[getBufferMode.lc]{hIs...Buffered Runtime Support}
11 #ifdef HAVE_SYS_TYPES_H
12 #include <sys/types.h>
15 #ifdef HAVE_SYS_STAT_H
20 * We try to guess what the default buffer mode is going to be based
21 * on the type of file we're attached to.
33 IOFileObject* fo = (IOFileObject*)ptr;
37 /* Try to find out the file type */
38 while (fstat(fd, &sb) < 0) {
46 /* Terminals are line-buffered by default */
47 if (S_ISCHR(sb.st_mode) && isatty(fd) == 1) {
48 fo ->flags |= FILEOBJ_LB;
50 /* Default size block buffering for the others */
52 fo ->flags |= FILEOBJ_BB;