22 |
|
#define WINSIZ 9 /* scanline window size */ |
23 |
|
#define MIDSCN 4 /* current scan position */ |
24 |
|
|
25 |
– |
#define BRT (-1) /* special index for brightness */ |
26 |
– |
|
25 |
|
struct { |
26 |
< |
char *name; /* file name */ |
26 |
> |
char *name; /* file or command name */ |
27 |
|
FILE *fp; /* stream pointer */ |
28 |
|
COLOR *scan[WINSIZ]; /* input scanline window */ |
29 |
|
COLOR coef; /* coefficient */ |
32 |
|
|
33 |
|
int nfiles; /* number of input files */ |
34 |
|
|
35 |
< |
char *vcolin[3] = {"ri", "gi", "bi"}; |
36 |
< |
char *vcolout[3] = {"ro", "go", "bo"}; |
35 |
> |
char vcolin[3][4] = {"ri", "gi", "bi"}; |
36 |
> |
char vcolout[3][4] = {"ro", "go", "bo"}; |
37 |
|
char vbrtin[] = "li"; |
38 |
|
char vbrtout[] = "lo"; |
39 |
< |
char *vcolexp[3] = {"re", "ge", "be"}; |
39 |
> |
char vcolexp[3][4] = {"re", "ge", "be"}; |
40 |
|
char vbrtexp[] = "le"; |
41 |
|
|
42 |
|
char vnfiles[] = "nfiles"; |
59 |
|
|
60 |
|
int wrongformat = 0; |
61 |
|
|
62 |
+ |
FILE *popen(); |
63 |
|
|
64 |
+ |
|
65 |
|
main(argc, argv) |
66 |
|
int argc; |
67 |
|
char *argv[]; |
68 |
|
{ |
69 |
– |
char buf[128]; |
69 |
|
int original; |
70 |
|
double f; |
71 |
|
int a, i; |
123 |
|
} |
124 |
|
else { |
125 |
|
input[nfiles].name = argv[a]; |
126 |
< |
input[nfiles].fp = fopen(argv[a], "r"); |
126 |
> |
input[nfiles].fp = argv[a][0]=='!' ? |
127 |
> |
popen(argv[a]+1, "r") : |
128 |
> |
fopen(argv[a], "r"); |
129 |
|
if (input[nfiles].fp == NULL) { |
130 |
|
perror(argv[a]); |
131 |
|
quit(1); |
149 |
|
if (argv[a][0] == '-') |
150 |
|
switch (argv[a][1]) { |
151 |
|
case 'x': |
152 |
< |
strcpy(buf, vxres); |
152 |
< |
strcat(buf, ":"); |
153 |
< |
strcat(buf, argv[++a]); |
154 |
< |
scompile(buf, NULL, 0); |
152 |
> |
varset(vxres, ':', eval(argv[++a])); |
153 |
|
continue; |
154 |
|
case 'y': |
155 |
< |
strcpy(buf, vyres); |
158 |
< |
strcat(buf, ":"); |
159 |
< |
strcat(buf, argv[++a]); |
160 |
< |
scompile(buf, NULL, 0); |
155 |
> |
varset(vyres, ':', eval(argv[++a])); |
156 |
|
continue; |
157 |
|
case 'w': |
158 |
|
continue; |
189 |
|
eputs("Usage: "); |
190 |
|
eputs(argv[0]); |
191 |
|
eputs( |
192 |
< |
" [-w][-h][-x xr][-y yr][-e expr][-f file] [ [-s f][-c r g b] pic ..]\n"); |
192 |
> |
" [-w][-x xr][-y yr][-e expr][-f file] [ [-s f][-c r g b] pic ..]\n"); |
193 |
|
quit(1); |
194 |
|
} |
195 |
|
|