X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fstdinit.c;h=a02c691c4af8772140a8c5c35e3c9314559550d8;hb=e5fedc94f017c068b93f0d168a9973a3e8401c42;hp=24285f7031f878b0d3e969c3b950a802d0e311ea;hpb=6338b2fdd24c05facc84e9a9a6ba605a9fc61f26;p=pdclib.old diff --git a/platform/example/functions/_PDCLIB/stdinit.c b/platform/example/functions/_PDCLIB/stdinit.c index 24285f7..a02c691 100644 --- a/platform/example/functions/_PDCLIB/stdinit.c +++ b/platform/example/functions/_PDCLIB/stdinit.c @@ -19,9 +19,14 @@ 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 }; +static char _PDCLIB_sin_buffer[BUFSIZ]; +static char _PDCLIB_sout_buffer[BUFSIZ]; +static char _PDCLIB_serr_buffer[BUFSIZ]; + +/* FIXME: serr should handle one character. Buffering on out / in? */ +static struct _PDCLIB_file_t _PDCLIB_serr = { 2, { 0, 0 }, _PDCLIB_serr_buffer, BUFSIZ, 0, 0, _IONBF, NULL, NULL }; +static struct _PDCLIB_file_t _PDCLIB_sout = { 1, { 0, 0 }, _PDCLIB_sout_buffer, BUFSIZ, 0, 0, _IOLBF, NULL, &_PDCLIB_serr }; +static struct _PDCLIB_file_t _PDCLIB_sin = { 0, { 0, 0 }, _PDCLIB_sin_buffer, BUFSIZ, 0, 0, _IOLBF, NULL, &_PDCLIB_sout }; struct _PDCLIB_file_t * stdin = &_PDCLIB_sin; struct _PDCLIB_file_t * stdout = &_PDCLIB_sout;