byte-based C locale, phase 2: stdio and iconv (multibyte callers)
[musl] / src / stdio / fwide.c
1 #include "stdio_impl.h"
2 #include "locale_impl.h"
3
4 int fwide(FILE *f, int mode)
5 {
6         FLOCK(f);
7         if (mode) {
8                 if (!f->locale) f->locale = MB_CUR_MAX==1
9                         ? C_LOCALE : UTF8_LOCALE;
10                 if (!f->mode) f->mode = mode>0 ? 1 : -1;
11         }
12         mode = f->mode;
13         FUNLOCK(f);
14         return mode;
15 }