diff options
author | hobbs <hobbs@noemail.net> | 2002-09-27 00:50:10 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2002-09-27 00:50:10 (GMT) |
commit | 9a36aeef53f7e211186efe5439c92104d0a2a15c (patch) | |
tree | 7ecd449f330b92357eb4737a43574667df864290 /generic/tclFileName.c | |
parent | cb09670f9bf789cc688876d18e3396ca1ca8f7e3 (diff) | |
download | tcl-9a36aeef53f7e211186efe5439c92104d0a2a15c.zip tcl-9a36aeef53f7e211186efe5439c92104d0a2a15c.tar.gz tcl-9a36aeef53f7e211186efe5439c92104d0a2a15c.tar.bz2 |
2002-09-18 Mumit Khan <khan@nanotech.wisc.edu>
Added basic Cygwin support.
* win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build.
(SC_PATH_TKCONFIG): Likewise.
(SC_PROG_TCLSH): Likewise.
(SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin
flags. Add -mwin32 to extra_cflags and extra_ldflags.
Remove ``-e _WinMain@16'' from LDFLAGS_WINDOW.
* win/configure.in: Allow Cygwin build.
(SEH test): Define to be 1 instead of empty value.
(EXCEPTION_DISPOSITION): Add test.
* win/configure: Regenerate.
* generic/tcl.h: Don't explicitly define __WIN32__ for Cygwin, let
the user decide whether to use Windows or POSIX personality.
(TCL_WIDE_INT_TYPE, TCL_LL_MODIFIER, struct Tcl_StatBuf): Define
for Cygwin.
* generic/tclEnv.c (Tcl_CygwinPutenv): putenv replacement for
Cygwin.
* generic/tclFileName.c (Tcl_TranslateFileName): Convert POSIX
to native format.
(TclDoGlob): Likewise.
* generic/tclPlatDecls.h (TCHAR): Define for Cygwin.
* win/tclWinPort.h (putenv, TclpSysAlloc, TclpSysFree,
TclpSysRealloc): Define for Cygwin.
FossilOrigin-Name: a8d036072238ab97036765f139d1663ba16cb4bc
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r-- | generic/tclFileName.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c index f5e7970..e3ec128 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.37 2002/06/05 11:59:33 das Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.38 2002/09/27 00:50:10 hobbs Exp $ */ #include "tclInt.h" @@ -1356,12 +1356,31 @@ Tcl_TranslateFileName(interp, name, bufferPtr) */ if (tclPlatform == TCL_PLATFORM_WINDOWS) { +#if defined(__CYGWIN__) && defined(__WIN32__) + + extern int cygwin_conv_to_win32_path + _ANSI_ARGS_((CONST char *, char *)); + char winbuf[MAX_PATH]; + + /* + * In the Cygwin world, call conv_to_win32_path in order to use the + * mount table to translate the file name into something Windows will + * understand. Take care when converting empty strings! + */ + if (Tcl_DStringLength(bufferPtr)) { + cygwin_conv_to_win32_path(Tcl_DStringValue(bufferPtr), winbuf); + Tcl_DStringFree(bufferPtr); + Tcl_DStringAppend(bufferPtr, winbuf, -1); + } +#else /* __CYGWIN__ && __WIN32__ */ + register char *p; for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) { if (*p == '/') { *p = '\\'; } } +#endif /* __CYGWIN__ && __WIN32__ */ } return Tcl_DStringValue(bufferPtr); } @@ -2317,6 +2336,25 @@ TclDoGlob(interp, separators, headPtr, tail, types) * element. Add an extra slash if this is a UNC path. */ +#if defined(__CYGWIN__) && defined(__WIN32__) + { + + extern int cygwin_conv_to_win32_path + _ANSI_ARGS_((CONST char *, char *)); + char winbuf[MAX_PATH]; + + /* + * In the Cygwin world, call conv_to_win32_path in order to use + * the mount table to translate the file name into something + * Windows will understand. + */ + cygwin_conv_to_win32_path(Tcl_DStringValue(headPtr), winbuf); + Tcl_DStringFree(headPtr); + Tcl_DStringAppend(headPtr, winbuf, -1); + + } +#endif /* __CYGWIN__ && __WIN32__ */ + if (*name == ':') { Tcl_DStringAppend(headPtr, ":", 1); if (count > 1) { |