Lines Matching defs:fdc
78 fdctx_init(int fd, struct fdctx *fdc)
84 *fdc = (struct fdctx){
87 .ep = &fdc->buf[0], /* No data */
92 fdgetc(struct fdctx *fdc, char *c)
96 if (&fdc->buf[fdc->off] == fdc->ep) {
97 nread = read(fdc->fd, fdc->buf, fdc->buflen);
99 fdc->off = 0;
100 fdc->ep = fdc->buf + nread;
104 *c = fdc->buf[fdc->off++];
110 fdctx_destroy(struct fdctx *fdc)
114 if (fdc->buflen > 1) {
128 residue = (fdc->ep - fdc->buf) - fdc->off;
130 (void) lseek(fdc->fd, -residue, SEEK_CUR);