* error occured and has the best knowledge what to
* error occurred and has the best knowledge what to
rd_wrbuf(register char *in, register int cpcnt)#elseintrd_wrbuf(in, cpcnt)	register char *in;	register int cpcnt;#endif{	register int res;	register int cnt;	register int incnt = cpcnt;	/*	 * loop until we fill the buffer with the requested number of bytes	 */	while (incnt > 0) {		cnt = bufend - bufpt;		if ((cnt <= 0) && ((cnt = buf_fill()) <= 0)) {			/*			 * read error, return what we got (or the error if			 * no data was copied). The caller must know that an			 * error occured and has the best knowledge what to			 * do with it			 */			if ((res = cpcnt - incnt) > 0)				return(res);			return(cnt);		}		/*		 * calculate how much data to copy based on whats left and		 * state of buffer		 */		cnt = MIN(cnt, incnt);		memcpy(in, bufpt, cnt);		bufpt += cnt;		incnt -= cnt;		in += cnt;	}	return(cpcnt);}