blob: bda86c8b2cbf5b0cc9c1395e3971c956704f48b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
bool
do_aprint(arg,fp,arglast)
register ARG *arg;
register FILE *fp;
int *arglast;
{
register STR **st = stack->ary_array;
register int sp = arglast[1];
register int retval;
register int items = arglast[2] - sp;
if (!fp) {
if (dowarn)
warn("print to unopened file");
errno = EBADF;
return FALSE;
}
st += ++sp;
if (arg->arg_type == O_PRTF) {
do_sprintf(ARGTARG,items,st);
retval = do_print(ARGTARG,fp);
}
else {
retval = (items <= 0);
for (; items > 0; items--,st++) {
if (retval && ofslen) {
if (fwrite(ofs, 1, ofslen, fp) == 0 || ferror(fp)) {
retval = FALSE;
break;
}
}
if (!(retval = do_print(*st, fp)))
break;
}
if (retval && orslen)
if (fwrite(ors, 1, orslen, fp) == 0 || ferror(fp))
retval = FALSE;
}
return retval;
}
|