diff options
Diffstat (limited to 'unsupported/atari/gawkmisc.atr')
-rw-r--r-- | unsupported/atari/gawkmisc.atr | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/unsupported/atari/gawkmisc.atr b/unsupported/atari/gawkmisc.atr index 85bfa29d..f4ee1fc1 100644 --- a/unsupported/atari/gawkmisc.atr +++ b/unsupported/atari/gawkmisc.atr @@ -1,5 +1,5 @@ /* - * gawkmisc.atr --- miscellanious gawk routines that are OS specific. + * gawkmisc.atr --- miscellaneous gawk routines that are OS specific. */ /* @@ -94,13 +94,12 @@ struct stat *stb; * On ST redirected stdin does not have a name attached * (this could be hard to do to) and fstat would fail */ - if (fd == 0 || isatty(fd)) + if (fd == 0) return BUFSIZ; if (fstat(fd, stb) == -1) fatal("can't stat fd %d (%s)", fd, strerror(errno)); - if (lseek(fd, (off_t)0, 0) == -1) /* not a regular file */ - return DEFBLKSIZE; - if (stb->st_size > 0 && stb->st_size < DEFBLKSIZE) /* small file */ + if (S_ISREG(stb->st_mode) + && 0 < stb->st_size && stb->st_size < DEFBLKSIZE) /* small file */ return stb->st_size; return DEFBLKSIZE; } |