fix debugger tracking of shared libraries on mips with PIE main program
[musl] / src / multibyte / btowc.c
index 29cb798..8acd0a2 100644 (file)
@@ -1,8 +1,10 @@
 #include <stdio.h>
 #include <wchar.h>
+#include <stdlib.h>
+#include "internal.h"
 
 wint_t btowc(int c)
 {
-       c = (unsigned char)c;
-       return c<128U ? c : EOF;
+       int b = (unsigned char)c;
+       return b<128U ? b : (MB_CUR_MAX==1 && c!=EOF) ? CODEUNIT(c) : WEOF;
 }