mbtowc.c - scc - simple c99 compiler
 (HTM) git clone git://git.simple-cc.org/scc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
       mbtowc.c (289B)
       ---
            1 #include <stdlib.h>
            2 #include <string.h>
            3 #include <wchar.h>
            4 
            5 #undef mbtowc
            6 
            7 int
            8 mbtowc(wchar_t *restrict pwc, const char *restrict s, size_t n)
            9 {
           10         int ret;
           11         static mbstate_t st;
           12 
           13         ret = mbrtowc(pwc, s, n, &st);
           14         if (ret == -2) {
           15                 memset(&st, 0, sizeof(st));
           16                 ret = -1;
           17         }
           18 
           19         return ret;
           20 }