From db616c2d5cff8477336b318d889e02112fe97f9a Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 28 May 2024 12:34:30 -0400 Subject: handle stream orientation behavior --- src/wchar/fwide.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/wchar/fwide.c') diff --git a/src/wchar/fwide.c b/src/wchar/fwide.c index 9623d956..4dc965be 100644 --- a/src/wchar/fwide.c +++ b/src/wchar/fwide.c @@ -1,5 +1,3 @@ -#if 0 - #include #include #include "stdio/_stdio.h" @@ -9,10 +7,14 @@ int fwide(FILE * stream, int mode) { SIGNAL_SAFE(0); - ASSERT_NONNULL(stream); + ASSERT_STREAM(stream, 0, 0); - if (stream->orientation == 0) { - stream->orientation = mode; + if (mode != 0) { + if (mode < 0) { + stream->orientation = ORIENT_BYTE; + } else if (mode > 0) { + stream->orientation = ORIENT_WIDE; + } } return stream->orientation; } @@ -20,6 +22,3 @@ int fwide(FILE * stream, int mode) /* STDC(199409) */ - - -#endif -- cgit v1.2.1