summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-01-31 20:26:01 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-01-31 20:26:01 +0000
commit1597484cb589da409832f64db94c8ac79ccf468c (patch)
treeea63fb97e7f3563da47673b3db3fbff6f78eb06d /winsup/cygwin/dcrt0.cc
parent8e87af7ed082bf06a30e226e6bc779c932db625a (diff)
downloadcygnal-1597484cb589da409832f64db94c8ac79ccf468c.tar.gz
cygnal-1597484cb589da409832f64db94c8ac79ccf468c.tar.bz2
cygnal-1597484cb589da409832f64db94c8ac79ccf468c.zip
* dcrt0.cc (dll_crt0_1): Use GetCommandLineW and convert to current
codepage. * environ.cc (set_file_api_mode): Always set file api to ANSI if not using the OEM codepage. (codepage_init): Allow "utf8" codepage. * fhandler_clipboard.cc (set_clipboard): Convert clipbuf to void and cast as needed. Always convert input to wide char and write CF_UNICODETEXT to clipboard. (fhandler_dev_clipboard::read): Read CF_UNICODETEXT from clipboard and convert to current codepage if CYGWIN_NATIVE format is not available. * fhandler_console.cc: Drop redundant undef. * smallprint.cc (__small_vsprintf): Convert PWCHAR and UNICODE_STRING to current codepage for printing. * strfuncs.cc: Use PWCHAR throughout. (get_cp): Return CP_UTF8 for utf8_cp codepage setting. (sys_wcstombs): Allow NULL target buffer. (sys_wcstombs_alloc): New function. (sys_mbstowcs_alloc): Ditto. * winsup.h (codepage_type): Add utf8_cp. (HEAP_NOTHEAP): Define. (sys_wcstombs_alloc): Declare. (sys_mbstowcs_alloc): Declare.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index a022c8305..a9679c90c 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -18,6 +18,7 @@ details. */
#include "exceptions.h"
#include <ctype.h>
#include <limits.h>
+#include <winnls.h>
#include <wingdi.h>
#include <winuser.h>
#include "sigproc.h"
@@ -855,11 +856,10 @@ dll_crt0_1 (void *)
if (!__argc)
{
- char *line = GetCommandLineA ();
- line = strcpy ((char *) alloca (strlen (line) + 1), line);
-
- if (current_codepage == oem_cp)
- CharToOemA (line, line);
+ PWCHAR wline = GetCommandLineW ();
+ size_t size = sys_wcstombs (NULL, size, wline);
+ char *line = (char *) alloca (size);
+ sys_wcstombs (line, size, wline);
/* Scan the command line and build argv. Expand wildcards if not
called from another cygwin process. */