Luna/libc/src/init.cpp

24 lines
525 B
C++
Raw Normal View History

#include <luna/Ignore.h>
#include <stdio.h>
#include <unistd.h>
extern char** environ;
2023-07-21 22:02:12 +00:00
extern "C" FILE* _fdopen_impl(int, const char*, int);
extern "C" void _init_stdio();
extern "C"
{
void libc_init(int argc, char** argv, int envc, char** envp)
{
ignore(argc, argv, envc);
environ = envp;
2023-07-21 22:02:12 +00:00
_init_stdio();
stdin = _fdopen_impl(STDIN_FILENO, "r", _IOLBF);
stdout = _fdopen_impl(STDOUT_FILENO, "w", _IOLBF);
stderr = _fdopen_impl(STDERR_FILENO, "w", _IONBF);
}
}