newlib/winsup/mingw/mingwex/mb_wc_common.h
Chris Sutcliffe 5f7eee9ec9 2010-04-27 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/mb_wc_common.h (get_codepage): Revert change of 2006-09-19.
2010-05-19 02:59:46 +00:00

14 lines
315 B
C
Executable File

#include <locale.h>
#include <string.h>
#include <stdlib.h>
static inline
unsigned int get_codepage (void)
{
/* locale :: "lang[_country[.code_page]]" | ".code_page" */
char * cp_string;
if ((cp_string = strchr (setlocale(LC_CTYPE, NULL), '.')))
return ((unsigned) atoi (cp_string + 1));
return 0;
}