Tcl Source Code

Check-in [5b384d430a]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:
Mac OS Classic specific fixes: * generic/tclIOUtil.c (TclNewFSPathObj): on TCL_PLATFORM_MAC, skip potential directory separator at the beginning of addStrRep. * mac/tclMacChan.c (OpenFileChannel, CommonWatch): followup fixes to cut and splice implementation for file channels. * mac/tclMacFile.c (TclpUtime): pass native path to utime(). * mac/tclMacFile.c (TclpObjLink): correctly implemented creation of alias files via new static proc CreateAliasFile(). * mac/tclMacPort.h: define S_ISLNK macro to fix stat'ing of links. * mac/tclMacUtil.c (FSpLocationFromPathAlias): fix to enable stat'ing of broken links.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core-8-4-2
Files: files | file ages | folders
SHA1: 5b384d430a594360e945f02e50b3338018bc6508
User & Date: das 2003-03-03 20:22:35
Context
2003-03-06
23:24
* generic/TclUtf.c (Tcl_UniCharNcasecmp): Corrected failure to * tests/utf.te...
check-in: 8003bbacd1 user: dgp tags: core-8-4-branch
2003-03-04
23:45
* README: Bumped version number of * generic/tcl.h: ...
check-in: a5f8f0d439 user: dgp tags: trunk
2003-03-03
20:22
Mac OS Classic specific fixes: * generic/tclIOUtil.c (TclNewFSPathObj): on TCL_PLATFORM_MAC, skip...
check-in: 5b384d430a user: das tags: trunk, core-8-4-2
20:04
mark Mar 3 date for 8.4.2 check-in: 41131d3163 user: hobbs tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2
3














4
5
6
7
8
9
10
2003-03-03  Jeff Hobbs  <[email protected]>

	*** 8.4.2 TAGGED FOR RELEASE ***















2003-03-03  Kevin Kenny  <[email protected]>

	* win/Makefile.vc: corrected bug introduced by 'g' for debug builds.
	
2003-03-03  Don Porter	<[email protected]>



>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2003-03-03  Jeff Hobbs  <[email protected]>

	*** 8.4.2 TAGGED FOR RELEASE ***

2003-03-03  Daniel Steffen  <[email protected]>

	Mac OS Classic specific fixes:
	* generic/tclIOUtil.c (TclNewFSPathObj): on TCL_PLATFORM_MAC,
	skip potential directory separator at the beginning of addStrRep.
	* mac/tclMacChan.c (OpenFileChannel, CommonWatch): followup
	fixes to cut and splice implementation for file channels.
	* mac/tclMacFile.c (TclpUtime): pass native path to utime().
	* mac/tclMacFile.c (TclpObjLink): correctly implemented creation
	of alias files via new static proc CreateAliasFile().
	* mac/tclMacPort.h: define S_ISLNK macro to fix stat'ing of links.
	* mac/tclMacUtil.c (FSpLocationFromPathAlias): fix to enable
	stat'ing of broken links.

2003-03-03  Kevin Kenny  <[email protected]>

	* win/Makefile.vc: corrected bug introduced by 'g' for debug builds.
	
2003-03-03  Don Porter	<[email protected]>

Changes to generic/tclIOUtil.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
....
4016
4017
4018
4019
4020
4021
4022












4023
4024
4025
4026
4027
4028
4029
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclIOUtil.c,v 1.76 2003/02/27 23:47:16 hobbs Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#ifdef MAC_TCL
#include "tclMacInt.h"
#endif
................................................................................
{
    FsPath *fsPathPtr;
    Tcl_Obj *objPtr;
    
    objPtr = Tcl_NewObj();
    fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath));
    












    /* Setup the path */
    fsPathPtr->translatedPathPtr = NULL;
    fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len);
    Tcl_IncrRefCount(fsPathPtr->normPathPtr);
    fsPathPtr->cwdPtr = dirPtr;
    Tcl_IncrRefCount(dirPtr);
    fsPathPtr->flags = TCLPATH_RELATIVE | TCLPATH_APPENDED;






|







 







