* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)fread.c 5.3 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
fread(buf
, size
, count
, fp
)
if ((resid
= count
* size
) == 0)
while (resid
> (r
= fp
->_r
)) {
(void) memcpy((void *)p
, (void *)fp
->_p
, (size_t)r
);
/* fp->_r = 0 ... done in __srefill */
/* no more input: return partial result */
return ((total
- resid
) / size
);
(void) memcpy((void *)p
, (void *)fp
->_p
, resid
);