49 |
|
dofilter++; |
50 |
|
argv++; argc--; |
51 |
|
} |
52 |
+ |
#ifdef _IOLBF |
53 |
+ |
stdout->_flag &= ~_IOLBF; |
54 |
+ |
#endif |
55 |
|
if (argc < 2) |
56 |
|
status = printp(NULL) == -1; |
57 |
|
else |
71 |
|
int i; |
72 |
|
|
73 |
|
if (dofilter) { |
74 |
< |
if (fname == NULL) |
75 |
< |
fname = ""; |
76 |
< |
sprintf(buf, FILTER, fname); |
74 |
> |
if (fname == NULL) { |
75 |
> |
sprintf(buf, FILTER, ""); |
76 |
> |
fname = "<stdin>"; |
77 |
> |
} else |
78 |
> |
sprintf(buf, FILTER, fname); |
79 |
|
if ((input = popen(buf, "r")) == NULL) { |
80 |
|
fprintf(stderr, "Cannot execute: %s\n", buf); |
81 |
|
return(-1); |
82 |
|
} |
78 |
– |
fname = buf; |
83 |
|
} else if (fname == NULL) { |
84 |
|
input = stdin; |
85 |
|
fname = "<stdin>"; |
97 |
|
fprintf(stderr, "%s: bad picture size\n", fname); |
98 |
|
return(-1); |
99 |
|
} |
100 |
< |
if (xres > NCOLS || yres > NROWS) { |
100 |
> |
if (xres > NCOLS) { |
101 |
|
fprintf(stderr, "%s: resolution mismatch\n", fname); |
102 |
|
return(-1); |
103 |
|
} |
105 |
|
fputs("\0333\042", stdout); |
106 |
|
/* clear line buffer */ |
107 |
|
clearlbuf(); |
104 |
– |
#ifdef _IOLBF |
105 |
– |
stdout->_flag &= ~_IOLBF; |
106 |
– |
#endif |
108 |
|
/* put out scanlines */ |
109 |
|
for (i = yres-1; i >= 0; i--) { |
110 |
|
if (freadcolrs(scanline, xres, input) < 0) { |