6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
– |
#ifdef MSDOS |
10 |
– |
#include <fcntl.h> |
11 |
– |
#endif |
9 |
|
#include <time.h> |
10 |
|
|
11 |
+ |
#include "platform.h" |
12 |
+ |
#include "rtprocess.h" |
13 |
|
#include "color.h" |
14 |
|
#include "resolu.h" |
15 |
|
|
18 |
|
|
19 |
|
#define ASPECT (120./144.) /* pixel aspect ratio */ |
20 |
|
|
21 |
< |
#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT |
21 |
> |
#define FILTER "pfilt -1 -x %d -y %d -p %f",NCOLS,NROWS,ASPECT |
22 |
> |
#define FILTER_F "pfilt -1 -x %d -y %d -p %f \"%s\"",NCOLS,NROWS,ASPECT |
23 |
|
|
24 |
|
/* |
25 |
|
* Subtractive primaries are ordered: Yellow, Magenta, Cyan. |
31 |
|
|
32 |
|
int dofilter = 0; /* filter through pfilt first? */ |
33 |
|
|
34 |
– |
extern FILE *popen(); |
34 |
|
|
36 |
– |
|
35 |
|
main(argc, argv) |
36 |
|
int argc; |
37 |
|
char *argv[]; |
38 |
|
{ |
39 |
|
int i, status = 0; |
40 |
< |
#ifdef MSDOS |
41 |
< |
extern int _fmode; |
42 |
< |
_fmode = O_BINARY; |
45 |
< |
setmode(fileno(stdin), O_BINARY); |
46 |
< |
setmode(fileno(stdout), O_BINARY); |
47 |
< |
#endif |
40 |
> |
SET_DEFAULT_BINARY(); |
41 |
> |
SET_FILE_BINARY(stdin); |
42 |
> |
SET_FILE_BINARY(stdout); |
43 |
|
if (argc > 1 && !strcmp(argv[1], "-p")) { |
44 |
|
dofilter++; |
45 |
|
argv++; argc--; |
56 |
|
printp(fname) /* print a picture */ |
57 |
|
char *fname; |
58 |
|
{ |
59 |
< |
char buf[64]; |
59 |
> |
char buf[PATH_MAX]; |
60 |
|
FILE *input; |
61 |
|
int xres, yres; |
62 |
|
COLR scanline[NCOLS]; |
64 |
|
|
65 |
|
if (dofilter) { |
66 |
|
if (fname == NULL) { |
67 |
< |
sprintf(buf, FILTER, ""); |
67 |
> |
sprintf(buf, FILTER); |
68 |
|
fname = "<stdin>"; |
69 |
|
} else |
70 |
< |
sprintf(buf, FILTER, fname); |
70 |
> |
sprintf(buf, FILTER_F, fname); |
71 |
|
if ((input = popen(buf, "r")) == NULL) { |
72 |
|
fprintf(stderr, "Cannot execute: %s\n", buf); |
73 |
|
return(-1); |
125 |
|
register long c; |
126 |
|
register int i, j; |
127 |
|
|
128 |
< |
if (bpos = y % 23) { |
128 |
> |
if ( (bpos = y % 23) ) { |
129 |
|
|
130 |
|
for (j = 0; j < 3; j++) |
131 |
|
for (i = 0; i < len; i++) |