Diff
Not logged in

Differences From Artifact [24bbcfa528]:

To Artifact [24195b820e]:


12
13
14
15
16
17
18

19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26







+







 * Copyright © 2001-2004 Vincent Darley.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tclInt.h"
#include "tclIO.h"
#ifdef _WIN32
#   include "tclWinInt.h"
#endif
#include "tclFileSystem.h"

#ifdef TCL_TEMPLOAD_NO_UNLINK
#ifndef NO_FSTATFS
1601
1602
1603
1604
1605
1606
1607
1608

1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620

1621
1622
1623
1624
1625

1626
1627
1628
1629
1630

1631
1632
1633

1634
1635
1636
1637
1638
1639
1640
1602
1603
1604
1605
1606
1607
1608

1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620

1621
1622
1623
1624
1625

1626
1627
1628
1629
1630

1631
1632
1633

1634
1635
1636
1637
1638
1639
1640
1641







-
+











-
+




-
+




-
+


-
+







	    Tcl_Free((void *)modeArgv);
	    return -1;
#endif

	} else if ((c == 'T') && (strcmp(flag, "TRUNC") == 0)) {
	    mode |= O_TRUNC;
	} else if ((c == 'T') && (strcmp(flag, "TCL8") == 0)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|2)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|CHANNEL_RAW_MODE)) {
	    invAccess:
		if (interp != NULL) {
		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
				"invalid access mode \"%s\": modes BINARY, "
				"REPLACE, STRICT, and TCL8 cannot be combined", modeString));
		}
		Tcl_Free((void *)modeArgv);
		return -1;
	    }
	    *flagPtr |= TCL_ENCODING_PROFILE_TCL8;
	} else if ((c == 'S') && (strcmp(flag, "STRICT") == 0)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|2)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|CHANNEL_RAW_MODE)) {
		goto invAccess;
	    }
	    *flagPtr |= TCL_ENCODING_PROFILE_STRICT;
	} else if ((c == 'R') && (strcmp(flag, "REPLACE") == 0)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|2)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|CHANNEL_RAW_MODE)) {
		goto invAccess;
	    }
	    *flagPtr |= TCL_ENCODING_PROFILE_REPLACE;
	} else if ((c == 'B') && (strcmp(flag, "BINARY") == 0)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|2)) {
	    if (*flagPtr & (ENCODING_PROFILE_MASK|CHANNEL_RAW_MODE)) {
		goto invAccess;
	    }
	    *flagPtr |= 2;
	    *flagPtr |= CHANNEL_RAW_MODE;
	} else {
	    if (interp != NULL) {
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"invalid access mode \"%s\": must be APPEND, BINARY, "
			"CREAT, EXCL, NOCTTY, NONBLOCK, RDWR, RDONLY, REPLACE, "
			"STRICT, TCL8, TRUNC, or WRONLY", flag));
	    }
2254
2255
2256
2257
2258
2259
2260
2261

2262
2263

2264
2265

2266
2267
2268
2269
2270
2271
2272
2255
2256
2257
2258
2259
2260
2261

2262
2263

2264
2265

2266
2267
2268
2269
2270
2271
2272
2273







-
+

-
+

-
+







		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"could not seek to end of file while opening \"%s\": %s",
			TclGetString(pathPtr), Tcl_PosixError(interp)));
	    }
	    Tcl_CloseEx(NULL, retVal, 0);
	    return NULL;
	}
	if (flags & 2) {
	if (flags & CHANNEL_RAW_MODE) {
	    Tcl_SetChannelOption(interp, retVal, "-translation", "binary");
	} else if ((flags & ENCODING_PROFILE_MASK) == TCL_ENCODING_PROFILE_TCL8) {
	} else if (ENCODING_PROFILE_GET(flags) == TCL_ENCODING_PROFILE_TCL8) {
	    Tcl_SetChannelOption(interp, retVal, "-profile", "tcl8");
	} else if ((flags & ENCODING_PROFILE_MASK) == TCL_ENCODING_PROFILE_REPLACE) {
	} else if (ENCODING_PROFILE_GET(flags) == TCL_ENCODING_PROFILE_REPLACE) {
	    Tcl_SetChannelOption(interp, retVal, "-profile", "replace");
	}
	return retVal;
    }

    /*
     * File doesn't belong to any filesystem that can open it.