98 |
|
/* check if fseek() useful */ |
99 |
|
if (skip_len > skip_thresh && |
100 |
|
fseek(fp, ((long)rmin*width + cmin)*elsiz, SEEK_CUR) == 0) { |
101 |
+ |
int fd; |
102 |
|
off_t curpos; |
103 |
|
buf = (char *)malloc(ncols*elsiz); |
104 |
|
if (!buf) |
116 |
|
} |
117 |
|
} |
118 |
|
#else |
119 |
+ |
fd = fileno(fp); |
120 |
|
curpos = ftello(fp); |
121 |
|
for (y = nrows; y-- > 0; curpos += width*elsiz) { |
122 |
< |
if (pread(fileno(fp), buf, ncols*elsiz, |
122 |
> |
if (pread(fd, buf, ncols*elsiz, |
123 |
|
curpos) != ncols*elsiz) |
124 |
|
goto readerr; |
125 |
|
if (putbinary(buf, elsiz, ncols, stdout) != ncols) |