181 |
|
} while (c != '\n'); |
182 |
|
} else if (c == '!') { /* command */ |
183 |
|
ungetc(c, fin); |
184 |
< |
if (expand) |
185 |
< |
xfcomm(name, fin); |
186 |
< |
else { |
187 |
< |
putchar('\n'); |
188 |
< |
while ((c = getc(fin)) != EOF && c != '\n') |
189 |
< |
putchar(c); |
190 |
< |
printf(" |"); |
191 |
< |
for (c = 0; c < xac; c++) |
192 |
< |
printf(" %s", xav[c]); |
193 |
< |
putchar('\n'); |
194 |
< |
} |
184 |
> |
xfcomm(name, fin); |
185 |
|
} else { /* object */ |
186 |
|
ungetc(c, fin); |
187 |
|
xfobject(name, fin); |
190 |
|
} |
191 |
|
|
192 |
|
|
193 |
< |
xfcomm(fname, fin) /* expand a command */ |
193 |
> |
xfcomm(fname, fin) /* transform a command */ |
194 |
|
FILE *fin; |
195 |
|
{ |
196 |
|
FILE *popen(); |
197 |
< |
char *fgets(); |
197 |
> |
char *fgetline(); |
198 |
|
FILE *pin; |
199 |
|
char buf[512]; |
200 |
+ |
int i; |
201 |
|
|
202 |
< |
buf[0] = '\0'; |
203 |
< |
fgets(buf, sizeof(buf), fin); |
204 |
< |
if (buf[0] && buf[strlen(buf)-1] == '\n') |
205 |
< |
buf[strlen(buf)-1] = '\0'; |
206 |
< |
if ((pin = popen(buf+1, "r")) == NULL) { |
207 |
< |
fprintf(stderr, "%s: (%s): cannot execute \"%s\"\n", |
208 |
< |
progname, fname, buf); |
209 |
< |
exit(1); |
202 |
> |
fgetline(buf, sizeof(buf), fin); |
203 |
> |
if (expand) { |
204 |
> |
if ((pin = popen(buf+1, "r")) == NULL) { |
205 |
> |
fprintf(stderr, "%s: (%s): cannot execute \"%s\"\n", |
206 |
> |
progname, fname, buf); |
207 |
> |
exit(1); |
208 |
> |
} |
209 |
> |
xform(buf, pin); |
210 |
> |
pclose(pin); |
211 |
> |
} else { |
212 |
> |
printf("\n%s | %s -e", buf, xav[0]); |
213 |
> |
for (i = 1; i < xac; i++) |
214 |
> |
printf(" %s", xav[i]); |
215 |
> |
putchar('\n'); |
216 |
|
} |
220 |
– |
xform(buf, pin); |
221 |
– |
pclose(pin); |
217 |
|
} |
218 |
|
|
219 |
|
|