repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
forget difference between big and small commands - obsolete with vm.
[minix.git]
/
lib
/
stdio
/
fread.c
blob
a02f83ad29f4ed5584d8cc73595cb7b80533fdfa
1
/*
2
* fread.c - read a number of members into an array
3
*/
4
/* $Header$ */
5
6
#include <stdio.h>
7
8
size_t
9
fread
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
register
FILE
*
stream
)
10
{
11
register
char
*
cp
=
ptr
;
12
register
int
c
;
13
size_t
ndone
=
0
;
14
register
size_t
s
;
15
16
if
(
size
)
17
while
(
ndone
<
nmemb
) {
18
s
=
size
;
19
do
{
20
if
((
c
=
getc
(
stream
)) !=
EOF
)
21
*
cp
++ =
c
;
22
else
23
return
ndone
;
24
}
while
(--
s
);
25
ndone
++;
26
}
27
28
return
ndone
;
29
}