summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/stdio/fwide.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/stdio/fwide.c')
-rw-r--r--libc-top-half/musl/src/stdio/fwide.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/stdio/fwide.c b/libc-top-half/musl/src/stdio/fwide.c
new file mode 100644
index 0000000..8bab634
--- /dev/null
+++ b/libc-top-half/musl/src/stdio/fwide.c
@@ -0,0 +1,16 @@
+#include <wchar.h>
+#include "stdio_impl.h"
+#include "locale_impl.h"
+
+int fwide(FILE *f, int mode)
+{
+ FLOCK(f);
+ if (mode) {
+ if (!f->locale) f->locale = MB_CUR_MAX==1
+ ? C_LOCALE : UTF8_LOCALE;
+ if (!f->mode) f->mode = mode>0 ? 1 : -1;
+ }
+ mode = f->mode;
+ FUNLOCK(f);
+ return mode;
+}