diff --git a/src/os/file/file.h b/src/os/file/file.h index e2936cc..9703938 100644 --- a/src/os/file/file.h +++ b/src/os/file/file.h @@ -12,9 +12,9 @@ BEGIN_C_LINKAGE #endif // !WAPP_PLATFORM_CPP typedef struct WFile WFile; -// wapp_extern WFile *WF_STDIN; -// wapp_extern WFile *WF_STDOUT; -// wapp_extern WFile *WF_STDERR; +wapp_extern WFile *WF_STDIN; +wapp_extern WFile *WF_STDOUT; +wapp_extern WFile *WF_STDERR; typedef enum { WAPP_ACCESS_READ, // Equivalent to r diff --git a/src/os/file/posix/file_posix.c b/src/os/file/posix/file_posix.c index ee6db15..5fbe9f8 100644 --- a/src/os/file/posix/file_posix.c +++ b/src/os/file/posix/file_posix.c @@ -49,6 +49,14 @@ wapp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = { [WAPP_SEEK_END] = SEEK_END, }; +wapp_intern WFile _STDIN = { .fd = STDIN_FILENO }; +wapp_intern WFile _STDOUT = { .fd = STDOUT_FILENO }; +wapp_intern WFile _STDERR = { .fd = STDERR_FILENO }; + +WFile *WF_STDIN = &_STDIN; +WFile *WF_STDOUT = &_STDOUT; +WFile *WF_STDERR = &_STDERR; + WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) { wapp_persist c8 tmp[WAPP_PATH_MAX] = {0}; memset(tmp, 0, WAPP_PATH_MAX);