>
>
>
>
>
>
>
>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
....
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclIOUtil.c,v 1.77 2003/03/03 20:22:41 das Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#ifdef MAC_TCL
#include "tclMacInt.h"
#endif
................................................................................
{
    FsPath *fsPathPtr;
    Tcl_Obj *objPtr;
    
    objPtr = Tcl_NewObj();
    fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath));
    
    if (tclPlatform == TCL_PLATFORM_MAC) {
	/* 
	 * Mac relative paths may begin with a directory separator ':'.
	 * If present, we need to skip this ':' because we assume that
	 * we can join dirPtr and addStrRep by concatenating them as
	 * strings (and we ensure that dirPtr is terminated by a ':').
	 */
	if (addStrRep[0] == ':') {
	    addStrRep++;
	    len--;
	}
    }
    /* Setup the path */
    fsPathPtr->translatedPathPtr = NULL;
    fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len);
    Tcl_IncrRefCount(fsPathPtr->normPathPtr);
    fsPathPtr->cwdPtr = dirPtr;
    Tcl_IncrRefCount(dirPtr);
    fsPathPtr->flags = TCLPATH_RELATIVE | TCLPATH_APPENDED;

Changes to mac/tclMacChan.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
797
798
799
800
801
802
803

804


805
806
807
808
809
810
811
...
870
871
872
873
874
875
876


877
878
879
880
881
882
883
....
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225

1226
1227
1228
1229
1230
1231
1232
 *	console fds.
 *
 * Copyright (c) 1996-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacChan.c,v 1.20 2003/02/21 20:11:35 das Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclMacInt.h"
