From 095d33883b3a4b3d586f2c39679ca943b7e344e4 Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Mon, 8 Jul 2002 10:11:22 +0000 Subject: fs cleanup --- ChangeLog | 11 +++++++++++ doc/FileSystem.3 | 27 ++++++++++++++------------- generic/tclIOUtil.c | 4 ++-- generic/tclTest.c | 4 ++-- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index c486328..4d2096d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,17 @@ * tests/fCmd.test: * tests/fileName.test: tests which rely on 'file link' need a constraint so they don't run on older Windows OS. [Bug 578158] + * generic/tclIOUtil.c: + * generic/tcl.h: + * generic/tclInt.h: + * generic/tclTest.c: + * mac/tclMacChan.c: + * unix/tclUnixChan.c: + * win/tclWinChan.c: + * doc/FileSystem.3: cleaned up internal handling of + Tcl_FSOpenFileChannel to remove duplicate code, and make + writing external vfs's clearer and easier. No + functionality change. 2002-07-06 Don Porter diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index 6a7d2ff..0161dba 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: FileSystem.3,v 1.27 2002/07/01 18:24:39 jenglish Exp $ +'\" RCS: @(#) $Id: FileSystem.3,v 1.28 2002/07/08 10:14:24 vincentdarley Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" @@ -432,10 +432,10 @@ the file. This API is modeled after the \fBfopen\fR procedure of the Unix standard I/O library. The syntax and meaning of all arguments is similar to those given in the Tcl \fBopen\fR command when opening a file. -If an error occurs while opening the channel, \fBTcl_OpenFileChannel\fR +If an error occurs while opening the channel, \fBTcl_FSOpenFileChannel\fR returns NULL and records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. -In addition, if \fIinterp\fR is non-NULL, \fBTcl_OpenFileChannel\fR +In addition, if \fIinterp\fR is non-NULL, \fBTcl_FSOpenFileChannel\fR leaves an error message in \fIinterp\fR's result after any error. .PP The newly created channel is not registered in the supplied interpreter; to @@ -953,21 +953,22 @@ which require open or accessing a file's contents will use it typedef Tcl_Channel Tcl_FSOpenFileChannelProc( Tcl_Interp *\fIinterp\fR, Tcl_Obj *\fIpathPtr\fR, - CONST char *\fImodeString\fR, + int \fImode\fR, int \fIpermissions\fR); .CE .PP The \fBTcl_FSOpenFileChannelProc\fR opens a file specified by \fIpathPtr\fR and returns a channel handle that can be used to perform -input and output on the file. This API is modeled after the -\fBfopen\fR procedure of the Unix standard I/O library. The syntax and -meaning of all arguments is similar to those given in the Tcl -\fBopen\fR command when opening a file. If an error occurs while -opening the channel, the \fBTcl_FSOpenFileChannelProc\fR returns NULL -and records a POSIX error code that can be retrieved with -\fBTcl_GetErrno\fR. In addition, if \fIinterp\fR is non-NULL, the -\fBTcl_FSOpenFileChannelProc\fR leaves an error message in -\fIinterp\fR's result after any error. +input and output on the file. This API is modeled after the \fBfopen\fR +procedure of the Unix standard I/O library. The syntax and meaning of +all arguments is similar to those given in the Tcl \fBopen\fR command +when opening a file, where the \fImode\fR argument is a combination of +the POSIX flags O_RDONLY, O_WRONLY, etc. If an error occurs while +opening the channel, the \fBTcl_FSOpenFileChannelProc\fR returns NULL and +records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. +In addition, if \fIinterp\fR is non-NULL, the +\fBTcl_FSOpenFileChannelProc\fR leaves an error message in \fIinterp\fR's +result after any error. .PP The newly created channel is not registered in the supplied interpreter; to register it, use \fBTcl_RegisterChannel\fR. If one of diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 37d9071..d779b5c 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * 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.52 2002/07/08 10:08:57 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.53 2002/07/08 10:11:22 vincentdarley Exp $ */ #include "tclInt.h" @@ -1727,7 +1727,7 @@ Tcl_FSOpenFileChannel(interp, pathPtr, modeString, permissions) if (retVal != NULL) { if (seekFlag) { if (Tcl_Seek(retVal, (Tcl_WideInt)0, - (Tcl_WideInt)SEEK_END) < (Tcl_WideInt)0) { + SEEK_END) < (Tcl_WideInt)0) { if (interp != (Tcl_Interp *) NULL) { Tcl_AppendResult(interp, "could not seek to end of file while opening \"", diff --git a/generic/tclTest.c b/generic/tclTest.c index 9f56bba..1928dc7 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.53 2002/07/08 10:08:58 vincentdarley Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.54 2002/07/08 10:11:22 vincentdarley Exp $ */ #define TCL_TEST @@ -4785,7 +4785,7 @@ PretendTclpOpenFileChannel(interp, fileName, modeString, permissions) Tcl_DecrRefCount(pathPtr); if (ret != NULL) { if (seekFlag) { - if (Tcl_Seek(ret, 0, SEEK_END) < 0) { + if (Tcl_Seek(ret, (Tcl_WideInt)0, SEEK_END) < (Tcl_WideInt)0) { if (interp != (Tcl_Interp *) NULL) { Tcl_AppendResult(interp, "could not seek to end of file while opening \"", -- cgit v0.12