summaryrefslogtreecommitdiffstats
path: root/unix
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)
commit4457676798e94230b3296a67ab9caed2dc95e8d5 (patch)
tree2d8f5bc75247dd5e8de4083e7aae5b982df43e02 /unix
parentb412ad6981173a44ab0f31ad66b9c429b52ebe30 (diff)
downloadtcl-4457676798e94230b3296a67ab9caed2dc95e8d5.zip
tcl-4457676798e94230b3296a67ab9caed2dc95e8d5.tar.gz
tcl-4457676798e94230b3296a67ab9caed2dc95e8d5.tar.bz2
Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongs
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixFile.c26
-rw-r--r--unix/tclUnixPort.h13
2 files changed, 23 insertions, 16 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;
}
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index 5abe602..70ea2d4 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -74,8 +74,17 @@ typedef off_t Tcl_SeekOffset;
#endif
#ifdef __CYGWIN__
-MODULE_SCOPE int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
-MODULE_SCOPE int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
+# define USE_PUTENV 1
+# define USE_PUTENV_FOR_UNSET 1
+/* On Cygwin, the environment is imported from the Cygwin DLL. */
+# define environ __cygwin_environ
+# define timezone _timezone
+ DLLIMPORT extern char **__cygwin_environ;
+ DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *);
+ DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value);
+ DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value);
+ MODULE_SCOPE int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
+ MODULE_SCOPE int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
#elif defined(HAVE_STRUCT_STAT64)
# define TclOSstat stat64
# define TclOSlstat lstat64