| 8 |
|
|
| 9 |
|
#include "rcontrib.h" |
| 10 |
|
#include "resolu.h" |
| 11 |
+ |
#include <ctype.h> |
| 12 |
|
|
| 13 |
|
/* Close output stream and free record */ |
| 14 |
|
static void |
| 112 |
|
printargs(gargc-1, gargv, fout); /* add our command */ |
| 113 |
|
fprintf(fout, "SOFTWARE= %s\n", VersionID); |
| 114 |
|
fputnow(fout); |
| 115 |
+ |
fputs("NCOMP=3\n", fout); /* always RGB */ |
| 116 |
|
if (info != NULL) /* add extra info if given */ |
| 117 |
|
fputs(info, fout); |
| 118 |
|
fputformat(formstr(outfmt), fout); |
| 133 |
|
STREAMOUT * |
| 134 |
|
getostream(const char *ospec, const char *mname, int bn, int noopen) |
| 135 |
|
{ |
| 134 |
– |
/* static const DCOLOR nocontrib = BLKCOLOR; */ |
| 136 |
|
static STREAMOUT stdos; |
| 137 |
+ |
char info[1024]; |
| 138 |
|
int ofl; |
| 139 |
|
char oname[1024]; |
| 140 |
|
LUENT *lep; |
| 144 |
|
if (!noopen & !using_stdout) { |
| 145 |
|
if (outfmt != 'a') |
| 146 |
|
SET_FILE_BINARY(stdout); |
| 147 |
< |
if (header) |
| 148 |
< |
printheader(stdout, NULL); |
| 147 |
> |
if (header) { |
| 148 |
> |
sprintf(info, "NCOLS=%d\nNCOMP=3\n", |
| 149 |
> |
stdos.reclen); |
| 150 |
> |
printheader(stdout, info); |
| 151 |
> |
} |
| 152 |
|
printresolu(stdout, xres, yres); |
| 153 |
|
if (waitflush > 0) |
| 154 |
|
fflush(stdout); |
| 187 |
|
} |
| 188 |
|
} |
| 189 |
|
if (!noopen && sop->ofp == NULL) { /* open output stream */ |
| 185 |
– |
long i; |
| 190 |
|
if (oname[0] == '!') /* output to command */ |
| 191 |
|
sop->ofp = popen(oname+1, "w"); |
| 192 |
|
else /* else open file */ |
| 199 |
|
flockfile(sop->ofp); /* avoid lock/unlock overhead */ |
| 200 |
|
#endif |
| 201 |
|
if (header) { |
| 198 |
– |
char info[512]; |
| 202 |
|
char *cp = info; |
| 203 |
|
if (ofl & OF_MODIFIER || sop->reclen == 1) { |
| 204 |
|
sprintf(cp, "MODIFIER=%s\n", mname); |
| 208 |
|
sprintf(cp, "BIN=%d\n", bn); |
| 209 |
|
while (*cp) ++cp; |
| 210 |
|
} |
| 211 |
< |
*cp = '\0'; |
| 211 |
> |
sprintf(cp, "NCOLS=%d\nNCOMP=3\n", sop->reclen); |
| 212 |
|
printheader(sop->ofp, info); |
| 213 |
|
} |
| 214 |
|
if (accumulate > 0) { /* global resolution */ |
| 215 |
|
sop->xr = xres; sop->yr = yres; |
| 216 |
|
} |
| 217 |
|
printresolu(sop->ofp, sop->xr, sop->yr); |
| 215 |
– |
#if 0 |
| 216 |
– |
/* play catch-up */ |
| 217 |
– |
for (i = accumulate > 0 ? lastdone/accumulate : 0; i--; ) { |
| 218 |
– |
int j = sop->reclen; |
| 219 |
– |
if (j <= 0) j = 1; |
| 220 |
– |
while (j--) |
| 221 |
– |
put_contrib(nocontrib, sop->ofp); |
| 222 |
– |
if (outfmt == 'a') |
| 223 |
– |
putc('\n', sop->ofp); |
| 224 |
– |
} |
| 225 |
– |
#endif |
| 218 |
|
if (waitflush > 0) |
| 219 |
|
fflush(sop->ofp); |
| 220 |
|
} |