| 12 |
|
#include "fvect.h" |
| 13 |
|
#include "view.h" |
| 14 |
|
|
| 15 |
– |
char *progname; /* global argv[0] */ |
| 16 |
– |
|
| 15 |
|
VIEW vw = STDVIEW; |
| 16 |
|
int gotvw = 0; |
| 17 |
|
char fmt[MAXFMTLEN] = "ascii"; /* assumed when unspecified */ |
| 96 |
|
/* check if fseek() useful */ |
| 97 |
|
if (skip_len > skip_thresh && |
| 98 |
|
fseek(fp, ((long)rmin*width + cmin)*elsiz, SEEK_CUR) == 0) { |
| 99 |
+ |
int fd; |
| 100 |
|
off_t curpos; |
| 101 |
|
buf = (char *)malloc(ncols*elsiz); |
| 102 |
|
if (!buf) |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
|
#else |
| 117 |
+ |
fd = fileno(fp); |
| 118 |
|
curpos = ftello(fp); |
| 119 |
|
for (y = nrows; y-- > 0; curpos += width*elsiz) { |
| 120 |
< |
if (pread(fileno(fp), buf, ncols*elsiz, |
| 120 |
> |
if (pread(fd, buf, ncols*elsiz, |
| 121 |
|
curpos) != ncols*elsiz) |
| 122 |
|
goto readerr; |
| 123 |
|
if (putbinary(buf, elsiz, ncols, stdout) != ncols) |
| 257 |
|
FILE *fp = stdin; |
| 258 |
|
int asiz = 0; |
| 259 |
|
int gotdims; |
| 260 |
< |
|
| 261 |
< |
progname = argv[0]; |
| 260 |
> |
/* set global progname */ |
| 261 |
> |
fixargv0(argv[0]); |
| 262 |
|
/* get input and output */ |
| 263 |
|
if ((argc < 5) | (argc > 7)) |
| 264 |
|
goto usage; |