summaryrefslogtreecommitdiffstats
path: root/generic/tclIOUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIOUtil.c')
-rw-r--r--generic/tclIOUtil.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index dc49a50..a8401f7 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.139 2007/02/19 23:50:28 hobbs Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.140 2007/02/20 23:24:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -32,9 +32,9 @@
static FilesystemRecord*FsGetFirstFilesystem(void);
static void FsThrExitProc(ClientData cd);
-static Tcl_Obj * FsListMounts(Tcl_Obj *pathPtr, CONST char *pattern);
+static Tcl_Obj * FsListMounts(Tcl_Obj *pathPtr, const char *pattern);
static void FsAddMountsToGlobResult(Tcl_Obj *resultPtr,
- Tcl_Obj *pathPtr, CONST char *pattern,
+ Tcl_Obj *pathPtr, const char *pattern,
Tcl_GlobTypeData *types);
static void FsUpdateCwd(Tcl_Obj *cwdObj, ClientData clientData);
@@ -49,8 +49,8 @@ static void FsRecacheFilesystemList(void);
* they are not (and should not be) used anywhere else.
*/
-MODULE_SCOPE CONST char * tclpFileAttrStrings[];
-MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[];
+MODULE_SCOPE const char * tclpFileAttrStrings[];
+MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
/*
* The following functions are obsolete string based APIs, and should be
@@ -61,7 +61,7 @@ MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[];
/* Obsolete */
int
Tcl_Stat(
- CONST char *path, /* Path of file to stat (in current CP). */
+ const char *path, /* Path of file to stat (in current CP). */
struct stat *oldStyleBuf) /* Filled with results of stat call. */
{
int ret;
@@ -147,7 +147,7 @@ Tcl_Stat(
/* Obsolete */
int
Tcl_Access(
- CONST char *path, /* Path of file to access (in current CP). */
+ const char *path, /* Path of file to access (in current CP). */
int mode) /* Permission setting. */
{
int ret;
@@ -165,8 +165,8 @@ Tcl_Channel
Tcl_OpenFileChannel(
Tcl_Interp *interp, /* Interpreter for error reporting; can be
* NULL. */
- CONST char *path, /* Name of file to open. */
- CONST char *modeString, /* A list of POSIX open modes or a string such
+ const char *path, /* Name of file to open. */
+ const char *modeString, /* A list of POSIX open modes or a string such
* as "rw". */
int permissions) /* If the open involves creating a file, with
* what modes to create it? */
@@ -184,7 +184,7 @@ Tcl_OpenFileChannel(
/* Obsolete */
int
Tcl_Chdir(
- CONST char *dirName)
+ const char *dirName)
{
int ret;
Tcl_Obj *pathPtr = Tcl_NewStringObj(dirName,-1);
@@ -216,7 +216,7 @@ Tcl_GetCwd(
int
Tcl_EvalFile(
Tcl_Interp *interp, /* Interpreter in which to process file. */
- CONST char *fileName) /* Name of file to process. Tilde-substitution
+ const char *fileName) /* Name of file to process. Tilde-substitution
* will be performed on this name. */
{
int ret;
@@ -449,7 +449,7 @@ typedef struct FsDivertLoad {
Tcl_LoadHandle loadHandle;
Tcl_FSUnloadFileProc *unloadProcPtr;
Tcl_Obj *divertedFile;
- Tcl_Filesystem *divertedFilesystem;
+ const Tcl_Filesystem *divertedFilesystem;
ClientData divertedFileNativeRep;
} FsDivertLoad;
@@ -567,7 +567,7 @@ TclFSCwdPointerEquals(
return 1;
} else {
int len1, len2;
- CONST char *str1, *str2;
+ const char *str1, *str2;
str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1);
str2 = Tcl_GetStringFromObj(*pathPtrPtr, &len2);
@@ -1064,12 +1064,12 @@ Tcl_FSMatchInDirectory(
* may be NULL. */
Tcl_Obj *resultPtr, /* List object to receive results. */
Tcl_Obj *pathPtr, /* Contains path to directory to search. */
- CONST char *pattern, /* Pattern to match against. */
+ const char *pattern, /* Pattern to match against. */
Tcl_GlobTypeData *types) /* Object containing list of acceptable types.
* May be NULL. In particular the directory
* flag is very important. */
{
- Tcl_Filesystem *fsPtr;
+ const Tcl_Filesystem *fsPtr;
Tcl_Obj *cwd, *tmpResultPtr, **elemsPtr;
int resLength, i, ret = -1;
@@ -1187,7 +1187,7 @@ FsAddMountsToGlobResult(
Tcl_Obj *resultPtr, /* The current list of matching paths; must
* not be shared! */
Tcl_Obj *pathPtr, /* The directory in question */
- CONST char *pattern, /* Pattern to match against. */
+ const char *pattern, /* Pattern to match against. */
Tcl_GlobTypeData *types) /* Object containing list of acceptable types.
* May be NULL. In particular the directory
* flag is very important. */
@@ -1232,8 +1232,8 @@ FsAddMountsToGlobResult(
}
if (!found && dir) {
int len, mlen;
- CONST char *path;
- CONST char *mount;
+ const char *path;
+ const char *mount;
Tcl_Obj *norm;
/*
@@ -1357,7 +1357,7 @@ Tcl_FSMountsChanged(
ClientData
Tcl_FSData(
- Tcl_Filesystem *fsPtr) /* The filesystem record to query. */
+ Tcl_Filesystem *fsPtr) /* The filesystem record to query. */
{
ClientData retVal = NULL;
FilesystemRecord *fsRecPtr = FsGetFirstFilesystem();
@@ -1488,7 +1488,7 @@ int
TclGetOpenMode(
Tcl_Interp *interp, /* Interpreter to use for error reporting -
* may be NULL. */
- CONST char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
+ const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
int *seekFlagPtr) /* Set this to 1 if the caller should seek to
* EOF during the opening of the file. */
{
@@ -1528,7 +1528,7 @@ int
TclGetOpenModeEx(
Tcl_Interp *interp, /* Interpreter to use for error reporting -
* may be NULL. */
- CONST char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
+ const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */
int *seekFlagPtr, /* Set this to 1 if the caller should seek to
* EOF during the opening of the file. */
int *binaryPtr) /* Set this to 1 if the caller should
@@ -1536,7 +1536,7 @@ TclGetOpenModeEx(
* operations */
{
int mode, modeArgc, c, i, gotRW;
- CONST char **modeArgv, *flag;
+ const char **modeArgv, *flag;
#define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR)
/*
@@ -1738,7 +1738,7 @@ Tcl_FSEvalFileEx(
Tcl_Interp *interp, /* Interpreter in which to process file. */
Tcl_Obj *pathPtr, /* Path of file to process. Tilde-substitution
* will be performed on this name. */
- CONST char *encodingName) /* If non-NULL, then use this encoding for the
+ const char *encodingName) /* If non-NULL, then use this encoding for the
* file. NULL means use the system encoding. */
{
int result, length;
@@ -1830,7 +1830,7 @@ Tcl_FSEvalFileEx(
* Record information telling where the error occurred.
*/
- CONST char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
+ const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
int limit = 150;
int overflow = (length > limit);
@@ -1912,12 +1912,12 @@ Tcl_SetErrno(
*----------------------------------------------------------------------
*/
-CONST char *
+const char *
Tcl_PosixError(
Tcl_Interp *interp) /* Interpreter whose errorCode field is to be
* set. */
{
- CONST char *id, *msg;
+ const char *id, *msg;
msg = Tcl_ErrnoMsg(errno);
id = Tcl_ErrnoId();
@@ -1951,7 +1951,7 @@ Tcl_FSStat(
Tcl_Obj *pathPtr, /* Path of file to stat (in current CP). */
Tcl_StatBuf *buf) /* Filled with results of stat call. */
{
- Tcl_Filesystem *fsPtr;
+ const Tcl_Filesystem *fsPtr;
#ifdef USE_OBSOLETE_FS_HOOKS
struct stat oldStyleStatBuffer;
int retVal = -1;
@@ -2044,7 +2044,7 @@ Tcl_FSLstat(
Tcl_Obj *pathPtr, /* Path of file to stat (in current CP). */
Tcl_StatBuf *buf) /* Filled with results of stat call. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSLstatProc *proc = fsPtr->lstatProc;
if (proc != NULL) {
@@ -2082,7 +2082,7 @@ Tcl_FSAccess(
Tcl_Obj *pathPtr, /* Path of file to access (in current CP). */
int mode) /* Permission setting. */
{
- Tcl_Filesystem *fsPtr;
+ const Tcl_Filesystem *fsPtr;
#ifdef USE_OBSOLETE_FS_HOOKS
int retVal = -1;
@@ -2154,12 +2154,12 @@ Tcl_FSOpenFileChannel(
Tcl_Interp *interp, /* Interpreter for error reporting; can be
* NULL. */
Tcl_Obj *pathPtr, /* Name of file to open. */
- CONST char *modeString, /* A list of POSIX open modes or a string such
+ const char *modeString, /* A list of POSIX open modes or a string such
* as "rw". */
int permissions) /* If the open involves creating a file, with
* what modes to create it? */
{
- Tcl_Filesystem *fsPtr;
+ const Tcl_Filesystem *fsPtr;
Tcl_Channel retVal = NULL;
#ifdef USE_OBSOLETE_FS_HOOKS
@@ -2287,7 +2287,7 @@ Tcl_FSUtime(
struct utimbuf *tval) /* Structure containing access/modification
* times to use. Should not be modified. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSUtimeProc *proc = fsPtr->utimeProc;
if (proc != NULL) {
@@ -2317,7 +2317,7 @@ Tcl_FSUtime(
*----------------------------------------------------------------------
*/
-static CONST char **
+static const char **
NativeFileAttrStrings(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
@@ -2411,12 +2411,12 @@ NativeFileAttrsSet(
*----------------------------------------------------------------------
*/
-CONST char **
+const char **
Tcl_FSFileAttrStrings(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSFileAttrStringsProc *proc = fsPtr->fileAttrStringsProc;
@@ -2449,11 +2449,11 @@ int
TclFSFileAttrIndex(
Tcl_Obj *pathPtr, /* File whose attributes are to be indexed
* into. */
- CONST char *attributeName, /* The attribute being looked for. */
+ const char *attributeName, /* The attribute being looked for. */
int *indexPtr) /* Where to write the found index. */
{
Tcl_Obj *listObj = NULL;
- CONST char **attrTable;
+ const char **attrTable;
/*
* Get the attribute table for the file.
@@ -2533,7 +2533,7 @@ Tcl_FSFileAttrsGet(
Tcl_Obj *pathPtr, /* filename we are operating on. */
Tcl_Obj **objPtrRef) /* for output. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSFileAttrsGetProc *proc = fsPtr->fileAttrsGetProc;
@@ -2570,7 +2570,7 @@ Tcl_FSFileAttrsSet(
Tcl_Obj *pathPtr, /* filename we are operating on. */
Tcl_Obj *objPtr) /* Input value. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSFileAttrsSetProc *proc = fsPtr->fileAttrsSetProc;
@@ -2726,7 +2726,7 @@ Tcl_FSGetCwd(
* the permissions on that directory have changed.
*/
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr);
/*
* If the filesystem couldn't be found, or if no cwd function exists
@@ -2859,7 +2859,7 @@ int
Tcl_FSChdir(
Tcl_Obj *pathPtr)
{
- Tcl_Filesystem *fsPtr;
+ const Tcl_Filesystem *fsPtr;
int retVal = -1;
if (Tcl_FSGetNormalizedPath(NULL, pathPtr) == NULL) {
@@ -3015,7 +3015,7 @@ Tcl_FSLoadFile(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code. */
- CONST char *sym1, CONST char *sym2,
+ const char *sym1, const char *sym2,
/* Names of two functions to look up in the
* file's symbol table. */
Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr,
@@ -3029,7 +3029,7 @@ Tcl_FSLoadFile(
* function which should be used for this
* file. */
{
- CONST char *symbols[2];
+ const char *symbols[2];
Tcl_PackageInitProc **procPtrs[2];
ClientData clientData;
int res;
@@ -3106,7 +3106,7 @@ TclLoadFile(
* code. */
int symc, /* Number of symbols/procPtrs in the next two
* arrays. */
- CONST char *symbols[], /* Names of functions to look up in the file's
+ const char *symbols[], /* Names of functions to look up in the file's
* symbol table. */
Tcl_PackageInitProc **procPtrs[],
/* Where to return the addresses corresponding
@@ -3122,7 +3122,7 @@ TclLoadFile(
* function which should be used for this
* file. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
Tcl_FSLoadFileProc *proc;
Tcl_Filesystem *copyFsPtr;
Tcl_Obj *copyToPtr;
@@ -3397,7 +3397,7 @@ TclpLoadFile(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
- CONST char *sym1, CONST char *sym2,
+ const char *sym1, CONST char *sym2,
/* Names of two functions to look up in the
* file's symbol table. */
Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr,
@@ -3564,7 +3564,7 @@ Tcl_FSLink(
Tcl_Obj *toPtr, /* NULL or path to be linked to */
int linkAction) /* Action to perform */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSLinkProc *proc = fsPtr->linkProc;
@@ -3665,7 +3665,7 @@ Tcl_FSListVolumes(void)
static Tcl_Obj *
FsListMounts(
Tcl_Obj *pathPtr, /* Contains path to directory to search. */
- CONST char *pattern) /* Pattern to match against. */
+ const char *pattern) /* Pattern to match against. */
{
FilesystemRecord *fsRecPtr;
Tcl_GlobTypeData mountsOnly = { TCL_GLOB_TYPE_MOUNT, 0, NULL, NULL };
@@ -3904,7 +3904,7 @@ TclGetPathType(
Tcl_PathType
TclFSNonnativePathType(
- CONST char *path, /* Path to determine type for */
+ const char *path, /* Path to determine type for */
int pathLen, /* Length of the path */
Tcl_Filesystem **filesystemPtrPtr,
/* If absolute path and this is not NULL, then
@@ -4036,7 +4036,7 @@ Tcl_FSRenameFile(
* (UTF-8). */
{
int retVal = -1;
- Tcl_Filesystem *fsPtr, *fsPtr2;
+ const Tcl_Filesystem *fsPtr, *fsPtr2;
fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr);
fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr);
@@ -4080,7 +4080,7 @@ Tcl_FSCopyFile(
Tcl_Obj *destPathPtr) /* Pathname of file to copy to (UTF-8). */
{
int retVal = -1;
- Tcl_Filesystem *fsPtr, *fsPtr2;
+ const Tcl_Filesystem *fsPtr, *fsPtr2;
fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr);
fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr);
@@ -4194,7 +4194,7 @@ int
Tcl_FSDeleteFile(
Tcl_Obj *pathPtr) /* Pathname of file to be removed (UTF-8). */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSDeleteFileProc *proc = fsPtr->deleteFileProc;
if (proc != NULL) {
@@ -4226,7 +4226,7 @@ int
Tcl_FSCreateDirectory(
Tcl_Obj *pathPtr) /* Pathname of directory to create (UTF-8). */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL) {
Tcl_FSCreateDirectoryProc *proc = fsPtr->createDirectoryProc;
if (proc != NULL) {
@@ -4265,7 +4265,7 @@ Tcl_FSCopyDirectory(
* error, with refCount 1. */
{
int retVal = -1;
- Tcl_Filesystem *fsPtr, *fsPtr2;
+ const Tcl_Filesystem *fsPtr, *fsPtr2;
fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr);
fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr);
@@ -4309,7 +4309,7 @@ Tcl_FSRemoveDirectory(
* object containing name of file causing
* error, with refCount 1. */
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr != NULL && fsPtr->removeDirectoryProc != NULL) {
Tcl_FSRemoveDirectoryProc *proc = fsPtr->removeDirectoryProc;
if (recursive) {
@@ -4462,11 +4462,11 @@ Tcl_FSGetFileSystemForPath(
*---------------------------------------------------------------------------
*/
-CONST char *
+const char *
Tcl_FSGetNativePath(
Tcl_Obj *pathPtr)
{
- return (CONST char *) Tcl_FSGetInternalRep(pathPtr, &tclNativeFilesystem);
+ return (const char *) Tcl_FSGetInternalRep(pathPtr, &tclNativeFilesystem);
}
/*
@@ -4516,7 +4516,7 @@ Tcl_FSFileSystemInfo(
{
Tcl_Obj *resPtr;
Tcl_FSFilesystemPathTypeProc *proc;
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr == NULL) {
return NULL;
@@ -4559,7 +4559,7 @@ Tcl_Obj *
Tcl_FSPathSeparator(
Tcl_Obj *pathPtr)
{
- Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
+ const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if (fsPtr == NULL) {
return NULL;
@@ -4597,7 +4597,7 @@ static Tcl_Obj *
NativeFilesystemSeparator(
Tcl_Obj *pathPtr)
{
- char *separator = NULL; /* lint */
+ const char *separator = NULL; /* lint */
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separator = "/";