Compare commits
No commits in common. "511ad67a9a2ba3d4d4fd483021ca728c3e42b839" and "494b48bbe3cc87086bfaeb522ee81e4ad07eec94" have entirely different histories.
511ad67a9a
...
494b48bbe3
@ -30,11 +30,14 @@ extern "C"
|
|||||||
return 0; // FIXME: Implement buffered IO.
|
return 0; // FIXME: Implement buffered IO.
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* fopen(const char* pathname, const char* mode)
|
FILE* fopen(const char* pathname, const char*)
|
||||||
{
|
{
|
||||||
int fd = open(pathname, O_RDWR); // FIXME: Use the mode string.
|
int fd = open(pathname, O_RDWR); // FIXME: Use the mode string.
|
||||||
if (fd < 0) { return 0; }
|
if (fd < 0) { return 0; }
|
||||||
return fdopen(fd, mode);
|
FILE* stream = (FILE*)malloc(sizeof(FILE));
|
||||||
|
stream->f_fd = fd;
|
||||||
|
clearerr(stream);
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* fdopen(int fd, const char*)
|
FILE* fdopen(int fd, const char*)
|
||||||
@ -45,7 +48,6 @@ extern "C"
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FILE* stream = (FILE*)malloc(sizeof(FILE));
|
FILE* stream = (FILE*)malloc(sizeof(FILE));
|
||||||
if (!stream) { return 0; }
|
|
||||||
stream->f_fd = fd;
|
stream->f_fd = fd;
|
||||||
clearerr(stream);
|
clearerr(stream);
|
||||||
return stream;
|
return stream;
|
||||||
|
Loading…
Reference in New Issue
Block a user