summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhershey <hershey>1999-04-17 00:32:27 (GMT)
committerhershey <hershey>1999-04-17 00:32:27 (GMT)
commit099c93d0b49e614cfeffec26211d60d95235e2bf (patch)
treed397aeef664656316cd9691f280f0a3560670008
parent7ef335cb1b504d531a013d66e510b8c2d48945cc (diff)
downloadtcl-099c93d0b49e614cfeffec26211d60d95235e2bf.zip
tcl-099c93d0b49e614cfeffec26211d60d95235e2bf.tar.gz
tcl-099c93d0b49e614cfeffec26211d60d95235e2bf.tar.bz2
changes make Tcl_Access and Tcl_Stat public.
also one minor fix in tests/all.tcl to fix bug 1770.
-rw-r--r--generic/tcl.decls8
-rw-r--r--generic/tcl.h9
-rw-r--r--generic/tclDecls.h17
-rw-r--r--generic/tclIOUtil.c4
-rw-r--r--generic/tclInt.decls4
-rw-r--r--generic/tclInt.h7
-rw-r--r--generic/tclIntDecls.h8
-rw-r--r--generic/tclStubInit.c4
-rw-r--r--generic/tclTest.c14
-rw-r--r--generic/tclUtil.c49
-rw-r--r--tests/all.tcl4
11 files changed, 102 insertions, 26 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 671f5ff..b7f87d7 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -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: tcl.decls,v 1.8 1999/04/16 00:46:41 stanton Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.9 1999/04/17 00:32:27 hershey Exp $
library tcl
@@ -1250,6 +1250,12 @@ declare 365 generic {
declare 366 generic {
int Tcl_Chdir(CONST char *dirName)
}
+declare 367 generic {
+ int Tcl_Access(CONST char *path, int mode)
+}
+declare 368 generic {
+ int Tcl_Stat(CONST char *path, struct stat *bufPtr)
+}
##############################################################################
diff --git a/generic/tcl.h b/generic/tcl.h
index 2a8be54..65e5570 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.39 1999/04/16 00:46:42 stanton Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.40 1999/04/17 00:32:27 hershey Exp $
*/
#ifndef _TCL
@@ -365,6 +365,13 @@ typedef struct Tcl_Trace_ *Tcl_Trace;
typedef struct Tcl_Var_ *Tcl_Var;
/*
+ * Picky compilers complain if this typdef doesn't appear before the
+ * struct's reference in tclDecls.h.
+ */
+
+typedef struct stat *Tcl_Stat_;
+
+/*
* When a TCL command returns, the interpreter contains a result from the
* command. Programmers are strongly encouraged to use one of the
* procedures Tcl_GetObjResult() or Tcl_GetStringResult() to read the
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index f07ff56..78730df 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDecls.h,v 1.7 1999/04/16 00:46:45 stanton Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.8 1999/04/17 00:32:28 hershey Exp $
*/
#ifndef _TCLDECLS
@@ -1118,6 +1118,11 @@ EXTERN char * Tcl_GetCwd _ANSI_ARGS_((Tcl_Interp * interp,
Tcl_DString * cwdPtr));
/* 366 */
EXTERN int Tcl_Chdir _ANSI_ARGS_((CONST char * dirName));
+/* 367 */
+EXTERN int Tcl_Access _ANSI_ARGS_((CONST char * path, int mode));
+/* 368 */
+EXTERN int Tcl_Stat _ANSI_ARGS_((CONST char * path,
+ struct stat * bufPtr));
typedef struct TclStubHooks {
struct TclPlatStubs *tclPlatStubs;
@@ -1520,6 +1525,8 @@ typedef struct TclStubs {
int (*tcl_ParseVarName) _ANSI_ARGS_((Tcl_Interp * interp, char * string, int numBytes, Tcl_Parse * parsePtr, int append)); /* 364 */
char * (*tcl_GetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 365 */
int (*tcl_Chdir) _ANSI_ARGS_((CONST char * dirName)); /* 366 */
+ int (*tcl_Access) _ANSI_ARGS_((CONST char * path, int mode)); /* 367 */
+ int (*tcl_Stat) _ANSI_ARGS_((CONST char * path, struct stat * bufPtr)); /* 368 */
} TclStubs;
extern TclStubs *tclStubsPtr;
@@ -2986,6 +2993,14 @@ extern TclStubs *tclStubsPtr;
#define Tcl_Chdir \
(tclStubsPtr->tcl_Chdir) /* 366 */
#endif
+#ifndef Tcl_Access
+#define Tcl_Access \
+ (tclStubsPtr->tcl_Access) /* 367 */
+#endif
+#ifndef Tcl_Stat
+#define Tcl_Stat \
+ (tclStubsPtr->tcl_Stat) /* 368 */
+#endif
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 6a00e54..a8f2427 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.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: tclIOUtil.c,v 1.6 1999/04/16 00:46:47 stanton Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.7 1999/04/17 00:32:29 hershey Exp $
*/
#include "tclInt.h"
@@ -446,7 +446,7 @@ Tcl_PosixError(interp)
int
TclStat(path, buf)
CONST char *path; /* Path of file to stat (in current CP). */
- TclStat_ *buf; /* Filled with results of stat call. */
+ struct stat *buf; /* Filled with results of stat call. */
{
StatProc *statProcPtr;
int retVal = -1;
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index e1d9016..9d9cdd2 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -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: tclInt.decls,v 1.6 1999/04/16 22:03:58 surles Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.7 1999/04/17 00:32:29 hershey Exp $
library tcl
@@ -393,7 +393,7 @@ declare 104 generic {
int TclSockMinimumBuffers(int sock, int size)
}
declare 105 generic {
- int TclStat(CONST char *path, TclStat_ *buf)
+ int TclStat(CONST char *path, struct stat *buf)
}
declare 106 generic {
int TclStatDeleteProc(TclStatProc_ *proc)
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 0590bc5..734cdbf 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.25 1999/04/16 00:46:48 stanton Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.26 1999/04/17 00:32:29 hershey Exp $
*/
#ifndef _TCLINT
@@ -1476,8 +1476,7 @@ typedef struct TclFile_ *TclFile;
*----------------------------------------------------------------
*/
-typedef struct stat TclStat_;
-typedef int (TclStatProc_) _ANSI_ARGS_((CONST char *path, TclStat_ *buf));
+typedef int (TclStatProc_) _ANSI_ARGS_((CONST char *path, struct stat *buf));
typedef int (TclAccessProc_) _ANSI_ARGS_((CONST char *path, int mode));
typedef Tcl_Channel (TclOpenFileChannelProc_) _ANSI_ARGS_((Tcl_Interp *interp,
char *fileName, char *modeString,
@@ -1811,7 +1810,7 @@ EXTERN int TclSockGetPort _ANSI_ARGS_((Tcl_Interp *interp,
EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((int sock,
int size));
EXTERN int TclStat _ANSI_ARGS_((CONST char *path,
- TclStat_ *buf));
+ struct stat *buf));
EXTERN int TclStatDeleteProc _ANSI_ARGS_((TclStatProc_ *proc));
EXTERN int TclStatInsertProc _ANSI_ARGS_((TclStatProc_ *proc));
EXTERN void TclTeardownNamespace _ANSI_ARGS_((Namespace *nsPtr));
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 5edf57e..6e49d84 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIntDecls.h,v 1.5 1999/04/16 22:03:58 surles Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.6 1999/04/17 00:32:30 hershey Exp $
*/
#ifndef _TCLINTDECLS
@@ -327,7 +327,7 @@ EXTERN int TclSockMinimumBuffers _ANSI_ARGS_((int sock,
int size));
/* 105 */
EXTERN int TclStat _ANSI_ARGS_((CONST char * path,
- TclStat_ * buf));
+ struct stat * buf));
/* 106 */
EXTERN int TclStatDeleteProc _ANSI_ARGS_((TclStatProc_ * proc));
/* 107 */
@@ -554,7 +554,7 @@ typedef struct TclIntStubs {
void (*tclSetupEnv) _ANSI_ARGS_((Tcl_Interp * interp)); /* 102 */
int (*tclSockGetPort) _ANSI_ARGS_((Tcl_Interp * interp, char * str, char * proto, int * portPtr)); /* 103 */
int (*tclSockMinimumBuffers) _ANSI_ARGS_((int sock, int size)); /* 104 */
- int (*tclStat) _ANSI_ARGS_((CONST char * path, TclStat_ * buf)); /* 105 */
+ int (*tclStat) _ANSI_ARGS_((CONST char * path, struct stat * buf)); /* 105 */
int (*tclStatDeleteProc) _ANSI_ARGS_((TclStatProc_ * proc)); /* 106 */
int (*tclStatInsertProc) _ANSI_ARGS_((TclStatProc_ * proc)); /* 107 */
void (*tclTeardownNamespace) _ANSI_ARGS_((Namespace * nsPtr)); /* 108 */
@@ -974,7 +974,7 @@ extern TclIntStubs *tclIntStubsPtr;
#endif
#ifndef TclSetPreInitScript
#define TclSetPreInitScript \
- (tclIntStubsPtr->tclSetPreInitScript) /* 101 */
+ (tclIntStubsPtr->tclSetPreInitScript) /* 101 */
#endif
#ifndef TclSetupEnv
#define TclSetupEnv \
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 8088b04..a213fc7 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubInit.c,v 1.8 1999/04/16 22:03:59 surles Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.9 1999/04/17 00:32:30 hershey Exp $
*/
#include "tclInt.h"
@@ -436,6 +436,8 @@ TclStubs tclStubs = {
Tcl_ParseVarName, /* 364 */
Tcl_GetCwd, /* 365 */
Tcl_Chdir, /* 366 */
+ Tcl_Access, /* 367 */
+ Tcl_Stat, /* 368 */
};
TclIntStubs tclIntStubs = {
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 80b296a..ab6ac81 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.10 1999/04/16 00:46:54 stanton Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.11 1999/04/17 00:32:31 hershey Exp $
*/
#define TCL_TEST
@@ -270,11 +270,11 @@ static int TestsetrecursionlimitCmd _ANSI_ARGS_((
static int TeststaticpkgCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, char **argv));
static int TestStatProc1 _ANSI_ARGS_((CONST char *path,
- TclStat_ *buf));
+ struct stat *buf));
static int TestStatProc2 _ANSI_ARGS_((CONST char *path,
- TclStat_ *buf));
+ struct stat *buf));
static int TestStatProc3 _ANSI_ARGS_((CONST char *path,
- TclStat_ *buf));
+ struct stat *buf));
static int TeststatprocCmd _ANSI_ARGS_((ClientData dummy,
Tcl_Interp *interp, int argc, char **argv));
static int TesttranslatefilenameCmd _ANSI_ARGS_((ClientData dummy,
@@ -3962,7 +3962,7 @@ TeststatprocCmd (dummy, interp, argc, argv)
static int
TestStatProc1(path, buf)
CONST char *path;
- TclStat_ *buf;
+ struct stat *buf;
{
buf->st_size = 1234;
return ((strstr(path, "testStat1%.fil") == NULL) ? -1 : 0);
@@ -3972,7 +3972,7 @@ TestStatProc1(path, buf)
static int
TestStatProc2(path, buf)
CONST char *path;
- TclStat_ *buf;
+ struct stat *buf;
{
buf->st_size = 2345;
return ((strstr(path, "testStat2%.fil") == NULL) ? -1 : 0);
@@ -3982,7 +3982,7 @@ TestStatProc2(path, buf)
static int
TestStatProc3(path, buf)
CONST char *path;
- TclStat_ *buf;
+ struct stat *buf;
{
buf->st_size = 3456;
return ((strstr(path, "testStat3%.fil") == NULL) ? -1 : 0);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 54811df..556977b 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.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: tclUtil.c,v 1.5 1999/04/16 00:46:55 stanton Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.6 1999/04/17 00:32:32 hershey Exp $
*/
#include "tclInt.h"
@@ -2157,4 +2157,51 @@ Tcl_Chdir(dirName)
{
return TclpChdir(dirName);
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_Access --
+ *
+ * This function replaces the library version of access().
+ *
+ * Results:
+ * See access() documentation.
+ *
+ * Side effects:
+ * See access() documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+int
+Tcl_Access(path, mode)
+ CONST char *path; /* Path of file to access (UTF-8). */
+ int mode; /* Permission setting. */
+{
+ return TclpAccess(path, mode);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_Stat --
+ *
+ * This function replaces the library version of stat().
+ *
+ * Results:
+ * See stat() documentation.
+ *
+ * Side effects:
+ * See stat() documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tcl_Stat(path, bufPtr)
+ CONST char *path; /* Path of file to stat (in UTF-8). */
+ struct stat *bufPtr; /* Filled with results of stat call. */
+{
+ return TclpStat(path, bufPtr);
+}
diff --git a/tests/all.tcl b/tests/all.tcl
index a6c596a..099e3ad 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -7,9 +7,9 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: all.tcl,v 1.2 1999/04/16 00:47:23 stanton Exp $
+# RCS: @(#) $Id: all.tcl,v 1.3 1999/04/17 00:32:32 hershey Exp $
-if {[lsearch ::tcltest [namespace children]] == -1} {
+if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
}
set ::tcltest::testSingleFile false