From c91020ef8946eb46985c864d3408091233eea0d8 Mon Sep 17 00:00:00 2001 From: solar Date: Tue, 9 May 2006 05:15:48 +0000 Subject: [PATCH] Added general idea of std... initializers. --- platform/example/functions/_PDCLIB/stdinit.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/example/functions/_PDCLIB/stdinit.c b/platform/example/functions/_PDCLIB/stdinit.c index c8122c5..24285f7 100644 --- a/platform/example/functions/_PDCLIB/stdinit.c +++ b/platform/example/functions/_PDCLIB/stdinit.c @@ -15,7 +15,17 @@ #ifndef REGTEST -/* TODO: Initialize stdin, stdout, stderr */ +/* In a POSIX system, stdin / stdout / stderr are equivalent to the (int) file + descriptors 0, 1, and 2 respectively. +*/ +/* TODO: This is proof-of-concept, requires finetuning. */ +static struct _PDCLIB_file_t _PDCLIB_sin = { 0, { 0, 0 }, 0, 0, 0, /* mbstate, */ 0 }; +static struct _PDCLIB_file_t _PDCLIB_sout = { 1, { 0, 0 }, 0, 0, 0, /* mbstate, */ 0 }; +static struct _PDCLIB_file_t _PDCLIB_serr = { 2, { 0, 0 }, 0, 0, 0, /* mbstate, */ 0 }; + +struct _PDCLIB_file_t * stdin = &_PDCLIB_sin; +struct _PDCLIB_file_t * stdout = &_PDCLIB_sout; +struct _PDCLIB_file_t * stderr = &_PDCLIB_serr; #endif -- 2.40.0