diff options
author | Christopher Faylor <me@cgf.cx> | 2010-05-18 18:30:51 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2010-05-18 18:30:51 +0400 |
commit | d3258e063cb0a4fc77a76df3c91ba9841ca4971c (patch) | |
tree | 2921ded7329f12667d439c207fa81f15575dba14 /winsup/cygwin/strace.cc | |
parent | c8bd391c328c8650a93388f5cb3409c3740ee963 (diff) |
* environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
* exception.cc (open_stackdumpfile): Accommodate change to the type of progname
in _pinfo.
* external.cc (fillout_pinfo): Ditto.
* fhandler_process.cc (format_process_winexename): Ditto.
(format_process_stat): Ditto.
* fork.cc (fork::parent): Ditto.
* pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW instead of
GetModuleFileName.
(pinfo::thisproc): Accommodate change to the type of progname in _pinfo.
(pinfo_init): Ditto.
* pinfo.h (_pinfo): Change the type of progname to a wide char array.
* registry.h (reg_key::get_int): Change the first argument from constant point
to pointer to constant.
(reg_key::get_string): Ditto. Change the last argument likewise.
* registry.cc (reg_key::get_int): Accommodate change to the declaration.
(reg_key::get_string): Ditto.
* strace.cc (strace::hello): Accommodate change to the type of progname in
_pinfo.
(strace::vsprntf): Ditto.
Diffstat (limited to 'winsup/cygwin/strace.cc')
-rw-r--r-- | winsup/cygwin/strace.cc | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index beba5b335..4670f8a9a 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -52,11 +52,11 @@ strace::hello () __small_sprintf (pidbuf, "(pid %d, ppid %d)", myself->pid, myself->ppid ?: 1); else { - GetModuleFileName (NULL, myself->progname, sizeof (myself->progname)); + GetModuleFileNameW (NULL, myself->progname, sizeof (myself->progname)); __small_sprintf (pidbuf, "(windows pid %d)", GetCurrentProcessId ()); } prntf (1, NULL, "**********************************************"); - prntf (1, NULL, "Program name: %s %s", myself->progname, pidbuf); + prntf (1, NULL, "Program name: %W %s", myself->progname, pidbuf); prntf (1, NULL, "App version: %d.%d, api: %d.%d", user_data->dll_major, user_data->dll_minor, user_data->api_major, user_data->api_minor); @@ -135,7 +135,7 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) int microsec = microseconds (); lmicrosec = microsec; - __small_sprintf (fmt, "%7d [%s] %s ", microsec, tn, "%s %s%s"); + __small_sprintf (fmt, "%7d [%s] %s ", microsec, tn, "%W %s%s"); SetLastError (err); @@ -143,34 +143,32 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) count = 0; else { - char *pn; + PWCHAR pn = NULL; + WCHAR progname[NT_MAX_PATH]; if (!cygwin_finished_initializing) - pn = myself ? myself->progname : NULL; + pn = (myself) ? myself->progname : NULL; else if (__progname) - pn = __progname; - else - pn = NULL; + sys_mbstowcs(pn = progname, NT_MAX_PATH, __progname); - char *p; - char progname[NT_MAX_PATH]; + PWCHAR p; if (!pn) - GetModuleFileName (NULL, pn = progname, sizeof (progname)); + GetModuleFileNameW (NULL, pn = progname, sizeof (progname)); if (!pn) /* hmm */; - else if ((p = strrchr (pn, '\\')) != NULL) + else if ((p = wcsrchr (pn, L'\\')) != NULL) p++; - else if ((p = strrchr (pn, '/')) != NULL) + else if ((p = wcsrchr (pn, L'/')) != NULL) p++; else p = pn; if (p != progname) - strcpy (progname, p); - if ((p = strrchr (progname, '.')) != NULL - && ascii_strcasematch (p, ".exe")) + wcscpy (progname, p); + if ((p = wcsrchr (progname, '.')) != NULL + && !wcscasecmp (p, L".exe")) *p = '\000'; p = progname; char tmpbuf[20]; - count = __small_sprintf (buf, fmt, p && *p ? p : "?", mypid (tmpbuf), + count = __small_sprintf (buf, fmt, *p ? p : L"?", mypid (tmpbuf), execing ? "!" : ""); if (func) count += getfunc (buf + count, func); |