diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:35:31 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:35:31 +0300 |
commit | 8ceb5f934787eb7be5fb452fb39179df66119954 (patch) | |
tree | 56a80fc5c118f7c2ebad7ab44bd8be048b2f7ec2 /iop.c | |
parent | 2f83a4e72166e811a9f0b4726c19a3d5a0b17dcb (diff) | |
download | egawk-8ceb5f934787eb7be5fb452fb39179df66119954.tar.gz egawk-8ceb5f934787eb7be5fb452fb39179df66119954.tar.bz2 egawk-8ceb5f934787eb7be5fb452fb39179df66119954.zip |
Move to gawk-2.15.6.
Diffstat (limited to 'iop.c')
-rw-r--r-- | iop.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-1995 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. @@ -96,9 +96,11 @@ int fd; #endif if (fstat(fd, &stb) == -1) fatal("can't stat fd %d (%s)", fd, strerror(errno)); - if (lseek(fd, (off_t)0, 0) == -1) + if (lseek(fd, (off_t)0, 0) == -1) /* not a regular file */ return DEFBLKSIZE; - return ((int) (stb.st_size < DEFBLKSIZE ? stb.st_size : DEFBLKSIZE)); + if (stb.st_size > 0 && stb.st_size < DEFBLKSIZE) /* small file */ + return (stb.st_size); + return (DEFBLKSIZE); #endif /*! TEST */ #endif /*! VMS */ } @@ -249,6 +251,7 @@ int *errcode; continue; } else eat_whitespace = 0; + start = bp; /* skip leading white space */ } if (saw_newline && *bp == rs) { bp++; @@ -284,7 +287,7 @@ int *errcode; *bp = '\0'; if (grRS == 0) { /* there could be more newlines left, clean 'em out now */ - while (*(iop->off) == rs && iop->off <= iop->end) + while (iop->off <= iop->end && *(iop->off) == rs) (iop->off)++; if (*--bp == rs) |