2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: getBufferMode.c,v 1.3 1998/12/02 13:27:35 simonm Exp $
6 * hIs...Buffered Runtime Support
12 #ifdef HAVE_SYS_TYPES_H
13 #include <sys/types.h>
16 #ifdef HAVE_SYS_STAT_H
21 * We try to guess what the default buffer mode is going to be based
22 * on the type of file we're attached to.
34 IOFileObject* fo = (IOFileObject*)ptr;
38 /* Try to find out the file type */
39 while (fstat(fd, &sb) < 0) {
47 /* Terminals are line-buffered by default */
48 if (S_ISCHR(sb.st_mode) && isatty(fd) == 1) {
49 fo ->flags |= FILEOBJ_LB;
51 /* Default size block buffering for the others */
53 fo ->flags |= FILEOBJ_BB;