summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-27 14:30:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-27 14:30:23 (GMT)
commit6907fbc11c5ee2d395249a5eb2faf46280da369f (patch)
tree2d8f5bc75247dd5e8de4083e7aae5b982df43e02 /unix/tclUnixFile.c
parent10d0fdda43af43d8ba42bb48b3fb73ec56c33545 (diff)
downloadtcl-6907fbc11c5ee2d395249a5eb2faf46280da369f.zip
tcl-6907fbc11c5ee2d395249a5eb2faf46280da369f.tar.gz
tcl-6907fbc11c5ee2d395249a5eb2faf46280da369f.tar.bz2
Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongs
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 8fb9fd9..f428af7 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -39,23 +39,17 @@ TclpFindExecutable(
CONST char *argv0) /* The value of the application's argv[0]
* (native). */
{
+ Tcl_Encoding encoding;
#ifdef __CYGWIN__
+ int length;
char buf[PATH_MAX * TCL_UTF_MAX + 1];
char name[PATH_MAX * TCL_UTF_MAX + 1];
-#else
- CONST char *name, *p;
- Tcl_StatBuf statBuf;
- Tcl_DString buffer, nameString, cwd, utfName;
- Tcl_Encoding encoding;
-#endif
-
-#ifdef __CYGWIN__
/* Make some symbols available without including <windows.h> */
# define CP_UTF8 65001
- extern int cygwin_conv_to_full_posix_path(const char *, char *);
- extern __stdcall int GetModuleFileNameW(void *, const char *, int);
- extern __stdcall int WideCharToMultiByte(int, int, const char *, int,
+ DLLIMPORT extern int cygwin_conv_to_full_posix_path(const char *, char *);
+ DLLIMPORT extern __stdcall int GetModuleFileNameW(void *, const char *, int);
+ DLLIMPORT extern __stdcall int WideCharToMultiByte(int, int, const char *, int,
const char *, int, const char *, const char *);
GetModuleFileNameW(NULL, name, PATH_MAX);
@@ -66,10 +60,14 @@ TclpFindExecutable(
/* Strip '.exe' part. */
length -= 4;
}
- tclNativeExecutableName = (char *) ckalloc(length + 1);
- memcpy(tclNativeExecutableName, name, length);
- buf[length] = '\0';
+ encoding = Tcl_GetEncoding(NULL, NULL);
+ TclSetObjNameOfExecutable(
+ Tcl_NewStringObj(name, length), encoding);
#else
+ const char *name, *p;
+ Tcl_StatBuf statBuf;
+ Tcl_DString buffer, nameString, cwd, utfName;
+
if (argv0 == NULL) {
return;
}