version 1.30, 2008/10/06 20:38:33 |
version 1.31, 2010/06/13 17:58:19 |
|
|
return 0; /* not reached */ |
return 0; /* not reached */ |
} |
} |
|
|
Cell *getline(Node **a, int n) /* get next line from specific input */ |
Cell *awkgetline(Node **a, int n) /* get next line from specific input */ |
{ /* a[0] is variable, a[1] is operator, a[2] is filename */ |
{ /* a[0] is variable, a[1] is operator, a[2] is filename */ |
Cell *r, *x; |
Cell *r, *x; |
extern Cell **fldtab; |
extern Cell **fldtab; |
|
|
x->sval, y->sval); |
x->sval, y->sval); |
strlcpy(s, x->sval, len); |
strlcpy(s, x->sval, len); |
strlcpy(s+n1, y->sval, len - n1); |
strlcpy(s+n1, y->sval, len - n1); |
|
tempfree(x); |
tempfree(y); |
tempfree(y); |
z = gettemp(); |
z = gettemp(); |
z->sval = s; |
z->sval = s; |
z->tval = STR; |
z->tval = STR; |
tempfree(x); |
|
return(z); |
return(z); |
} |
} |
|
|
|
|
adjbuf(&buf, &bufsz, 1+strlen(sptr)+pb-buf, 0, &pb, "gsub"); |
adjbuf(&buf, &bufsz, 1+strlen(sptr)+pb-buf, 0, &pb, "gsub"); |
while ((*pb++ = *sptr++) != 0) |
while ((*pb++ = *sptr++) != 0) |
; |
; |
done: if (pb > buf + bufsz) |
done: if (pb < buf + bufsz) |
FATAL("gsub result2 %.30s too big; can't happen", buf); |
*pb = '\0'; |
*pb = '\0'; |
else if (*(pb-1) != '\0') |
|
FATAL("gsub result2 %.30s truncated; can't happen", buf); |
setsval(x, buf); /* BUG: should be able to avoid copy + free */ |
setsval(x, buf); /* BUG: should be able to avoid copy + free */ |
pfa->initstat = tempstat; |
pfa->initstat = tempstat; |
} |
} |