summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--generic/tcl.h105
-rw-r--r--generic/tclEnv.c85
-rw-r--r--generic/tclFileName.c11
-rw-r--r--generic/tclStubInit.c2
-rw-r--r--unix/tclUnixFile.c44
-rw-r--r--unix/tclUnixPort.h8
-rw-r--r--win/tclWinFile.c60
-rw-r--r--win/tclWinPort.h39
9 files changed, 147 insertions, 223 deletions
diff --git a/ChangeLog b/ChangeLog
index 3955965..95d57c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,16 @@
2012-03-20 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh
- * generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar,
- * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for
- * generic/tclPlatDecls.h: Cygwin, so win32 extensions using those can be
- * generic/tclStubInit.c: loaded in the cygwin version of tclsh.
+ * generic/tcl.h: [Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
+ * unix/tclUnixFile.c
+ * unix/tclUnixPort.h
+ * win/tclWinFile.c Remove cygwin stuff no longer needed
+ * win/tclWinPort.h
+
+ * generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh
+ * generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar,
+ * generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for
+ * generic/tclPlatDecls.h: Cygwin, so win32 extensions using those can be
+ * generic/tclStubInit.c: loaded in the cygwin version of tclsh.
* unix/tclUnixCompat.c:
2012-03-12 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/generic/tcl.h b/generic/tcl.h
index b9355da..e794032 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -82,6 +82,7 @@ extern "C" {
/*
* STRICT: See MSDN Article Q83456
*/
+
#ifdef __WIN32__
# ifndef STRICT
# define STRICT
@@ -234,11 +235,11 @@ extern "C" {
# endif
#endif
-
/*
* Definitions that allow this header file to be used either with or
* without ANSI C features like function prototypes.
*/
+
#undef _ANSI_ARGS_
#undef CONST
#ifndef INLINE
@@ -265,7 +266,7 @@ extern "C" {
# define CONST84_RETURN
#else
# ifdef USE_COMPAT_CONST
-# define CONST84
+# define CONST84
# define CONST84_RETURN CONST
# else
# define CONST84 CONST
@@ -273,10 +274,10 @@ extern "C" {
# endif
#endif
-
/*
* Make sure EXTERN isn't defined elsewhere
*/
+
#ifdef EXTERN
# undef EXTERN
#endif /* EXTERN */
@@ -287,15 +288,15 @@ extern "C" {
# define EXTERN extern TCL_STORAGE_CLASS
#endif
-
/*
* The following code is copied from winnt.h.
- * If we don't replicate it here, then <windows.h> can't be included
+ * If we don't replicate it here, then <windows.h> can't be included
* after tcl.h, since tcl.h also defines VOID.
* This block is skipped under Cygwin and Mingw.
*
*
*/
+
#if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID)
#ifndef VOID
#define VOID void
@@ -372,7 +373,7 @@ typedef long LONG;
*/
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
-# if defined(__WIN32__) && !defined(__CYGWIN__)
+# if defined(__WIN32__)
# define TCL_WIDE_INT_TYPE __int64
# ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
@@ -439,7 +440,21 @@ typedef struct stat Tcl_StatBuf;
* Windows or some other strange platform.
*/
# ifndef TCL_LL_MODIFIER
-# ifdef HAVE_STRUCT_STAT64
+# ifdef __CYGWIN__
+typedef struct _stat32i64 {
+ dev_t st_dev;
+ ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ dev_t st_rdev;
+ long long st_size;
+ struct {long tv_sec;} st_atim;
+ struct {long tv_sec;} st_mtim;
+ struct {long tv_sec;} st_ctim;
+} Tcl_StatBuf;
+# elif defined(HAVE_STRUCT_STAT64)
typedef struct stat64 Tcl_StatBuf;
# else
typedef struct stat Tcl_StatBuf;
@@ -531,7 +546,6 @@ typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData client
typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
#endif
-
/*
* Threading function return types used for abstracting away platform
* differences when writing a Tcl_ThreadCreateProc. See the NewThread
@@ -545,14 +559,14 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
# define TCL_THREAD_CREATE_RETURN return 0
#else
# define Tcl_ThreadCreateType void
-# define TCL_THREAD_CREATE_RETURN
+# define TCL_THREAD_CREATE_RETURN
#endif
-
/*
* Definition of values for default stacksize and the possible flags to be
* given to Tcl_CreateThread.
*/
+
#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack */
#define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default behaviour */
#define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable */
@@ -579,6 +593,7 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
* The following flag is experimental and only intended for use by Expect. It
* will probably go away in a later release.
*/
+
#define TCL_REG_BOSONLY 002000 /* prepend \A to pattern so it only
* matches at the beginning of the
* string. */
@@ -594,6 +609,7 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
* relative to the start of the match string, not the beginning of the
* entire string.
*/
+
typedef struct Tcl_RegExpIndices {
long start; /* character offset of first character in match */
long end; /* character offset of first character after the
@@ -614,6 +630,7 @@ typedef struct Tcl_RegExpInfo {
* Picky compilers complain if this typdef doesn't appear before the
* struct's reference in tclDecls.h.
*/
+
typedef Tcl_StatBuf *Tcl_Stat_;
typedef struct stat *Tcl_OldStat_;
@@ -637,6 +654,7 @@ typedef struct stat *Tcl_OldStat_;
* TCL_CONTINUE Go on to the next iteration of the current loop;
* the interpreter's result is meaningless.
*/
+
#define TCL_OK 0
#define TCL_ERROR 1
#define TCL_RETURN 2
@@ -648,6 +666,7 @@ typedef struct stat *Tcl_OldStat_;
/*
* Flags to control what substitutions are performed by Tcl_SubstObj():
*/
+
#define TCL_SUBST_COMMANDS 001
#define TCL_SUBST_VARIABLES 002
#define TCL_SUBST_BACKSLASHES 004
@@ -675,7 +694,6 @@ typedef struct Tcl_Value {
*/
struct Tcl_Obj;
-
/*
* Procedure types defined by Tcl:
*/
@@ -695,8 +713,8 @@ typedef int (Tcl_CmdObjTraceProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int level, CONST char *command,
Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv));
typedef void (Tcl_CmdObjTraceDeleteProc) _ANSI_ARGS_((ClientData clientData));
-typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
- struct Tcl_Obj *dupPtr));
+typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
+ struct Tcl_Obj *dupPtr));
typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData,
CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr,
char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr,
@@ -706,7 +724,7 @@ typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData,
int flags));
typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr,
- ClientData clientData));
+ ClientData clientData));
typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData,
int flags));
typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData));
@@ -725,13 +743,14 @@ typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
- Tcl_Channel chan, char *address, int port));
+ Tcl_Channel chan, char *address, int port));
typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp,
struct Tcl_Obj *objPtr));
typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2, int flags));
+ Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2,
+ int flags));
typedef void (Tcl_CommandTraceProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, CONST char *oldName, CONST char *newName,
int flags));
@@ -885,7 +904,6 @@ typedef struct Tcl_SavedResult {
char resultSpace[TCL_RESULT_SIZE+1];
} Tcl_SavedResult;
-
/*
* The following definitions support Tcl's namespace facility.
* Note: the first five fields must match exactly the fields in a
@@ -910,7 +928,6 @@ typedef struct Tcl_Namespace {
* namespace. */
} Tcl_Namespace;
-
/*
* The following structure represents a call frame, or activation record.
* A call frame defines a naming context for a procedure call: its local
@@ -950,7 +967,6 @@ typedef struct Tcl_CallFrame {
VOID *dummy13;
} Tcl_CallFrame;
-
/*
* Information about commands that is returned by Tcl_GetCommandInfo and
* passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based
@@ -992,6 +1008,7 @@ typedef struct Tcl_CmdInfo {
* field that clients should use is the string field, accessible via the
* macro Tcl_DStringValue.
*/
+
#define TCL_DSTRING_STATIC_SIZE 200
typedef struct Tcl_DString {
char *string; /* Points to beginning of string: either
@@ -1014,6 +1031,7 @@ typedef struct Tcl_DString {
* be specified in the "tcl_precision" variable, and the number of
* bytes of buffer space required by Tcl_PrintDouble.
*/
+
#define TCL_MAX_PREC 17
#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
@@ -1022,6 +1040,7 @@ typedef struct Tcl_DString {
* string representation of an integer in base 10 (assuming the existence
* of 64-bit integers).
*/
+
#define TCL_INTEGER_SPACE 24
/*
@@ -1029,12 +1048,14 @@ typedef struct Tcl_DString {
* output braces (careful! if you change this flag be sure to change
* the definitions at the front of tclUtil.c).
*/
+
#define TCL_DONT_USE_BRACES 1
/*
* Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
* abbreviated strings.
*/
+
#define TCL_EXACT 1
/*
@@ -1051,6 +1072,7 @@ typedef struct Tcl_DString {
* Special freeProc values that may be passed to Tcl_SetResult (see
* the man page for details):
*/
+
#define TCL_VOLATILE ((Tcl_FreeProc *) 1)
#define TCL_STATIC ((Tcl_FreeProc *) 0)
#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
@@ -1058,6 +1080,7 @@ typedef struct Tcl_DString {
/*
* Flag values passed to variable-related procedures.
*/
+
#define TCL_GLOBAL_ONLY 1
#define TCL_NAMESPACE_ONLY 2
#define TCL_APPEND_VALUE 4
@@ -1105,7 +1128,6 @@ typedef struct Tcl_DString {
# define TCL_PARSE_PART1 0x400
#endif
-
/*
* Types for linked variables:
*/
@@ -1116,10 +1138,10 @@ typedef struct Tcl_DString {
#define TCL_LINK_WIDE_INT 5
#define TCL_LINK_READ_ONLY 0x80
-
/*
* Forward declarations of Tcl_HashTable and related types.
*/
+
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
typedef struct Tcl_HashTable Tcl_HashTable;
typedef struct Tcl_HashEntry Tcl_HashEntry;
@@ -1139,6 +1161,7 @@ typedef void (Tcl_FreeHashEntryProc) _ANSI_ARGS_((Tcl_HashEntry *hPtr));
* access the bucketPtr member of the Tcl_HashTableEntry structure. This
* member has been removed and the space used to store the hash value.
*/
+
#ifndef TCL_HASH_KEY_STORE_HASH
# define TCL_HASH_KEY_STORE_HASH 1
#endif
@@ -1384,6 +1407,7 @@ typedef struct Tcl_HashSearch {
* a Tcl_Event header followed by additional information specific to that
* event.
*/
+
struct Tcl_Event {
Tcl_EventProc *proc; /* Procedure to call to service this event. */
struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */
@@ -1392,6 +1416,7 @@ struct Tcl_Event {
/*
* Positions to pass to Tcl_QueueEvent:
*/
+
typedef enum {
TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
} Tcl_QueuePosition;
@@ -1400,16 +1425,17 @@ typedef enum {
* Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
* event routines.
*/
+
#define TCL_SERVICE_NONE 0
#define TCL_SERVICE_ALL 1
-
/*
* The following structure keeps is used to hold a time value, either as
* an absolute time (the number of seconds from the epoch) or as an
* elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
* On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
*/
+
typedef struct Tcl_Time {
long sec; /* Seconds. */
long usec; /* Microseconds. */
@@ -1418,7 +1444,6 @@ typedef struct Tcl_Time {
typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr));
typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
-
/*
* Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
* to indicate what sorts of events are of interest:
@@ -1432,6 +1457,7 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
* disposition of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR,
* are also used in Tcl_GetStdChannel.
*/
+
#define TCL_STDIN (1<<1)
#define TCL_STDOUT (1<<2)
#define TCL_STDERR (1<<3)
@@ -1448,11 +1474,13 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
* Value to use as the closeProc for a channel that supports the
* close2Proc interface.
*/
+
#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)1)
/*
* Channel version tag. This was introduced in 8.3.2/8.4.
*/
+
#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1)
#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2)
#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3)
@@ -1468,6 +1496,7 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
/*
* Typedefs for the various operations in a channel type:
*/
+
typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_((
ClientData instanceData, int mode));
typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData,
@@ -1544,6 +1573,7 @@ typedef void (Tcl_DriverThreadActionProc) _ANSI_ARGS_ ((
* It is recommend that the Tcl_Channel* functions are used to access
* elements of this structure, instead of direct accessing.
*/
+
typedef struct Tcl_ChannelType {
char *typeName; /* The name of the channel type in Tcl
* commands. This storage is owned by
@@ -1616,13 +1646,13 @@ typedef struct Tcl_ChannelType {
/*
* Enum for different types of file paths.
*/
+
typedef enum Tcl_PathType {
TCL_PATH_ABSOLUTE,
TCL_PATH_RELATIVE,
TCL_PATH_VOLUME_RELATIVE
} Tcl_PathType;
-
/*
* The following structure is used to pass glob type data amongst
* the various glob routines and Tcl_FSMatchInDirectory.
@@ -1641,6 +1671,7 @@ typedef struct Tcl_GlobTypeData {
/*
* type and permission definitions for glob command
*/
+
#define TCL_GLOB_TYPE_BLOCK (1<<0)
#define TCL_GLOB_TYPE_CHAR (1<<1)
#define TCL_GLOB_TYPE_DIR (1<<2)
@@ -1656,10 +1687,10 @@ typedef struct Tcl_GlobTypeData {
#define TCL_GLOB_PERM_W (1<<3)
#define TCL_GLOB_PERM_X (1<<4)
-
/*
* Typedefs for the various filesystem operations:
*/
+
typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf));
typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode));
typedef Tcl_Channel (Tcl_FSOpenFileChannelProc)
@@ -1927,6 +1958,7 @@ typedef struct Tcl_Filesystem {
* TCL_CREATE_SYMBOLIC_LINK: Create a symbolic or soft link.
* TCL_CREATE_HARD_LINK: Create a hard link.
*/
+
#define TCL_CREATE_SYMBOLIC_LINK 0x01
#define TCL_CREATE_HARD_LINK 0x02
@@ -1934,6 +1966,7 @@ typedef struct Tcl_Filesystem {
* The following structure represents the Notifier functions that
* you can override with the Tcl_SetNotifier call.
*/
+
typedef struct Tcl_NotifierProcs {
Tcl_SetTimerProc *setTimerProc;
Tcl_WaitForEventProc *waitForEventProc;
@@ -1945,11 +1978,11 @@ typedef struct Tcl_NotifierProcs {
Tcl_ServiceModeHookProc *serviceModeHookProc;
} Tcl_NotifierProcs;
-
/*
* The following structure represents a user-defined encoding. It collects
* together all the functions that are used by the specific encoding.
*/
+
typedef struct Tcl_EncodingType {
CONST char *encodingName; /* The name of the encoding, e.g. "euc-jp".
* This name is the unique key for this
@@ -2007,7 +2040,6 @@ typedef struct Tcl_EncodingType {
#define TCL_ENCODING_END 0x02
#define TCL_ENCODING_STOPONERROR 0x04
-
/*
* The following data structures and declarations are for the new Tcl
* parser.
@@ -2018,6 +2050,7 @@ typedef struct Tcl_EncodingType {
* variable reference, one of the following structures is created to
* describe the token.
*/
+
typedef struct Tcl_Token {
int type; /* Type of token, such as TCL_TOKEN_WORD;
* see below for valid types. */
@@ -2117,6 +2150,7 @@ typedef struct Tcl_Token {
* will be stored in the error field of the Tcl_Parse structure
* defined below.
*/
+
#define TCL_PARSE_SUCCESS 0
#define TCL_PARSE_QUOTE_EXTRA 1
#define TCL_PARSE_BRACE_EXTRA 2
@@ -2132,6 +2166,7 @@ typedef struct Tcl_Token {
* A structure of the following type is filled in by Tcl_ParseCommand.
* It describes a single command parsed from an input string.
*/
+
#define NUM_STATIC_TOKENS 20
typedef struct Tcl_Parse {
@@ -2215,12 +2250,13 @@ typedef struct Tcl_Parse {
* encoding method was misidentified. This error
* is reported only if TCL_ENCODING_STOPONERROR
* was specified.
- *
+ *
* TCL_CONVERT_UNKNOWN: The source string contained a character
* that could not be represented in the target
* encoding. This error is reported only if
* TCL_ENCODING_STOPONERROR was specified.
*/
+
#define TCL_CONVERT_MULTIBYTE -1
#define TCL_CONVERT_SYNTAX -2
#define TCL_CONVERT_UNKNOWN -3
@@ -2236,6 +2272,7 @@ typedef struct Tcl_Parse {
* UCS-4 is experimental and not recommended. It works for the core,
* but most extensions expect UCS-2.
*/
+
#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX 3
#endif
@@ -2244,6 +2281,7 @@ typedef struct Tcl_Parse {
* This represents a Unicode character. Any changes to this should
* also be reflected in regcustom.h.
*/
+
#if TCL_UTF_MAX > 4
/*
* unsigned int isn't 100% accurate as it should be a strict 4-byte
@@ -2283,7 +2321,6 @@ typedef unsigned short Tcl_UniChar;
#define panic Tcl_Panic
#define panicVA Tcl_PanicVA
-
/*
* The following constant is used to test for older versions of Tcl
* in the stubs tables.
@@ -2356,6 +2393,7 @@ EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
* This function is not *implemented* by the tcl library, so the storage
* class is neither DLLEXPORT nor DLLIMPORT
*/
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS
@@ -2369,8 +2407,17 @@ EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
/*
* end block for C++
*/
+
#ifdef __cplusplus
}
#endif
#endif /* _TCL */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 4ce1c3b..deb5dcd 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclEnv.c --
*
* Tcl support for environment variables, including a setenv
@@ -699,83 +699,10 @@ TclFinalizeEnvironment()
}
}
-#if defined(__CYGWIN__) && defined(__WIN32__)
-
-#include <windows.h>
-
/*
- * When using cygwin, when an environment variable changes, we need to synch
- * with both the cygwin environment (in case the application C code calls
- * fork) and the Windows environment (in case the application TCL code calls
- * exec, which calls the Windows CreateProcess function).
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
*/
-
-static void
-TclCygwinPutenv(str)
- const char *str;
-{
- char *name, *value;
-
- /* Get the name and value, so that we can change the environment
- variable for Windows. */
- name = (char *) alloca (strlen (str) + 1);
- strcpy (name, str);
- for (value = name; *value != '=' && *value != '\0'; ++value)
- ;
- if (*value == '\0') {
- /* Can't happen. */
- return;
- }
- *value = '\0';
- ++value;
- if (*value == '\0') {
- value = NULL;
- }
-
- /* Set the cygwin environment variable. */
-#undef putenv
- if (value == NULL) {
- unsetenv (name);
- } else {
- putenv(str);
- }
-
- /*
- * Before changing the environment variable in Windows, if this is PATH,
- * we need to convert the value back to a Windows style path.
- *
- * FIXME: The calling program may know it is running under windows, and
- * may have set the path to a Windows path, or, worse, appended or
- * prepended a Windows path to PATH.
- */
- if (strcmp (name, "PATH") != 0) {
- /* If this is Path, eliminate any PATH variable, to prevent any
- confusion. */
- if (strcmp (name, "Path") == 0) {
- SetEnvironmentVariable ("PATH", (char *) NULL);
- unsetenv ("PATH");
- }
-
- SetEnvironmentVariable (name, value);
- } else {
- char *buf;
-
- /* Eliminate any Path variable, to prevent any confusion. */
- SetEnvironmentVariable ("Path", (char *) NULL);
- unsetenv ("Path");
-
- if (value == NULL) {
- buf = NULL;
- } else {
- int size;
-
- size = cygwin_posix_to_win32_path_list_buf_size (value);
- buf = (char *) alloca (size + 1);
- cygwin_posix_to_win32_path_list (value, buf);
- }
-
- SetEnvironmentVariable (name, buf);
- }
-}
-
-#endif /* __CYGWIN__ && __WIN32__ */
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 8d30905..c70bed5 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2645,17 +2645,6 @@ TclDoGlob(interp, separators, headPtr, tail, types)
Tcl_DStringAppend(headPtr, ".", 1);
}
}
-#if defined(__CYGWIN__) && defined(__WIN32__)
- {
- extern int cygwin_conv_to_win32_path
- _ANSI_ARGS_((CONST char *, char *));
- char winbuf[MAX_PATH+1];
-
- cygwin_conv_to_win32_path(Tcl_DStringValue(headPtr), winbuf);
- Tcl_DStringFree(headPtr);
- Tcl_DStringAppend(headPtr, winbuf, -1);
- }
-#endif /* __CYGWIN__ && __WIN32__ */
/*
* Convert to forward slashes. This is required to pass
* some Tcl tests. We should probably remove the conversions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 6493b4e..af34797 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -86,7 +86,7 @@ Tcl_WinUtfToTChar(string, len, dsPtr)
string, len, dsPtr);
}
-char *
+static char *
Tcl_WinTCharToUtf(string, len, dsPtr)
CONST char *string;
int len;
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index c0d81b1..5eac978 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclUnixFile.c --
*
* This file contains wrappers around UNIX file handling functions.
@@ -820,3 +820,45 @@ TclpUtime(pathPtr, tval)
{
return utime(Tcl_FSGetNativePath(pathPtr),tval);
}
+#ifdef __CYGWIN__
+int TclOSstat(const char *name, Tcl_StatBuf *statBuf) {
+ struct stat buf;
+ int result = stat(name, &buf);
+ statBuf->st_mode = buf.st_mode;
+ statBuf->st_ino = buf.st_ino;
+ statBuf->st_dev = buf.st_dev;
+ statBuf->st_rdev = buf.st_rdev;
+ statBuf->st_nlink = buf.st_nlink;
+ statBuf->st_uid = buf.st_uid;
+ statBuf->st_gid = buf.st_gid;
+ statBuf->st_size = buf.st_size;
+ statBuf->st_atime = buf.st_atime;
+ statBuf->st_mtime = buf.st_mtime;
+ statBuf->st_ctime = buf.st_ctime;
+ return result;
+}
+int TclOSlstat(const char *name, Tcl_StatBuf *statBuf) {
+ struct stat buf;
+ int result = lstat(name, &buf);
+ statBuf->st_mode = buf.st_mode;
+ statBuf->st_ino = buf.st_ino;
+ statBuf->st_dev = buf.st_dev;
+ statBuf->st_rdev = buf.st_rdev;
+ statBuf->st_nlink = buf.st_nlink;
+ statBuf->st_uid = buf.st_uid;
+ statBuf->st_gid = buf.st_gid;
+ statBuf->st_size = buf.st_size;
+ statBuf->st_atime = buf.st_atime;
+ statBuf->st_mtime = buf.st_mtime;
+ statBuf->st_ctime = buf.st_ctime;
+ return result;
+}
+#endif
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index c1aaa63..e19a8ed 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -73,7 +73,13 @@ typedef off_t Tcl_SeekOffset;
# define TclOSopen open
#endif
-#ifdef HAVE_STRUCT_STAT64
+#ifdef __CYGWIN__
+EXTERN int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
+EXTERN int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
+#undef HAVE_ST_BLKSIZE
+#define NO_FSTATFS
+#undef HAVE_FTS
+#elif defined(HAVE_STRUCT_STAT64)
# define TclOSstat stat64
# define TclOSlstat lstat64
#else
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 4ed5a3d..2c6150f 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1640,24 +1640,9 @@ TclpObjChdir(pathPtr)
{
int result;
CONST TCHAR *nativePath;
-#ifdef __CYGWIN__
- extern int cygwin_conv_to_posix_path
- _ANSI_ARGS_((CONST char *, char *));
- char posixPath[MAX_PATH+1];
- CONST char *path;
- Tcl_DString ds;
-#endif /* __CYGWIN__ */
nativePath = (CONST TCHAR *) Tcl_FSGetNativePath(pathPtr);
-#ifdef __CYGWIN__
- /* Cygwin chdir only groks POSIX path. */
- path = Tcl_WinTCharToUtf(nativePath, -1, &ds);
- cygwin_conv_to_posix_path(path, posixPath);
- result = (chdir(posixPath) == 0 ? 1 : 0);
- Tcl_DStringFree(&ds);
-#else /* __CYGWIN__ */
result = (*tclWinProcs->setCurrentDirectoryProc)(nativePath);
-#endif /* __CYGWIN__ */
if (result == 0) {
TclWinConvertError(GetLastError());
@@ -1666,51 +1651,6 @@ TclpObjChdir(pathPtr)
return 0;
}
-#ifdef __CYGWIN__
-/*
- *---------------------------------------------------------------------------
- *
- * TclpReadlink --
- *
- * This function replaces the library version of readlink().
- *
- * Results:
- * The result is a pointer to a string specifying the contents
- * of the symbolic link given by 'path', or NULL if the symbolic
- * link could not be read. Storage for the result string is
- * allocated in bufferPtr; the caller must call Tcl_DStringFree()
- * when the result is no longer needed.
- *
- * Side effects:
- * See readlink() documentation.
- *
- *---------------------------------------------------------------------------
- */
-
-char *
-TclpReadlink(path, linkPtr)
- CONST char *path; /* Path of file to readlink (UTF-8). */
- Tcl_DString *linkPtr; /* Uninitialized or free DString filled
- * with contents of link (UTF-8). */
-{
- char link[MAXPATHLEN];
- int length;
- char *native;
- Tcl_DString ds;
-
- native = Tcl_UtfToExternalDString(NULL, path, -1, &ds);
- length = readlink(native, link, sizeof(link)); /* INTL: Native. */
- Tcl_DStringFree(&ds);
-
- if (length < 0) {
- return NULL;
- }
-
- Tcl_ExternalToUtfDString(NULL, link, length, linkPtr);
- return Tcl_DStringValue(linkPtr);
-}
-#endif /* __CYGWIN__ */
-
/*
*----------------------------------------------------------------------
*
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index dd42340..aca3279 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -98,25 +98,6 @@ typedef DWORD_PTR * PDWORD_PTR;
#undef ENOTSUP
#define ENOTSUP -1030507
-/*
- * cygwin does not have this struct.
- */
-#ifdef __CYGWIN__
- struct _stat32i64 {
- dev_t st_dev;
- ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- dev_t st_rdev;
- __int64 st_size;
- struct {long tv_sec;} st_atim;
- struct {long tv_sec;} st_mtim;
- struct {long tv_sec;} st_ctim;
- };
-#endif
-
/* Those codes, from Visual Studio 2010, conflict with other values */
#undef ENODATA
#undef ENOMSG
@@ -374,14 +355,6 @@ typedef DWORD_PTR * PDWORD_PTR;
# define environ _environ
#endif /* __BORLANDC__ */
-#ifdef __CYGWIN__
-/* On Cygwin, the environment is imported from the Cygwin DLL. */
- DLLIMPORT extern char **__cygwin_environ;
-# define environ __cygwin_environ
-# define putenv TclCygwinPutenv
-# define timezone _timezone
-#endif /* __CYGWIN__ */
-
/*
* There is no platform-specific panic routine for Windows in the Tcl internals.
*/
@@ -430,18 +403,12 @@ typedef DWORD_PTR * PDWORD_PTR;
* use by tclAlloc.c.
*/
-#ifdef __CYGWIN__
-# define TclpSysAlloc(size, isBin) malloc((size))
-# define TclpSysFree(ptr) free((ptr))
-# define TclpSysRealloc(ptr, size) realloc((ptr), (size))
-#else
-# define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
+#define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
(DWORD)0, (DWORD)size))
-# define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
+#define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
(DWORD)0, (HGLOBAL)ptr))
-# define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
+#define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
(DWORD)0, (LPVOID)ptr, (DWORD)size))
-#endif
/*
* The following defines map from standard socket names to our internal