Lines Matching full:nbytes
624 /* Write a buffer. Returns nbytes if successful, EOF if there is an error. */
626 shf_write(const char *buf, ssize_t nbytes, struct shf *shf)
628 ssize_t n, ncopy, orig_nbytes = nbytes;
633 if (nbytes < 0)
634 internal_errorf("%s: %s %zd", "shf_write", "nbytes", nbytes);
638 (shf->wp != shf->buf || nbytes < shf->wnleft)) {
639 if (ncopy > nbytes)
640 ncopy = nbytes;
642 nbytes -= ncopy;
647 if (nbytes > 0) {
650 while (nbytes > shf->wnleft)
659 if (nbytes > shf->wbsize) {
660 ncopy = nbytes;
662 ncopy -= nbytes % shf->wbsize;
663 nbytes -= ncopy;
685 if (nbytes > 0) {
687 memcpy(shf->wp, buf, nbytes);
688 shf->wp += nbytes;
689 shf->wnleft -= nbytes;