Lines Matching refs:bsize
52 ssize_t bsize = in shf_open() local
58 shf = alloc(sizeof(struct shf) + bsize, ATEMP); in shf_open()
61 shf->bsize = bsize; in shf_open()
129 ssize_t bsize = in shf_fdopen() local
135 if (bsize) { in shf_fdopen()
136 shf->buf = alloc(bsize, ATEMP); in shf_fdopen()
141 shf = alloc(sizeof(struct shf) + bsize, ATEMP); in shf_fdopen()
149 shf->rbsize = bsize; in shf_fdopen()
151 shf->wbsize = sflags & SHF_UNBUF ? 0 : bsize; in shf_fdopen()
154 shf->bsize = bsize; in shf_fdopen()
164 ssize_t bsize = in shf_reopen() local
169 if (!shf || !shf->buf || shf->bsize < bsize) in shf_reopen()
176 shf->rbsize = bsize; in shf_reopen()
178 shf->wbsize = sflags & SHF_UNBUF ? 0 : bsize; in shf_reopen()
196 shf_sopen(char *buf, ssize_t bsize, int sflags, struct shf *shf) in shf_sopen() argument
209 if (bsize <= 0) in shf_sopen()
210 bsize = 64; in shf_sopen()
212 buf = alloc(bsize, shf->areap); in shf_sopen()
216 shf->rnleft = bsize; in shf_sopen()
217 shf->rbsize = bsize; in shf_sopen()
218 shf->wnleft = bsize - 1; /* space for a '\0' */ in shf_sopen()
219 shf->wbsize = bsize; in shf_sopen()
222 shf->bsize = bsize; in shf_sopen()
453 shf_read(char *buf, ssize_t bsize, struct shf *shf) in shf_read() argument
455 ssize_t ncopy, orig_bsize = bsize; in shf_read()
461 if (bsize <= 0) in shf_read()
462 internal_errorf(Tf_szs, Tshf_read, bsize, Tbsize); in shf_read()
464 while (bsize > 0) { in shf_read()
469 if (ncopy > bsize) in shf_read()
470 ncopy = bsize; in shf_read()
473 bsize -= ncopy; in shf_read()
478 return (orig_bsize == bsize ? (shf_error(shf) ? -1 : 0) : in shf_read()
479 orig_bsize - bsize); in shf_read()
489 shf_getse(char *buf, ssize_t bsize, struct shf *shf) in shf_getse() argument
499 if (bsize <= 0) in shf_getse()
503 --bsize; in shf_getse()
516 if (ncopy > bsize) in shf_getse()
517 ncopy = bsize; in shf_getse()
522 bsize -= ncopy; in shf_getse()
526 bsize++; in shf_getse()
530 } while (!end && bsize); in shf_getse()
532 if (!bsize && buf[-1] == '\r') { in shf_getse()
740 shf_snprintf(char *buf, ssize_t bsize, const char *fmt, ...) in shf_snprintf() argument
746 if (!buf || bsize <= 0) in shf_snprintf()
748 (size_t)buf, bsize); in shf_snprintf()
750 shf_sopen(buf, bsize, SHF_WR, &shf); in shf_snprintf()