Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-06-26 09:29:41 +0400
committerChristopher Faylor <me@cgf.cx>2002-06-26 09:29:41 +0400
commitf279e522b05950655c6b4699ecd7a7f115261bc8 (patch)
tree9ef00309bf328db0d891c4078147d830d84375c4 /winsup/cygwin/miscfuncs.cc
parent109e4822783c39090bc4c1d3a0ff670ca56839bb (diff)
* autoload (noload): Avoid clobbering bx register.
* environ.cc (codepage_init): Use case insensitive match. * fhandler_console.cc (cp_get_internal): Delete. (con_to_str): Use get_cp to derive code page. (str_to_con): Ditto. * miscfuncs.cc (get_cp): New function. (sys_wcstombs): New function. Converted from macro. (sys_mbstowcs): Ditto. * winsup.h: Reflect above changes.
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r--winsup/cygwin/miscfuncs.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 5d3010470..6fd9ffc91 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -11,6 +11,8 @@ details. */
#include "winsup.h"
#include "cygerrno.h"
#include <sys/errno.h>
+#include <winbase.h>
+#include <winnls.h>
long tls_ix = -1;
@@ -176,3 +178,21 @@ __check_invalid_read_ptr_errno (const void *s, unsigned sz)
return 0;
return set_errno (EFAULT);
}
+
+UINT
+get_cp ()
+{
+ return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
+}
+
+int __stdcall
+sys_wcstombs (char *tgt, const WCHAR *src, int len)
+{
+ return WideCharToMultiByte (get_cp (), 0, src, -1, tgt, len, NULL, NULL);
+}
+
+int __stdcall
+sys_mbstowcs (WCHAR *tgt, const char *src, int len)
+{
+ return MultiByteToWideChar (get_cp (), 0, src, -1, tgt, len);
+}