github.com/afumu/libc@v0.0.6/musl/src/stdio/fwide.c (about)

     1  #include <wchar.h>
     2  #include "stdio_impl.h"
     3  #include "locale_impl.h"
     4  
     5  int fwide(FILE *f, int mode)
     6  {
     7  	FLOCK(f);
     8  	if (mode) {
     9  		if (!f->locale) f->locale = MB_CUR_MAX==1
    10  			? C_LOCALE : UTF8_LOCALE;
    11  		if (!f->mode) f->mode = mode>0 ? 1 : -1;
    12  	}
    13  	mode = f->mode;
    14  	FUNLOCK(f);
    15  	return mode;
    16  }