Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/modules/klibc/fread.c

Source at commit 1308 created 9 years 5 months ago.
By meklort, Add a few placeholders for file io
1/*
2 * fread.c
3 */
4
5#include <errno.h>
6#include <unistd.h>
7#include <stdio.h>
8
9size_t _fread(void *buf, size_t count, FILE *f)
10{
11printf("WARNING: fread not implimented.\n");
12return 0;
13#if 0
14size_t bytes = 0;
15ssize_t rv;
16char *p = buf;
17
18while (count) {
19rv = read(fileno(f), p, count);
20if (rv == -1) {
21if (errno == EINTR) {
22errno = 0;
23continue;
24} else
25break;
26} else if (rv == 0) {
27break;
28}
29
30p += rv;
31bytes += rv;
32count -= rv;
33}
34
35return bytes;
36#endif
37}
38

Archive Download this file

Revision: 1308