#include <Aliases.h>
#include <Errors.h>
................................................................................
    Tcl_Channel chan;
    char macPermision;
    FSSpec fileSpec;
    OSErr err;
    short fileRef;
    FileState *fileState;
    char channelName[16 + TCL_INTEGER_SPACE];

    


    /*
     * Note we use fsRdWrShPerm instead of fsRdWrPerm which allows shared
     * writes on a file.  This isn't common on a mac but is common with 
     * Windows and UNIX and the feature is used by Tcl.
     */

    switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) {
................................................................................
	Tcl_SetErrno(errno);
	FSClose(fileRef);
	ckfree((char *) fileState);
        return NULL;
    }

    fileState->fileChan = chan;


    fileState->volumeRef = fileSpec.vRefNum;
    fileState->fileRef = fileRef;
    fileState->pending = 0;
    fileState->watchMask = 0;
    if (mode & O_APPEND) {
	fileState->appendMode = true;
    } else {
................................................................................
static void
CommonWatch(
    ClientData instanceData,		/* The file state. */
    int mask)				/* Events of interest; an OR-ed
                                         * combination of TCL_READABLE,
                                         * TCL_WRITABLE and TCL_EXCEPTION. */
{
    FileState **nextPtrPtr, *ptr;
    FileState *infoPtr = (FileState *) instanceData;
    int oldMask = infoPtr->watchMask;
    ThreadSpecificData *tsdPtr;


    tsdPtr = FileInit();

    infoPtr->watchMask = mask;
    if (infoPtr->watchMask) {
	if (!oldMask) {
	    infoPtr->nextPtr = tsdPtr->firstFilePtr;
	    tsdPtr->firstFilePtr = infoPtr;
	}
    } else {
	if (oldMask) {
	    /*
	     * Remove the file from the list of watched files.
	     */

	    for (nextPtrPtr = &(tsdPtr->firstFilePtr), ptr = *nextPtrPtr;
		 ptr != NULL;
		 nextPtrPtr = &ptr->nextPtr, ptr = *nextPtrPtr) {
		if (infoPtr == ptr) {
		    *nextPtrPtr = ptr->nextPtr;
		    break;
		}
	    }
	}

    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclpCutFileChannel --






|







 







>

>
>







 







>
>







 







<

<
<
>

<
<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
...
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
....
1196
1197
1198
1199
1200
1201
1202

1203


1204
1205


1206
1207



















1208
1209
1210
1211
1212
1213
1214
1215
 *	console fds.
 *
 * Copyright (c) 1996-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacChan.c,v 1.21 2003/03/03 20:22:42 das Exp $
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclMacInt.h"
#include <Aliases.h>
#include <Errors.h>
................................................................................
    Tcl_Channel chan;
    char macPermision;
    FSSpec fileSpec;
    OSErr err;
    short fileRef;
    FileState *fileState;
    char channelName[16 + TCL_INTEGER_SPACE];
    ThreadSpecificData *tsdPtr;
    
    tsdPtr = FileInit();

    /*
     * Note we use fsRdWrShPerm instead of fsRdWrPerm which allows shared
     * writes on a file.  This isn't common on a mac but is common with 
     * Windows and UNIX and the feature is used by Tcl.
     */

    switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) {
................................................................................
	Tcl_SetErrno(errno);
	FSClose(fileRef);
	ckfree((char *) fileState);
        return NULL;
    }

    fileState->fileChan = chan;
    fileState->nextPtr = tsdPtr->firstFilePtr;
    tsdPtr->firstFilePtr = fileState;
    fileState->volumeRef = fileSpec.vRefNum;
    fileState->fileRef = fileRef;
    fileState->pending = 0;
    fileState->watchMask = 0;
    if (mode & O_APPEND) {
	fileState->appendMode = true;
    } else {
................................................................................
static void
CommonWatch(
    ClientData instanceData,		/* The file state. */
    int mask)				/* Events of interest; an OR-ed
                                         * combination of TCL_READABLE,
                                         * TCL_WRITABLE and TCL_EXCEPTION. */
{

    FileState *infoPtr = (FileState *) instanceData;


    Tcl_Time blockTime = { 0, 0 };



    infoPtr->watchMask = mask;
    if (infoPtr->watchMask) {



















	Tcl_SetMaxBlockTime(&blockTime);
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TclpCutFileChannel --

Changes to mac/tclMacFile.c.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


26
27
28
29
30
31
32
..
33
34
35
36
37
38
39


40
41
42
43
44
45
46
....
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
....
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271







































































 *	functions that deal with the file system.
 *
 * Copyright (c) 1995-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacFile.c,v 1.26 2003/01/09 10:38:29 vincentdarley Exp $
 */

/*
 * Note: This code eventually needs to support async I/O.  In doing this
 * we will need to keep track of all current async I/O.  If exit to shell
 * is called - we shouldn't exit until all asyc I/O completes.
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclMacInt.h"
#include <Aliases.h>


#include <Errors.h>
#include <Processes.h>
#include <Strings.h>
#include <Types.h>
#include <MoreFiles.h>
#include <MoreFilesExtras.h>
#include <FSpCompat.h>
................................................................................

static int NativeMatchType(Tcl_Obj *tempName, Tcl_GlobTypeData *types, 
			   HFileInfo fileInfo, OSType okType, OSType okCreator);
static OSErr FspLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, 
						FSSpec* specPtr));
static OSErr FspLLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, 
						FSSpec* specPtr));



static OSErr 
FspLocationFromFsPath(pathPtr, specPtr)
    Tcl_Obj *pathPtr;
    FSSpec* specPtr;
{
    CONST char *native = Tcl_FSGetNativePath(pathPtr);
................................................................................

	if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
	    /* Needs to create a new link */
	    FSSpec spec;
	    FSSpec linkSpec;
	    OSErr err;
	    CONST char *path;
	    AliasHandle alias;
	    
	    err = FspLocationFromFsPath(toPtr, &spec);
	    if (err != noErr) {
		errno = ENOENT;
		return NULL;
	    }

	    path = Tcl_FSGetNativePath(pathPtr);
	    err = FSpLocationFromPath(strlen(path), path, &linkSpec);
	    if (err == noErr) {
		err = dupFNErr;		/* EEXIST. */
	    } else {
		err = NewAlias(&spec, &linkSpec, &alias);
	    }
	    if (err != noErr) {
		errno = TclMacOSErrorToPosixError(err);
		return NULL;
	    }
	    return toPtr;
	} else {
................................................................................
    Tcl_Obj *pathPtr;      /* File to modify */
    struct utimbuf *tval;  /* New modification date structure */
{
    long gmt_offset=TclpGetGMTOffset();
    struct utimbuf local_tval;
    local_tval.actime=tval->actime+gmt_offset;
    local_tval.modtime=tval->modtime+gmt_offset;
    return utime(Tcl_GetString(Tcl_FSGetNormalizedPath(NULL,pathPtr)),
		 &local_tval);
}














































































|












>
>







 







>
>







 







<












|







 







|


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
....
1173
1174
1175
1176
1177
1178
1179

1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
....
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
 *	functions that deal with the file system.
 *
 * Copyright (c) 1995-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacFile.c,v 1.27 2003/03/03 20:22:43 das Exp $
 */

/*
 * Note: This code eventually needs to support async I/O.  In doing this
 * we will need to keep track of all current async I/O.  If exit to shell
 * is called - we shouldn't exit until all asyc I/O completes.
 */

#include "tclInt.h"
#include "tclPort.h"
#include "tclMacInt.h"
#include <Aliases.h>
#include <Resources.h>
#include <Files.h>
#include <Errors.h>
#include <Processes.h>
#include <Strings.h>
#include <Types.h>
#include <MoreFiles.h>
#include <MoreFilesExtras.h>
#include <FSpCompat.h>
................................................................................

static int NativeMatchType(Tcl_Obj *tempName, Tcl_GlobTypeData *types, 
			   HFileInfo fileInfo, OSType okType, OSType okCreator);
static OSErr FspLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, 
						FSSpec* specPtr));
static OSErr FspLLocationFromFsPath _ANSI_ARGS_((Tcl_Obj *pathPtr, 
						FSSpec* specPtr));

static OSErr CreateAliasFile _ANSI_ARGS_((FSSpec *theAliasFile, FSSpec *targetFile));

static OSErr 
FspLocationFromFsPath(pathPtr, specPtr)
    Tcl_Obj *pathPtr;
    FSSpec* specPtr;
{
    CONST char *native = Tcl_FSGetNativePath(pathPtr);
................................................................................

	if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
	    /* Needs to create a new link */
	    FSSpec spec;
	    FSSpec linkSpec;
	    OSErr err;
	    CONST char *path;

	    
	    err = FspLocationFromFsPath(toPtr, &spec);
	    if (err != noErr) {
		errno = ENOENT;
		return NULL;
	    }

	    path = Tcl_FSGetNativePath(pathPtr);
	    err = FSpLocationFromPath(strlen(path), path, &linkSpec);
	    if (err == noErr) {
		err = dupFNErr;		/* EEXIST. */
	    } else {
		err = CreateAliasFile(&linkSpec, &spec);
	    }
	    if (err != noErr) {
		errno = TclMacOSErrorToPosixError(err);
		return NULL;
	    }
	    return toPtr;
	} else {
................................................................................
    Tcl_Obj *pathPtr;      /* File to modify */
    struct utimbuf *tval;  /* New modification date structure */
{
    long gmt_offset=TclpGetGMTOffset();
    struct utimbuf local_tval;
    local_tval.actime=tval->actime+gmt_offset;
    local_tval.modtime=tval->modtime+gmt_offset;
    return utime(Tcl_FSGetNativePath(Tcl_FSGetNormalizedPath(NULL,pathPtr)),
		 &local_tval);
}
 
/*
 *---------------------------------------------------------------------------
 *
 * CreateAliasFile --
 *
 *	Creates an alias file located at aliasDest referring to the targetFile.
 *
 * Results:
 *	0 on success, OS error code on error.
 *
 * Side effects:
 *	None.
 *
 *---------------------------------------------------------------------------
 */
static OSErr
CreateAliasFile(FSSpec *theAliasFile, FSSpec *targetFile)
{
    CInfoPBRec cat;
    FInfo fndrInfo;
    AliasHandle theAlias;
    short saveRef, rsrc = -1;
    OSErr err;
    
    saveRef = CurResFile();
    /* set up the Finder information record for the alias file */
    cat.dirInfo.ioNamePtr = targetFile->name;
    cat.dirInfo.ioVRefNum = targetFile->vRefNum;
    cat.dirInfo.ioFDirIndex = 0;
    cat.dirInfo.ioDrDirID = targetFile->parID;
    err = PBGetCatInfoSync(&cat);
    if (err != noErr) goto bail;
    if ((cat.dirInfo.ioFlAttrib & 16) == 0) {
        /* file alias */
        switch (cat.hFileInfo.ioFlFndrInfo.fdType) {
            case 'APPL': fndrInfo.fdType = kApplicationAliasType; break;
            case 'APPC': fndrInfo.fdType = kApplicationCPAliasType; break;
            case 'APPD': fndrInfo.fdType = kApplicationDAAliasType; break;
            default: fndrInfo.fdType = cat.hFileInfo.ioFlFndrInfo.fdType; break;
        }
        fndrInfo.fdCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
    } else {
        /* folder alias */
        fndrInfo.fdType = kContainerFolderAliasType;
        fndrInfo.fdCreator = 'MACS';
    }
    fndrInfo.fdFlags = kIsAlias;
    fndrInfo.fdLocation.v = 0;
    fndrInfo.fdLocation.h = 0;
    fndrInfo.fdFldr = 0;
    /* create new file and set the file information */
    FSpCreateResFile( theAliasFile, fndrInfo.fdCreator, fndrInfo.fdType, smSystemScript);
    if ((err = ResError()) != noErr) goto bail;
    err = FSpSetFInfo( theAliasFile, &fndrInfo);
    if (err != noErr) goto bail;
    /* save the alias resource */
    rsrc = FSpOpenResFile(theAliasFile, fsRdWrPerm);
    if (rsrc == -1) { err = ResError(); goto bail; }
    UseResFile(rsrc);
    err = NewAlias(theAliasFile, targetFile, &theAlias);
    if (err != noErr) goto bail;
    AddResource((Handle) theAlias, rAliasType, 0, theAliasFile->name);
    if ((err = ResError()) != noErr) goto bail;
    CloseResFile(rsrc);
    rsrc = -1;
    /* done */
 bail:
    if (rsrc != -1) CloseResFile(rsrc);
    UseResFile(saveRef);
    return err;
}

Changes to mac/tclMacPort.h.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
72
73
74
75
76
77
78




79
80
81
82
83
84
85
 *	file that contains #ifdefs to handle different flavors of OS.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacPort.h,v 1.16 2002/10/09 11:54:34 das Exp $
 */


#ifndef _MACPORT
#define _MACPORT

#ifndef _TCLINT
................................................................................
#   define F_OK			0	/* test for existence of file */
#   define X_OK			0x01	/* test for execute or search permission */
#   define W_OK			0x02	/* test for write permission */
#   define R_OK			0x04	/* test for read permission */
#endif

#endif	/* __MWERKS__ */





/*
 * Many signals are not supported on the Mac and are thus not defined in
 * <signal.h>.  They are defined here so that Tcl will compile with less
 * modification.
  */







|







 







>
>
>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 *	file that contains #ifdefs to handle different flavors of OS.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacPort.h,v 1.17 2003/03/03 20:22:44 das Exp $
 */


#ifndef _MACPORT
#define _MACPORT

#ifndef _TCLINT
................................................................................
#   define F_OK			0	/* test for existence of file */
#   define X_OK			0x01	/* test for execute or search permission */
#   define W_OK			0x02	/* test for write permission */
#   define R_OK			0x04	/* test for read permission */
#endif

#endif	/* __MWERKS__ */

#if defined(S_IFBLK) && !defined(S_ISLNK)
#define S_ISLNK(m)	(((m)&(S_IFMT)) == (S_IFLNK))
#endif

/*
 * Many signals are not supported on the Mac and are thus not defined in
 * <signal.h>.  They are defined here so that Tcl will compile with less
 * modification.
  */

Changes to mac/tclMacUtil.c.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
318
319
320
321
322
323
324
325




326
327
328
329
330
331
332
 *
 * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacUtil.c,v 1.6 2002/04/19 14:18:55 das Exp $
 */

#include "tcl.h"
#include "tclInt.h"
#include "tclMacInt.h"
#include "tclMath.h"
#include "tclMacPort.h"
................................................................................
	    strncpy((char *) fileName + 1, &path[cur], pos - cur);
	    fileName[0] = pos - cur;
	}
	err = FSMakeFSSpecCompat(vRefNum, dirID, fileName, fileSpecPtr);
	if (err != noErr) return err;
	lastFileSpec=*fileSpecPtr;
	err = ResolveAliasFile(fileSpecPtr, true, &isDirectory, &wasAlias);
	if (err != noErr) return err;




	FSpGetDirectoryID(fileSpecPtr, &dirID, &isDirectory);
	vRefNum = fileSpecPtr->vRefNum;
	cur = pos;
	if (path[cur] == ':') {
	    cur++;
	}
    }






|







 







|
>
>
>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
 *
 * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclMacUtil.c,v 1.7 2003/03/03 20:22:44 das Exp $
 */

#include "tcl.h"
#include "tclInt.h"
#include "tclMacInt.h"
#include "tclMath.h"
#include "tclMacPort.h"
................................................................................
	    strncpy((char *) fileName + 1, &path[cur], pos - cur);
	    fileName[0] = pos - cur;
	}
	err = FSMakeFSSpecCompat(vRefNum, dirID, fileName, fileSpecPtr);
	if (err != noErr) return err;
	lastFileSpec=*fileSpecPtr;
	err = ResolveAliasFile(fileSpecPtr, true, &isDirectory, &wasAlias);
	if (err != noErr) {
	    /* ignore alias resolve errors on last path component */
	    if (pos < length) return err;
	    else *fileSpecPtr=lastFileSpec;
	}
	FSpGetDirectoryID(fileSpecPtr, &dirID, &isDirectory);
	vRefNum = fileSpecPtr->vRefNum;
	cur = pos;
	if (path[cur] == ':') {
	    cur++;
	}
    }