- /* Set, and save, the current position, and update cnt. */
- cnt = m.end - m.readpos;
- bp = --m.readpos;
- c = cnt < i ? cnt : i;
- while ((ep = locc( c, bp, '\n' ))) {
- /*
- * if we hit the end of this field, return.
- */
- if ((j = *++ep) != ' ' && j != '\t') {
- /* Save the text and update the current position. */
- j = ep - m.readpos;
- memcpy (cp, m.readpos, j);
- /* c is less than or equal to the number of bytes
- remaining in the read buffer, so will not overrun. */
- m.readpos = ep;
- cp += j;
- state = FLD;
- goto finish;
- }
- c -= ep - bp;
- bp = ep;
- }
- /*
- * end of input or dest buffer - copy what we've found.
- */
- c += bp - m.readpos;
- for (k = 0; k < c; ++k, --i) {
- *cp++ = Getc (iob);