summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-02 23:26:50 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-02 23:26:50 (GMT)
commit4299352915cf05025553108f48b7bf58f48a8353 (patch)
tree15d43100f7a20ffbfa2b2c98286c806751685a1e
parent4fc8ab60904ddf9c20b0ec362fa8c179a6cb7424 (diff)
downloadtcl-4299352915cf05025553108f48b7bf58f48a8353.zip
tcl-4299352915cf05025553108f48b7bf58f48a8353.tar.gz
tcl-4299352915cf05025553108f48b7bf58f48a8353.tar.bz2
ANSIfy
-rw-r--r--unix/tclUnixEvent.c8
-rw-r--r--unix/tclUnixFCmd.c368
-rw-r--r--unix/tclUnixInit.c65
-rw-r--r--unix/tclUnixNotfy.c50
-rw-r--r--unix/tclUnixPipe.c196
-rw-r--r--unix/tclUnixTest.c307
-rw-r--r--unix/tclUnixThrd.c110
-rw-r--r--unix/tclUnixTime.c87
-rw-r--r--unix/tclXtNotify.c29
-rw-r--r--unix/tclXtTest.c59
10 files changed, 626 insertions, 653 deletions
diff --git a/unix/tclUnixEvent.c b/unix/tclUnixEvent.c
index 688938b..214bf4c 100644
--- a/unix/tclUnixEvent.c
+++ b/unix/tclUnixEvent.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclUnixEvent.c --
*
* This file implements Unix specific event related routines.
@@ -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: tclUnixEvent.c,v 1.8 2005/07/20 23:16:00 dkf Exp $
+ * RCS: @(#) $Id: tclUnixEvent.c,v 1.9 2005/11/02 23:26:50 dkf Exp $
*/
#include "tclInt.h"
@@ -30,8 +30,8 @@
*/
void
-Tcl_Sleep(ms)
- int ms; /* Number of milliseconds to sleep. */
+Tcl_Sleep(
+ int ms) /* Number of milliseconds to sleep. */
{
struct timeval delay;
Tcl_Time before, after, vdelay;
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index a80df2c..5e31c0c 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.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: tclUnixFCmd.c,v 1.46 2005/10/07 22:35:33 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.47 2005/11/02 23:26:50 dkf Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
@@ -68,43 +68,35 @@
* Callbacks for file attributes code.
*/
-static int GetGroupAttribute _ANSI_ARGS_((Tcl_Interp *interp,
+static int GetGroupAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
+static int GetOwnerAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
+static int GetPermissionsAttribute(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName,
- Tcl_Obj **attributePtrPtr));
-static int GetOwnerAttribute _ANSI_ARGS_((Tcl_Interp *interp,
+ Tcl_Obj **attributePtrPtr);
+static int SetGroupAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj *attributePtr);
+static int SetOwnerAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj *attributePtr);
+static int SetPermissionsAttribute(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName,
- Tcl_Obj **attributePtrPtr));
-static int GetPermissionsAttribute _ANSI_ARGS_((
- Tcl_Interp *interp, int objIndex,
- Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr));
-static int SetGroupAttribute _ANSI_ARGS_((Tcl_Interp *interp,
- int objIndex, Tcl_Obj *fileName,
- Tcl_Obj *attributePtr));
-static int SetOwnerAttribute _ANSI_ARGS_((Tcl_Interp *interp,
- int objIndex, Tcl_Obj *fileName,
- Tcl_Obj *attributePtr));
-static int SetPermissionsAttribute _ANSI_ARGS_((
- Tcl_Interp *interp, int objIndex,
- Tcl_Obj *fileName, Tcl_Obj *attributePtr));
-static int GetModeFromPermString _ANSI_ARGS_((
- Tcl_Interp *interp, char *modeStringPtr,
- mode_t *modePtr));
+ Tcl_Obj *attributePtr);
+static int GetModeFromPermString(Tcl_Interp *interp,
+ char *modeStringPtr, mode_t *modePtr);
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
-static int GetReadOnlyAttribute _ANSI_ARGS_((Tcl_Interp *interp,
- int objIndex, Tcl_Obj *fileName,
- Tcl_Obj **attributePtrPtr));
-static int SetReadOnlyAttribute _ANSI_ARGS_((Tcl_Interp *interp,
- int objIndex, Tcl_Obj *fileName,
- Tcl_Obj *attributePtr));
+static int GetReadOnlyAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
+static int SetReadOnlyAttribute(Tcl_Interp *interp, int objIndex,
+ Tcl_Obj *fileName, Tcl_Obj *attributePtr);
#endif
/*
* Prototype for the TraverseUnixTree callback function.
*/
-typedef int (TraversalProc) _ANSI_ARGS_((Tcl_DString *srcPtr,
- Tcl_DString *dstPtr, CONST Tcl_StatBuf *statBufPtr, int type,
- Tcl_DString *errorPtr));
+typedef int (TraversalProc)(Tcl_DString *srcPtr, Tcl_DString *dstPtr,
+ CONST Tcl_StatBuf *statBufPtr, int type, Tcl_DString *errorPtr);
/*
* Constants and variables necessary for file attributes subcommand.
@@ -144,7 +136,7 @@ CONST char *tclpFileAttrStrings[] = {
#ifdef MAC_OSX_TCL
"-creator", "-type", "-hidden", "-rsrclength",
#endif
- (char *) NULL
+ NULL
};
CONST TclFileAttrProcs tclpFileAttrProcs[] = {
@@ -182,25 +174,22 @@ CONST TclFileAttrProcs tclpFileAttrProcs[] = {
* Declarations for local procedures defined in this file:
*/
-static int CopyFileAtts _ANSI_ARGS_((CONST char *src,
- CONST char *dst, CONST Tcl_StatBuf *statBufPtr));
-static int DoCopyFile _ANSI_ARGS_((CONST char *srcPtr,
- CONST char *dstPtr));
-static int DoCreateDirectory _ANSI_ARGS_((CONST char *pathPtr));
-static int DoRemoveDirectory _ANSI_ARGS_((Tcl_DString *pathPtr,
- int recursive, Tcl_DString *errorPtr));
-static int DoRenameFile _ANSI_ARGS_((CONST char *src,
- CONST char *dst));
-static int TraversalCopy _ANSI_ARGS_((Tcl_DString *srcPtr,
+static int CopyFileAtts(CONST char *src,
+ CONST char *dst, CONST Tcl_StatBuf *statBufPtr);
+static int DoCopyFile(CONST char *srcPtr, CONST char *dstPtr);
+static int DoCreateDirectory(CONST char *pathPtr);
+static int DoRemoveDirectory(Tcl_DString *pathPtr,
+ int recursive, Tcl_DString *errorPtr);
+static int DoRenameFile(CONST char *src, CONST char *dst);
+static int TraversalCopy(Tcl_DString *srcPtr,
Tcl_DString *dstPtr, CONST Tcl_StatBuf *statBufPtr,
- int type, Tcl_DString *errorPtr));
-static int TraversalDelete _ANSI_ARGS_((Tcl_DString *srcPtr,
+ int type, Tcl_DString *errorPtr);
+static int TraversalDelete(Tcl_DString *srcPtr,
Tcl_DString *dstPtr, CONST Tcl_StatBuf *statBufPtr,
- int type, Tcl_DString *errorPtr));
-static int TraverseUnixTree _ANSI_ARGS_((
- TraversalProc *traversalProc,
+ int type, Tcl_DString *errorPtr);
+static int TraverseUnixTree(TraversalProc *traversalProc,
Tcl_DString *sourcePtr, Tcl_DString *destPtr,
- Tcl_DString *errorPtr, int doRewind));
+ Tcl_DString *errorPtr, int doRewind);
#ifdef PURIFY
/*
@@ -210,13 +199,12 @@ static int TraverseUnixTree _ANSI_ARGS_((
* passing the standard MAXPATHLEN size resolved arg.
*/
-static char * Realpath _ANSI_ARGS_((CONST char *path,
- char *resolved));
+static char * Realpath(CONST char *path, char *resolved);
char *
-Realpath(path, resolved)
- CONST char *path;
- char *resolved;
+Realpath(
+ CONST char *path,
+ char *resolved)
{
memset(resolved, 0, MAXPATHLEN);
return realpath(path, resolved);
@@ -260,19 +248,19 @@ Realpath(path, resolved)
*/
int
-TclpObjRenameFile(srcPathPtr, destPathPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
+TclpObjRenameFile(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr)
{
return DoRenameFile(Tcl_FSGetNativePath(srcPathPtr),
Tcl_FSGetNativePath(destPathPtr));
}
static int
-DoRenameFile(src, dst)
- CONST char *src; /* Pathname of file or dir to be renamed
+DoRenameFile(
+ CONST char *src, /* Pathname of file or dir to be renamed
* (native). */
- CONST char *dst; /* New pathname of file or directory
+ CONST char *dst) /* New pathname of file or directory
* (native). */
{
if (rename(src, dst) == 0) { /* INTL: Native. */
@@ -376,18 +364,18 @@ DoRenameFile(src, dst)
*/
int
-TclpObjCopyFile(srcPathPtr, destPathPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
+TclpObjCopyFile(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr)
{
return DoCopyFile(Tcl_FSGetNativePath(srcPathPtr),
Tcl_FSGetNativePath(destPathPtr));
}
static int
-DoCopyFile(src, dst)
- CONST char *src; /* Pathname of file to be copied (native). */
- CONST char *dst; /* Pathname of file to copy to (native). */
+DoCopyFile(
+ CONST char *src, /* Pathname of file to be copied (native). */
+ CONST char *dst) /* Pathname of file to copy to (native). */
{
Tcl_StatBuf srcStatBuf, dstStatBuf;
@@ -473,13 +461,13 @@ DoCopyFile(src, dst)
*/
int
-TclUnixCopyFile(src, dst, statBufPtr, dontCopyAtts)
- CONST char *src; /* Pathname of file to copy (native). */
- CONST char *dst; /* Pathname of file to create/overwrite
+TclUnixCopyFile(
+ CONST char *src, /* Pathname of file to copy (native). */
+ CONST char *dst, /* Pathname of file to create/overwrite
* (native). */
- CONST Tcl_StatBuf *statBufPtr;
+ CONST Tcl_StatBuf *statBufPtr,
/* Used to determine mode and blocksize. */
- int dontCopyAtts; /* If flag set, don't copy attributes. */
+ int dontCopyAtts) /* If flag set, don't copy attributes. */
{
int srcFd, dstFd;
unsigned blockSize; /* Optimal I/O blocksize for filesystem */
@@ -580,15 +568,15 @@ TclUnixCopyFile(src, dst, statBufPtr, dontCopyAtts)
*/
int
-TclpObjDeleteFile(pathPtr)
- Tcl_Obj *pathPtr;
+TclpObjDeleteFile(
+ Tcl_Obj *pathPtr)
{
return TclpDeleteFile(Tcl_FSGetNativePath(pathPtr));
}
int
-TclpDeleteFile(path)
- CONST char *path; /* Pathname of file to be removed (native). */
+TclpDeleteFile(
+ CONST char *path) /* Pathname of file to be removed (native). */
{
if (unlink(path) != 0) { /* INTL: Native. */
return TCL_ERROR;
@@ -623,15 +611,15 @@ TclpDeleteFile(path)
*/
int
-TclpObjCreateDirectory(pathPtr)
- Tcl_Obj *pathPtr;
+TclpObjCreateDirectory(
+ Tcl_Obj *pathPtr)
{
return DoCreateDirectory(Tcl_FSGetNativePath(pathPtr));
}
static int
-DoCreateDirectory(path)
- CONST char *path; /* Pathname of directory to create (native). */
+DoCreateDirectory(
+ CONST char *path) /* Pathname of directory to create (native). */
{
mode_t mode;
@@ -675,10 +663,10 @@ DoCreateDirectory(path)
*/
int
-TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr)
- Tcl_Obj *srcPathPtr;
- Tcl_Obj *destPathPtr;
- Tcl_Obj **errorPtr;
+TclpObjCopyDirectory(
+ Tcl_Obj *srcPathPtr,
+ Tcl_Obj *destPathPtr,
+ Tcl_Obj **errorPtr)
{
Tcl_DString ds;
Tcl_DString srcString, dstString;
@@ -687,14 +675,14 @@ TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr)
transPtr = Tcl_FSGetTranslatedPath(NULL,srcPathPtr);
Tcl_UtfToExternalDString(NULL,
- (transPtr != NULL ? Tcl_GetString(transPtr) : NULL),
+ (transPtr != NULL ? TclGetString(transPtr) : NULL),
-1, &srcString);
if (transPtr != NULL) {
Tcl_DecrRefCount(transPtr);
}
transPtr = Tcl_FSGetTranslatedPath(NULL,destPathPtr);
Tcl_UtfToExternalDString(NULL,
- (transPtr != NULL ? Tcl_GetString(transPtr) : NULL),
+ (transPtr != NULL ? TclGetString(transPtr) : NULL),
-1, &dstString);
if (transPtr != NULL) {
Tcl_DecrRefCount(transPtr);
@@ -741,10 +729,10 @@ TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr)
*/
int
-TclpObjRemoveDirectory(pathPtr, recursive, errorPtr)
- Tcl_Obj *pathPtr;
- int recursive;
- Tcl_Obj **errorPtr;
+TclpObjRemoveDirectory(
+ Tcl_Obj *pathPtr,
+ int recursive,
+ Tcl_Obj **errorPtr)
{
Tcl_DString ds;
Tcl_DString pathString;
@@ -752,7 +740,7 @@ TclpObjRemoveDirectory(pathPtr, recursive, errorPtr)
Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr);
Tcl_UtfToExternalDString(NULL,
- (transPtr != NULL ? Tcl_GetString(transPtr) : NULL),
+ (transPtr != NULL ? TclGetString(transPtr) : NULL),
-1, &pathString);
if (transPtr != NULL) {
Tcl_DecrRefCount(transPtr);
@@ -769,13 +757,13 @@ TclpObjRemoveDirectory(pathPtr, recursive, errorPtr)
}
static int
-DoRemoveDirectory(pathPtr, recursive, errorPtr)
- Tcl_DString *pathPtr; /* Pathname of directory to be removed
+DoRemoveDirectory(
+ Tcl_DString *pathPtr, /* Pathname of directory to be removed
* (native). */
- int recursive; /* If non-zero, removes directories that are
+ int recursive, /* If non-zero, removes directories that are
* nonempty. Otherwise, will only remove empty
* directories. */
- Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free DString
+ Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
* filled with UTF-8 name of file causing
* error. */
{
@@ -858,17 +846,17 @@ DoRemoveDirectory(pathPtr, recursive, errorPtr)
*/
static int
-TraverseUnixTree(traverseProc, sourcePtr, targetPtr, errorPtr, doRewind)
- TraversalProc *traverseProc;/* Function to call for every file and
+TraverseUnixTree(
+ TraversalProc *traverseProc,/* Function to call for every file and
* directory in source hierarchy. */
- Tcl_DString *sourcePtr; /* Pathname of source directory to be
+ Tcl_DString *sourcePtr, /* Pathname of source directory to be
* traversed (native). */
- Tcl_DString *targetPtr; /* Pathname of directory to traverse in
+ Tcl_DString *targetPtr, /* Pathname of directory to traverse in
* parallel with source directory (native). */
- Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free DString
+ Tcl_DString *errorPtr, /* If non-NULL, uninitialized or free DString
* filled with UTF-8 name of file causing
* error. */
- int doRewind; /* Flag indicating that to ensure complete
+ int doRewind) /* Flag indicating that to ensure complete
* traversal of source hierarchy, the readdir
* loop should be rewound whenever
* traverseProc has returned TCL_OK; this is
@@ -962,6 +950,7 @@ TraverseUnixTree(traverseProc, sourcePtr, targetPtr, errorPtr, doRewind)
* (since the opendir or the previous rewinddir), to avoid
* a NULL-return that may a symptom of a buggy readdir.
*/
+
rewinddir(dirPtr);
numProcessed = 0;
}
@@ -1017,13 +1006,13 @@ TraverseUnixTree(traverseProc, sourcePtr, targetPtr, errorPtr, doRewind)
*/
static int
-TraversalCopy(srcPtr, dstPtr, statBufPtr, type, errorPtr)
- Tcl_DString *srcPtr; /* Source pathname to copy (native). */
- Tcl_DString *dstPtr; /* Destination pathname of copy (native). */
- CONST Tcl_StatBuf *statBufPtr;
+TraversalCopy(
+ Tcl_DString *srcPtr, /* Source pathname to copy (native). */
+ Tcl_DString *dstPtr, /* Destination pathname of copy (native). */
+ CONST Tcl_StatBuf *statBufPtr,
/* Stat info for file specified by srcPtr. */
- int type; /* Reason for call - see TraverseUnixTree(). */
- Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free DString
+ int type, /* Reason for call - see TraverseUnixTree(). */
+ Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
* filled with UTF-8 name of file causing
* error. */
{
@@ -1081,13 +1070,13 @@ TraversalCopy(srcPtr, dstPtr, statBufPtr, type, errorPtr)
*/
static int
-TraversalDelete(srcPtr, ignore, statBufPtr, type, errorPtr)
- Tcl_DString *srcPtr; /* Source pathname (native). */
- Tcl_DString *ignore; /* Destination pathname (not used). */
- CONST Tcl_StatBuf *statBufPtr;
+TraversalDelete(
+ Tcl_DString *srcPtr, /* Source pathname (native). */
+ Tcl_DString *ignore, /* Destination pathname (not used). */
+ CONST Tcl_StatBuf *statBufPtr,
/* Stat info for file specified by srcPtr. */
- int type; /* Reason for call - see TraverseUnixTree(). */
- Tcl_DString *errorPtr; /* If non-NULL, uninitialized or free DString
+ int type, /* Reason for call - see TraverseUnixTree(). */
+ Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
* filled with UTF-8 name of file causing
* error. */
{
@@ -1131,10 +1120,10 @@ TraversalDelete(srcPtr, ignore, statBufPtr, type, errorPtr)
*/
static int
-CopyFileAtts(src, dst, statBufPtr)
- CONST char *src; /* Path name of source file (native). */
- CONST char *dst; /* Path name of target file (native). */
- CONST Tcl_StatBuf *statBufPtr;
+CopyFileAtts(
+ CONST char *src, /* Path name of source file (native). */
+ CONST char *dst, /* Path name of target file (native). */
+ CONST Tcl_StatBuf *statBufPtr)
/* Stat info for source file */
{
struct utimbuf tval;
@@ -1189,11 +1178,11 @@ CopyFileAtts(src, dst, statBufPtr)
*/
static int
-GetGroupAttribute(interp, objIndex, fileName, attributePtrPtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */
+GetGroupAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
struct group *groupPtr;
@@ -1204,8 +1193,8 @@ GetGroupAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -1243,11 +1232,11 @@ GetGroupAttribute(interp, objIndex, fileName, attributePtrPtr)
*/
static int
-GetOwnerAttribute(interp, objIndex, fileName, attributePtrPtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */
+GetOwnerAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
struct passwd *pwPtr;
@@ -1258,8 +1247,8 @@ GetOwnerAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -1297,11 +1286,11 @@ GetOwnerAttribute(interp, objIndex, fileName, attributePtrPtr)
*/
static int
-GetPermissionsAttribute(interp, objIndex, fileName, attributePtrPtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */
+GetPermissionsAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
int result;
@@ -1311,8 +1300,8 @@ GetPermissionsAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -1341,11 +1330,11 @@ GetPermissionsAttribute(interp, objIndex, fileName, attributePtrPtr)
*/
static int
-SetGroupAttribute(interp, objIndex, fileName, attributePtr)
- Tcl_Interp *interp; /* The interp for error reporting. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj *attributePtr; /* New group for file. */
+SetGroupAttribute(
+ Tcl_Interp *interp, /* The interp for error reporting. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *attributePtr) /* New group for file. */
{
long gid;
int result;
@@ -1367,9 +1356,8 @@ SetGroupAttribute(interp, objIndex, fileName, attributePtr)
endgrent();
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set group for file \"",
- Tcl_GetString(fileName), "\": group \"",
- string, "\" does not exist",
- (char *) NULL);
+ TclGetString(fileName), "\": group \"", string,
+ "\" does not exist", NULL);
}
return TCL_ERROR;
}
@@ -1383,8 +1371,8 @@ SetGroupAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set group for file \"",
- Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp),
+ NULL);
}
return TCL_ERROR;
}
@@ -1408,11 +1396,11 @@ SetGroupAttribute(interp, objIndex, fileName, attributePtr)
*/
static int
-SetOwnerAttribute(interp, objIndex, fileName, attributePtr)
- Tcl_Interp *interp; /* The interp for error reporting. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj *attributePtr; /* New owner for file. */
+SetOwnerAttribute(
+ Tcl_Interp *interp, /* The interp for error reporting. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *attributePtr) /* New owner for file. */
{
long uid;
int result;
@@ -1433,8 +1421,8 @@ SetOwnerAttribute(interp, objIndex, fileName, attributePtr)
if (pwPtr == NULL) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set owner for file \"",
- Tcl_GetString(fileName), "\": user \"", string,
- "\" does not exist", (char *) NULL);
+ TclGetString(fileName), "\": user \"", string,
+ "\" does not exist", NULL);
}
return TCL_ERROR;
}
@@ -1447,8 +1435,8 @@ SetOwnerAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set owner for file \"",
- Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp),
+ NULL);
}
return TCL_ERROR;
}
@@ -1472,11 +1460,11 @@ SetOwnerAttribute(interp, objIndex, fileName, attributePtr)
*/
static int
-SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj *attributePtr; /* The attribute to set. */
+SetPermissionsAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *attributePtr) /* The attribute to set. */
{
long mode;
mode_t newMode;
@@ -1491,7 +1479,7 @@ SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
newMode = (mode_t) (mode & 0x00007FFF);
} else {
Tcl_StatBuf buf;
- char *modeStringPtr = Tcl_GetString(attributePtr);
+ char *modeStringPtr = TclGetString(attributePtr);
/*
* Try the forms "rwxrwxrwx" and "ugo=rwx"
@@ -1504,8 +1492,8 @@ SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -1514,7 +1502,7 @@ SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
if (GetModeFromPermString(NULL, modeStringPtr, &newMode) != TCL_OK) {
if (interp != NULL) {
Tcl_AppendResult(interp, "unknown permission string format \"",
- modeStringPtr, "\"", (char *) NULL);
+ modeStringPtr, "\"", NULL);
}
return TCL_ERROR;
}
@@ -1525,8 +1513,8 @@ SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set permissions for file \"",
- Tcl_GetString(fileName), "\": ",
- Tcl_PosixError(interp), (char *) NULL);
+ TclGetString(fileName), "\": ",
+ Tcl_PosixError(interp), NULL);
}
return TCL_ERROR;
}
@@ -1550,10 +1538,10 @@ SetPermissionsAttribute(interp, objIndex, fileName, attributePtr)
*---------------------------------------------------------------------------
*/
-Tcl_Obj*
+Tcl_Obj *
TclpObjListVolumes(void)
{
- Tcl_Obj *resultPtr = Tcl_NewStringObj("/",1);
+ Tcl_Obj *resultPtr = Tcl_NewStringObj("/", 1);
Tcl_IncrRefCount(resultPtr);
return resultPtr;
@@ -1579,10 +1567,10 @@ TclpObjListVolumes(void)
*/
static int
-GetModeFromPermString(interp, modeStringPtr, modePtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- char *modeStringPtr; /* Permissions string */
- mode_t *modePtr; /* pointer to the mode value */
+GetModeFromPermString(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ char *modeStringPtr, /* Permissions string */
+ mode_t *modePtr) /* pointer to the mode value */
{
mode_t newMode;
mode_t oldMode; /* Storage for the value of the old mode (that
@@ -1769,10 +1757,10 @@ GetModeFromPermString(interp, modeStringPtr, modePtr)
*/
int
-TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
- Tcl_Interp *interp;
- Tcl_Obj *pathPtr;
- int nextCheckpoint;
+TclpObjNormalizePath(
+ Tcl_Interp *interp,
+ Tcl_Obj *pathPtr,
+ int nextCheckpoint)
{
char *currentPathEndPosition;
int pathLen;
@@ -1969,11 +1957,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
*/
static int
-GetReadOnlyAttribute(interp, objIndex, fileName, attributePtrPtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj **attributePtrPtr; /* A pointer to return the object with. */
+GetReadOnlyAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
Tcl_StatBuf statBuf;
int result;
@@ -1983,8 +1971,8 @@ GetReadOnlyAttribute(interp, objIndex, fileName, attributePtrPtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp),
+ NULL);
}
return TCL_ERROR;
}
@@ -2011,11 +1999,11 @@ GetReadOnlyAttribute(interp, objIndex, fileName, attributePtrPtr)
*/
static int
-SetReadOnlyAttribute(interp, objIndex, fileName, attributePtr)
- Tcl_Interp *interp; /* The interp we are using for errors. */
- int objIndex; /* The index of the attribute. */
- Tcl_Obj *fileName; /* The name of the file (UTF-8). */
- Tcl_Obj *attributePtr; /* The attribute to set. */
+SetReadOnlyAttribute(
+ Tcl_Interp *interp, /* The interp we are using for errors. */
+ int objIndex, /* The index of the attribute. */
+ Tcl_Obj *fileName, /* The name of the file (UTF-8). */
+ Tcl_Obj *attributePtr) /* The attribute to set. */
{
Tcl_StatBuf statBuf;
int result;
@@ -2031,8 +2019,8 @@ SetReadOnlyAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not read \"",
- Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp),
+ NULL);
}
return TCL_ERROR;
}
@@ -2048,8 +2036,8 @@ SetReadOnlyAttribute(interp, objIndex, fileName, attributePtr)
if (result != 0) {
if (interp != NULL) {
Tcl_AppendResult(interp, "could not set flags for file \"",
- Tcl_GetString(fileName), "\": ", Tcl_PosixError(interp),
- (char *) NULL);
+ TclGetString(fileName), "\": ", Tcl_PosixError(interp),
+ NULL);
}
return TCL_ERROR;
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 4cc8786..3c65494 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.60 2005/08/05 20:36:18 dkf Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.61 2005/11/02 23:26:50 dkf Exp $
*/
#include "tclInt.h"
@@ -52,8 +52,8 @@
*
* The getrlimit() function is documented to return the maximum stack size in
* bytes. However, with threads enabled, the pthread library does bad things
- * to the stack size limits. First, the limits cannot be changed. Second,
- * they appear to be reported incorrectly by a factor of about 64.
+ * to the stack size limits. First, the limits cannot be changed. Second, they
+ * appear to be reported incorrectly by a factor of about 64.
*
* The defines below may need to be adjusted if more platforms have this
* broken behavior with threads enabled.
@@ -325,14 +325,12 @@ static CONST LocaleTable localeTable[] = {
};
#ifndef TCL_NO_STACK_CHECK
-static int GetStackSize _ANSI_ARGS_((size_t *stackSizePtr));
+static int GetStackSize(size_t *stackSizePtr);
#endif /* TCL_NO_STACK_CHECK */
#ifdef HAVE_COREFOUNDATION
-static int MacOSXGetLibraryPath _ANSI_ARGS_((
- Tcl_Interp *interp, int maxPathLen,
- char *tclLibPath));
+static int MacOSXGetLibraryPath(Tcl_Interp *interp,
+ int maxPathLen, char *tclLibPath);
#endif /* HAVE_COREFOUNDATION */
-
/*
*---------------------------------------------------------------------------
@@ -354,7 +352,7 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
*/
void
-TclpInitPlatform()
+TclpInitPlatform(void)
{
#ifdef DJGPP
tclPlatform = TCL_PLATFORM_WINDOWS;
@@ -377,7 +375,7 @@ TclpInitPlatform()
}
/*
- * The code below causes SIGPIPE (broken pipe) errors to be ignored. This
+ * The code below causes SIGPIPE (broken pipe) errors to be ignored. This
* is needed so that Tcl processes don't die if they create child
* processes (e.g. using "exec" or "open") that terminate prematurely.
* The signal handler is only set up when the first interpreter is
@@ -440,10 +438,10 @@ TclpInitPlatform()
*/
void
-TclpInitLibraryPath(valuePtr, lengthPtr, encodingPtr)
- char **valuePtr;
- int *lengthPtr;
- Tcl_Encoding *encodingPtr;
+TclpInitLibraryPath(
+ char **valuePtr,
+ int *lengthPtr,
+ Tcl_Encoding *encodingPtr)
{
#define LIBRARY_SIZE 32
Tcl_Obj *pathPtr, *objPtr;
@@ -562,7 +560,7 @@ TclpInitLibraryPath(valuePtr, lengthPtr, encodingPtr)
*/
void
-TclpSetInitialEncodings()
+TclpSetInitialEncodings(void)
{
Tcl_DString encodingName;
Tcl_SetSystemEncoding(NULL,
@@ -571,14 +569,14 @@ TclpSetInitialEncodings()
}
void
-TclpSetInterfaces()
+TclpSetInterfaces(void)
{
- /* do nothing */
+ /* do nothing */
}
static CONST char *
-SearchKnownEncodings(encoding)
- CONST char *encoding;
+SearchKnownEncodings(
+ CONST char *encoding)
{
int left = 0;
int right = sizeof(localeTable)/sizeof(LocaleTable);
@@ -600,8 +598,8 @@ SearchKnownEncodings(encoding)
}
CONST char *
-TclpGetEncodingNameFromEnvironment(bufPtr)
- Tcl_DString *bufPtr;
+TclpGetEncodingNameFromEnvironment(
+ Tcl_DString *bufPtr)
{
CONST char *encoding;
CONST char *knownEncoding;
@@ -610,7 +608,7 @@ TclpGetEncodingNameFromEnvironment(bufPtr)
/*
* Determine the current encoding from the LC_* or LANG environment
- * variables. We previously used setlocale() to determine the locale, but
+ * variables. We previously used setlocale() to determine the locale, but
* this does not work on some systems (e.g. Linux/i386 RH 5.0).
*/
@@ -722,8 +720,8 @@ TclpGetEncodingNameFromEnvironment(bufPtr)
*/
void
-TclpSetVariables(interp)
- Tcl_Interp *interp;
+TclpSetVariables(
+ Tcl_Interp *interp)
{
#ifndef NO_UNAME
struct utsname name;
@@ -893,7 +891,7 @@ TclpSetVariables(interp)
*
* Results:
* The return value is the index in environ of an entry with the name
- * "name", or -1 if there is no such entry. The integer at *lengthPtr is
+ * "name", or -1 if there is no such entry. The integer at *lengthPtr is
* filled in with the length of name (if a matching entry is found) or
* the length of the environ array (if no matching entry is found).
*
@@ -904,10 +902,10 @@ TclpSetVariables(interp)
*/
int
-TclpFindVariable(name, lengthPtr)
- CONST char *name; /* Name of desired environment variable
+TclpFindVariable(
+ CONST char *name, /* Name of desired environment variable
* (native). */
- int *lengthPtr; /* Used to return length of name (for
+ int *lengthPtr) /* Used to return length of name (for
* successful searches) or number of non-NULL
* entries in environ (for unsuccessful
* searches). */
@@ -958,7 +956,7 @@ TclpFindVariable(name, lengthPtr)
*/
int
-TclpCheckStackSpace()
+TclpCheckStackSpace(void)
{
#ifdef TCL_NO_STACK_CHECK
@@ -1071,8 +1069,8 @@ TclpCheckStackSpace()
#ifndef TCL_NO_STACK_CHECK
static int
-GetStackSize(stackSizePtr)
- size_t *stackSizePtr;
+GetStackSize(
+ size_t *stackSizePtr)
{
size_t rawStackSize;
struct rlimit rLimit; /* The result from getrlimit(). */
@@ -1153,7 +1151,10 @@ GetStackSize(stackSizePtr)
#ifdef HAVE_COREFOUNDATION
static int
-MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath)
+MacOSXGetLibraryPath(
+ Tcl_Interp *interp,
+ int maxPathLen,
+ char *tclLibPath)
{
int foundInFramework = TCL_ERROR;
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 3c4dbee..46c39e9 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -10,13 +10,13 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixNotfy.c,v 1.28 2005/07/24 22:56:44 dkf Exp $
+ * RCS: @(#) $Id: tclUnixNotfy.c,v 1.29 2005/11/02 23:26:50 dkf Exp $
*/
#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
* in tclMacOSXNotify.c */
#include "tclInt.h"
-#include <signal.h>
+#include <signal.h>
/*
* This code does deep stub magic to allow replacement of the notifier at
@@ -209,7 +209,7 @@ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
*/
ClientData
-Tcl_InitNotifier()
+Tcl_InitNotifier(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -261,8 +261,8 @@ Tcl_InitNotifier()
*/
void
-Tcl_FinalizeNotifier(clientData)
- ClientData clientData; /* Not used. */
+Tcl_FinalizeNotifier(
+ ClientData clientData) /* Not used. */
{
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -333,8 +333,8 @@ Tcl_FinalizeNotifier(clientData)
*/
void
-Tcl_AlertNotifier(clientData)
- ClientData clientData;
+Tcl_AlertNotifier(
+ ClientData clientData)
{
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
@@ -364,8 +364,8 @@ Tcl_AlertNotifier(clientData)
*/
void
-Tcl_SetTimer(timePtr)
- Tcl_Time *timePtr; /* Timeout value, may be NULL. */
+Tcl_SetTimer(
+ Tcl_Time *timePtr) /* Timeout value, may be NULL. */
{
/*
* The interval timer doesn't do anything in this implementation, because
@@ -395,8 +395,8 @@ Tcl_SetTimer(timePtr)
*/
void
-Tcl_ServiceModeHook(mode)
- int mode; /* Either TCL_SERVICE_ALL, or
+Tcl_ServiceModeHook(
+ int mode) /* Either TCL_SERVICE_ALL, or
* TCL_SERVICE_NONE. */
{
}
@@ -418,15 +418,15 @@ Tcl_ServiceModeHook(mode)
*/
void
-Tcl_CreateFileHandler(fd, mask, proc, clientData)
- int fd; /* Handle of stream to watch. */
- int mask; /* OR'ed combination of TCL_READABLE,
+Tcl_CreateFileHandler(
+ int fd, /* Handle of stream to watch. */
+ int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
- Tcl_FileProc *proc; /* Function to call for each selected
+ Tcl_FileProc *proc, /* Function to call for each selected
* event. */
- ClientData clientData; /* Arbitrary data to pass to proc. */
+ ClientData clientData) /* Arbitrary data to pass to proc. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
FileHandler *filePtr;
@@ -494,8 +494,8 @@ Tcl_CreateFileHandler(fd, mask, proc, clientData)
*/
void
-Tcl_DeleteFileHandler(fd)
- int fd; /* Stream id for which to remove callback
+Tcl_DeleteFileHandler(
+ int fd) /* Stream id for which to remove callback
* function. */
{
FileHandler *filePtr, *prevPtr;
@@ -586,9 +586,9 @@ Tcl_DeleteFileHandler(fd)
*/
static int
-FileHandlerEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to handle,
+FileHandlerEventProc(
+ Tcl_Event *evPtr, /* Event to service. */
+ int flags) /* Flags that indicate what events to handle,
* such as TCL_FILE_EVENTS. */
{
int mask;
@@ -655,8 +655,8 @@ FileHandlerEventProc(evPtr, flags)
*/
int
-Tcl_WaitForEvent(timePtr)
- Tcl_Time *timePtr; /* Maximum block time, or NULL. */
+Tcl_WaitForEvent(
+ Tcl_Time *timePtr) /* Maximum block time, or NULL. */
{
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
@@ -886,8 +886,8 @@ Tcl_WaitForEvent(timePtr)
*/
static void
-NotifierThreadProc(clientData)
- ClientData clientData; /* Not used. */
+NotifierThreadProc(
+ ClientData clientData) /* Not used. */
{
ThreadSpecificData *tsdPtr;
fd_set readableMask;
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 3dcf829..c41c1be 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.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: tclUnixPipe.c,v 1.31 2005/07/28 10:55:37 dkf Exp $
+ * RCS: @(#) $Id: tclUnixPipe.c,v 1.32 2005/11/02 23:26:50 dkf Exp $
*/
#include "tclInt.h"
@@ -25,8 +25,8 @@
* the same as NULL.
*/
-#define MakeFile(fd) ((TclFile)(((int)fd)+1))
-#define GetFd(file) (((int)file)-1)
+#define MakeFile(fd) ((TclFile)(((int)fd)+1))
+#define GetFd(file) (((int)file)-1)
/*
* This structure describes per-instance state of a pipe based channel.
@@ -47,23 +47,21 @@ typedef struct PipeState {
} PipeState;
/*
- * Declarations for local procedures defined in this file:
+ * Declarations for local functions defined in this file:
*/
-static int PipeBlockModeProc _ANSI_ARGS_((ClientData instanceData,
- int mode));
-static int PipeCloseProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp));
-static int PipeGetHandleProc _ANSI_ARGS_((ClientData instanceData,
- int direction, ClientData *handlePtr));
-static int PipeInputProc _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toRead, int *errorCode));
-static int PipeOutputProc _ANSI_ARGS_((
- ClientData instanceData, CONST char *buf, int toWrite,
- int *errorCode));
-static void PipeWatchProc _ANSI_ARGS_((ClientData instanceData, int mask));
-static void RestoreSignals _ANSI_ARGS_((void));
-static int SetupStdFile _ANSI_ARGS_((TclFile file, int type));
+static int PipeBlockModeProc(ClientData instanceData, int mode);
+static int PipeCloseProc(ClientData instanceData,
+ Tcl_Interp *interp);
+static int PipeGetHandleProc(ClientData instanceData,
+ int direction, ClientData *handlePtr);
+static int PipeInputProc(ClientData instanceData, char *buf,
+ int toRead, int *errorCode);
+static int PipeOutputProc(ClientData instanceData,
+ CONST char *buf, int toWrite, int *errorCode);
+static void PipeWatchProc(ClientData instanceData, int mask);
+static void RestoreSignals(void);
+static int SetupStdFile(TclFile file, int type);
/*
* This structure describes the channel type structure for command pipe based
@@ -106,9 +104,9 @@ static Tcl_ChannelType pipeChannelType = {
*/
TclFile
-TclpMakeFile(channel, direction)
- Tcl_Channel channel; /* Channel to get file from. */
- int direction; /* Either TCL_READABLE or TCL_WRITABLE. */
+TclpMakeFile(
+ Tcl_Channel channel, /* Channel to get file from. */
+ int direction) /* Either TCL_READABLE or TCL_WRITABLE. */
{
ClientData data;
@@ -137,9 +135,9 @@ TclpMakeFile(channel, direction)
*/
TclFile
-TclpOpenFile(fname, mode)
- CONST char *fname; /* The name of the file to open. */
- int mode; /* In what mode to open the file? */
+TclpOpenFile(
+ CONST char *fname, /* The name of the file to open. */
+ int mode) /* In what mode to open the file? */
{
int fd;
CONST char *native;
@@ -189,8 +187,8 @@ TclpOpenFile(fname, mode)
*/
TclFile
-TclpCreateTempFile(contents)
- CONST char *contents; /* String to write into temp file, or NULL. */
+TclpCreateTempFile(
+ CONST char *contents) /* String to write into temp file, or NULL. */
{
char fileName[L_tmpnam + 9];
CONST char *native;
@@ -243,7 +241,7 @@ TclpCreateTempFile(contents)
*/
Tcl_Obj *
-TclpTempFileName()
+TclpTempFileName(void)
{
char fileName[L_tmpnam + 9];
Tcl_Obj *result = NULL;
@@ -287,10 +285,10 @@ TclpTempFileName()
*/
int
-TclpCreatePipe(readPipe, writePipe)
- TclFile *readPipe; /* Location to store file handle for read side
+TclpCreatePipe(
+ TclFile *readPipe, /* Location to store file handle for read side
* of pipe. */
- TclFile *writePipe; /* Location to store file handle for write
+ TclFile *writePipe) /* Location to store file handle for write
* side of pipe. */
{
int pipeIds[2];
@@ -324,8 +322,8 @@ TclpCreatePipe(readPipe, writePipe)
*/
int
-TclpCloseFile(file)
- TclFile file; /* The file to close. */
+TclpCloseFile(
+ TclFile file) /* The file to close. */
{
int fd = GetFd(file);
@@ -366,33 +364,32 @@ TclpCloseFile(file)
/* ARGSUSED */
int
-TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
- pidPtr)
- Tcl_Interp *interp; /* Interpreter in which to leave errors that
+TclpCreateProcess(
+ Tcl_Interp *interp, /* Interpreter in which to leave errors that
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
- int argc; /* Number of arguments in following array. */
- CONST char **argv; /* Array of argument strings in UTF-8.
+ int argc, /* Number of arguments in following array. */
+ CONST char **argv, /* Array of argument strings in UTF-8.
* argv[0] contains the name of the executable
* translated using Tcl_TranslateFileName
* call). Additional arguments have not been
* converted. */
- TclFile inputFile; /* If non-NULL, gives the file to use as input
+ TclFile inputFile, /* If non-NULL, gives the file to use as input
* for the child process. If inputFile file is
* not readable or is NULL, the child will
* receive no standard input. */
- TclFile outputFile; /* If non-NULL, gives the file that receives
+ TclFile outputFile, /* If non-NULL, gives the file that receives
* output from the child process. If
* outputFile file is not writeable or is
* NULL, output from the child will be
* discarded. */
- TclFile errorFile; /* If non-NULL, gives the file that receives
+ TclFile errorFile, /* If non-NULL, gives the file that receives
* errors from the child process. If errorFile
* file is not writeable or is NULL, errors
* from the child will be discarded. errorFile
* may be the same as outputFile. */
- Tcl_Pid *pidPtr; /* If this procedure is successful, pidPtr is
+ Tcl_Pid *pidPtr) /* If this function is successful, pidPtr is
* filled with the process id of the child
* process. */
{
@@ -414,7 +411,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
if (TclpCreatePipe(&errPipeIn, &errPipeOut) == 0) {
Tcl_AppendResult(interp, "couldn't create pipe: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
@@ -473,7 +470,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
if (pid == -1) {
Tcl_AppendResult(interp, "couldn't fork child process: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
goto error;
}
@@ -492,8 +489,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
char *end;
errSpace[count] = 0;
errno = strtol(errSpace, &end, 10);
- Tcl_AppendResult(interp, end, Tcl_PosixError(interp),
- (char *) NULL);
+ Tcl_AppendResult(interp, end, Tcl_PosixError(interp), NULL);
goto error;
}
@@ -527,7 +523,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
*
* RestoreSignals --
*
- * This procedure is invoked in a forked child process just before
+ * This function is invoked in a forked child process just before
* exec-ing a new program to restore all signals to their default
* settings.
*
@@ -541,7 +537,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile,
*/
static void
-RestoreSignals()
+RestoreSignals(void)
{
#ifdef SIGABRT
signal(SIGABRT, SIG_DFL);
@@ -616,9 +612,9 @@ RestoreSignals()
*/
static int
-SetupStdFile(file, type)
- TclFile file; /* File to dup, or NULL. */
- int type; /* One of TCL_STDIN, TCL_STDOUT, TCL_STDERR */
+SetupStdFile(
+ TclFile file, /* File to dup, or NULL. */
+ int type) /* One of TCL_STDIN, TCL_STDOUT, TCL_STDERR */
{
Tcl_Channel channel;
int fd;
@@ -693,13 +689,13 @@ SetupStdFile(file, type)
*/
Tcl_Channel
-TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
- TclFile readFile; /* If non-null, gives the file for reading. */
- TclFile writeFile; /* If non-null, gives the file for writing. */
- TclFile errorFile; /* If non-null, gives the file where errors
+TclpCreateCommandChannel(
+ TclFile readFile, /* If non-null, gives the file for reading. */
+ TclFile writeFile, /* If non-null, gives the file for writing. */
+ TclFile errorFile, /* If non-null, gives the file where errors
* can be read. */
- int numPids; /* The number of pids in the pid array. */
- Tcl_Pid *pidPtr; /* An array of process identifiers. Allocated
+ int numPids, /* The number of pids in the pid array. */
+ Tcl_Pid *pidPtr) /* An array of process identifiers. Allocated
* by the caller, freed when the channel is
* closed or the processes are detached (in a
* background exec). */
@@ -755,7 +751,7 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
*
* TclGetAndDetachPids --
*
- * This procedure is invoked in the generic implementation of a
+ * This function is invoked in the generic implementation of a
* background "exec" (an exec when invoked with a terminating "&") to
* store a list of the PIDs for processes in a command pipeline in the
* interp's result and to detach the processes.
@@ -770,9 +766,9 @@ TclpCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
*/
void
-TclGetAndDetachPids(interp, chan)
- Tcl_Interp *interp; /* Interpreter to append the PIDs to. */
- Tcl_Channel chan; /* Handle for the pipeline. */
+TclGetAndDetachPids(
+ Tcl_Interp *interp, /* Interpreter to append the PIDs to. */
+ Tcl_Channel chan) /* Handle for the pipeline. */
{
PipeState *pipePtr;
Tcl_ChannelType *chanTypePtr;
@@ -805,7 +801,7 @@ TclGetAndDetachPids(interp, chan)
*
* PipeBlockModeProc --
*
- * Helper procedure to set blocking and nonblocking modes on a pipe based
+ * Helper function to set blocking and nonblocking modes on a pipe based
* channel. Invoked by generic IO level code.
*
* Results:
@@ -819,9 +815,9 @@ TclGetAndDetachPids(interp, chan)
/* ARGSUSED */
static int
-PipeBlockModeProc(instanceData, mode)
- ClientData instanceData; /* Pipe state. */
- int mode; /* The mode to set. Can be one of
+PipeBlockModeProc(
+ ClientData instanceData, /* Pipe state. */
+ int mode) /* The mode to set. Can be one of
* TCL_MODE_BLOCKING or
* TCL_MODE_NONBLOCKING. */
{
@@ -875,7 +871,7 @@ PipeBlockModeProc(instanceData, mode)
} else {
curStatus = 1;
}
- if (ioctl(fd, (int) FIONBIO, &curStatus) < 0) {
+ if (ioctl(fd, (int) FIONBIO, &curStatus) < 0) {
return errno;
}
}
@@ -891,7 +887,7 @@ PipeBlockModeProc(instanceData, mode)
*
* PipeCloseProc --
*
- * This procedure is invoked by the generic IO level to perform
+ * This function is invoked by the generic IO level to perform
* channel-type-specific cleanup when a command pipeline channel is
* closed.
*
@@ -906,9 +902,9 @@ PipeBlockModeProc(instanceData, mode)
/* ARGSUSED */
static int
-PipeCloseProc(instanceData, interp)
- ClientData instanceData; /* The pipe to close. */
- Tcl_Interp *interp; /* For error reporting. */
+PipeCloseProc(
+ ClientData instanceData, /* The pipe to close. */
+ Tcl_Interp *interp) /* For error reporting. */
{
PipeState *pipePtr;
Tcl_Channel errChan;
@@ -972,7 +968,7 @@ PipeCloseProc(instanceData, interp)
*
* PipeInputProc --
*
- * This procedure is invoked from the generic IO level to read input from
+ * This function is invoked from the generic IO level to read input from
* a command pipeline based channel.
*
* Results:
@@ -986,12 +982,12 @@ PipeCloseProc(instanceData, interp)
*/
static int
-PipeInputProc(instanceData, buf, toRead, errorCodePtr)
- ClientData instanceData; /* Pipe state. */
- char *buf; /* Where to store data read. */
- int toRead; /* How much space is available in the
+PipeInputProc(
+ ClientData instanceData, /* Pipe state. */
+ char *buf, /* Where to store data read. */
+ int toRead, /* How much space is available in the
* buffer? */
- int *errorCodePtr; /* Where to store error code. */
+ int *errorCodePtr) /* Where to store error code. */
{
PipeState *psPtr = (PipeState *) instanceData;
int bytesRead; /* How many bytes were actually read from the
@@ -1024,7 +1020,7 @@ PipeInputProc(instanceData, buf, toRead, errorCodePtr)
*
* PipeOutputProc--
*
- * This procedure is invoked from the generic IO level to write output to
+ * This function is invoked from the generic IO level to write output to
* a command pipeline based channel.
*
* Results:
@@ -1038,11 +1034,11 @@ PipeInputProc(instanceData, buf, toRead, errorCodePtr)
*/
static int
-PipeOutputProc(instanceData, buf, toWrite, errorCodePtr)
- ClientData instanceData; /* Pipe state. */
- CONST char *buf; /* The data buffer. */
- int toWrite; /* How many bytes to write? */
- int *errorCodePtr; /* Where to store error code. */
+PipeOutputProc(
+ ClientData instanceData, /* Pipe state. */
+ CONST char *buf, /* The data buffer. */
+ int toWrite, /* How many bytes to write? */
+ int *errorCodePtr) /* Where to store error code. */
{
PipeState *psPtr = (PipeState *) instanceData;
int written;
@@ -1084,9 +1080,9 @@ PipeOutputProc(instanceData, buf, toWrite, errorCodePtr)
*/
static void
-PipeWatchProc(instanceData, mask)
- ClientData instanceData; /* The pipe state. */
- int mask; /* Events of interest; an OR-ed combination of
+PipeWatchProc(
+ ClientData instanceData, /* The pipe state. */
+ int mask) /* Events of interest; an OR-ed combination of
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
@@ -1134,10 +1130,10 @@ PipeWatchProc(instanceData, mask)
*/
static int
-PipeGetHandleProc(instanceData, direction, handlePtr)
- ClientData instanceData; /* The pipe state. */
- int direction; /* TCL_READABLE or TCL_WRITABLE */
- ClientData *handlePtr; /* Where to store the handle. */
+PipeGetHandleProc(
+ ClientData instanceData, /* The pipe state. */
+ int direction, /* TCL_READABLE or TCL_WRITABLE */
+ ClientData *handlePtr) /* Where to store the handle. */
{
PipeState *psPtr = (PipeState *) instanceData;
@@ -1169,10 +1165,10 @@ PipeGetHandleProc(instanceData, direction, handlePtr)
*/
Tcl_Pid
-Tcl_WaitPid(pid, statPtr, options)
- Tcl_Pid pid;
- int *statPtr;
- int options;
+Tcl_WaitPid(
+ Tcl_Pid pid,
+ int *statPtr,
+ int options)
{
int result;
pid_t real_pid;
@@ -1191,7 +1187,7 @@ Tcl_WaitPid(pid, statPtr, options)
*
* Tcl_PidObjCmd --
*
- * This procedure is invoked to process the "pid" Tcl command. See the
+ * This function is invoked to process the "pid" Tcl command. See the
* user documentation for details on what it does.
*
* Results:
@@ -1205,11 +1201,11 @@ Tcl_WaitPid(pid, statPtr, options)
/* ARGSUSED */
int
-Tcl_PidObjCmd(dummy, interp, objc, objv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST *objv; /* Argument strings. */
+Tcl_PidObjCmd(
+ ClientData dummy, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST *objv) /* Argument strings. */
{
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?channelId?");
@@ -1254,13 +1250,13 @@ Tcl_PidObjCmd(dummy, interp, objc, objv)
* None.
*
* Notes:
- * This procedure carries out no operation on Unix.
+ * This function carries out no operation on Unix.
*
*----------------------------------------------------------------------
*/
void
-TclpFinalizePipes()
+TclpFinalizePipes(void)
{
}
diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c
index 8cdf7c7..d376c65 100644
--- a/unix/tclUnixTest.c
+++ b/unix/tclUnixTest.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclUnixTest.c --
*
* Contains platform specific test commands for the Unix platform.
@@ -6,26 +6,26 @@
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright (c) 1998 by Scriptics Corporation.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixTest.c,v 1.20 2004/12/01 23:18:55 dgp Exp $
+ * RCS: @(#) $Id: tclUnixTest.c,v 1.21 2005/11/02 23:26:50 dkf Exp $
*/
#include "tclInt.h"
/*
- * The headers are needed for the testalarm command that verifies the
- * use of SA_RESTART in signal handlers.
+ * The headers are needed for the testalarm command that verifies the use of
+ * SA_RESTART in signal handlers.
*/
#include <signal.h>
#include <sys/resource.h>
/*
- * The following macros convert between TclFile's and fd's. The conversion
+ * The following macros convert between TclFile's and fd's. The conversion
* simple involves shifting fd's up by one to ensure that no valid fd is ever
- * the same as NULL. Note that this code is duplicated from tclUnixPipe.c
+ * the same as NULL. Note that this code is duplicated from tclUnixPipe.c
*/
#define MakeFile(fd) ((TclFile)((fd)+1))
@@ -37,16 +37,15 @@
*/
typedef struct Pipe {
- TclFile readFile; /* File handle for reading from the
- * pipe. NULL means pipe doesn't exist yet. */
- TclFile writeFile; /* File handle for writing from the
- * pipe. */
- int readCount; /* Number of times the file handler for
- * this file has triggered and the file
- * was readable. */
- int writeCount; /* Number of times the file handler for
- * this file has triggered and the file
- * was writable. */
+ TclFile readFile; /* File handle for reading from the pipe.
+ * NULL means pipe doesn't exist yet. */
+ TclFile writeFile; /* File handle for writing from the pipe. */
+ int readCount; /* Number of times the file handler for this
+ * file has triggered and the file was
+ * readable. */
+ int writeCount; /* Number of times the file handler for this
+ * file has triggered and the file was
+ * writable. */
} Pipe;
#define MAX_PIPES 10
@@ -59,37 +58,36 @@ static Pipe testPipes[MAX_PIPES];
static char *gotsig = "0";
/*
- * Forward declarations of procedures defined later in this file:
+ * Forward declarations of functions defined later in this file:
*/
-static void TestFileHandlerProc _ANSI_ARGS_((ClientData clientData,
- int mask));
-static int TestfilehandlerCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestfilewaitCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestfindexecutableCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestgetopenfileCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestgetdefencdirCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestsetdefencdirCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-int TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp));
-static int TestalarmCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static int TestgotsigCmd _ANSI_ARGS_((ClientData dummy,
- Tcl_Interp *interp, int argc, CONST char **argv));
-static void AlarmHandler _ANSI_ARGS_((int signum));
+static void TestFileHandlerProc(ClientData clientData, int mask);
+static int TestfilehandlerCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestfilewaitCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestfindexecutableCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestgetopenfileCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestgetdefencdirCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestsetdefencdirCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+int TclplatformtestInit(Tcl_Interp *interp);
+static int TestalarmCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static int TestgotsigCmd(ClientData dummy,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+static void AlarmHandler(int signum);
/*
*----------------------------------------------------------------------
*
* TclplatformtestInit --
*
- * Defines commands that test platform specific functionality for
- * Unix platforms.
+ * Defines commands that test platform specific functionality for Unix
+ * platforms.
*
* Results:
* A standard Tcl result.
@@ -101,25 +99,25 @@ static void AlarmHandler _ANSI_ARGS_((int signum));
*/
int
-TclplatformtestInit(interp)
- Tcl_Interp *interp; /* Interpreter to add commands to. */
+TclplatformtestInit(
+ Tcl_Interp *interp) /* Interpreter to add commands to. */
{
Tcl_CreateCommand(interp, "testfilehandler", TestfilehandlerCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfilewait", TestfilewaitCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testfindexecutable", TestfindexecutableCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testalarm", TestalarmCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
Tcl_CreateCommand(interp, "testgotsig", TestgotsigCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
return TCL_OK;
}
@@ -128,9 +126,8 @@ TclplatformtestInit(interp)
*
* TestfilehandlerCmd --
*
- * This procedure implements the "testfilehandler" command. It is
- * used to test Tcl_CreateFileHandler, Tcl_DeleteFileHandler, and
- * TclWaitForFile.
+ * This function implements the "testfilehandler" command. It is used to
+ * test Tcl_CreateFileHandler, Tcl_DeleteFileHandler, and TclWaitForFile.
*
* Results:
* A standard Tcl result.
@@ -142,11 +139,11 @@ TclplatformtestInit(interp)
*/
static int
-TestfilehandlerCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestfilehandlerCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
Pipe *pipePtr;
int i, mask, timeout;
@@ -158,7 +155,7 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
* NOTE: When we make this code work on Windows also, the following
* variable needs to be made Unix-only.
*/
-
+
if (!initialized) {
for (i = 0; i < MAX_PIPES; i++) {
testPipes[i].readFile = NULL;
@@ -168,7 +165,7 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
- " option ... \"", (char *) NULL);
+ " option ... \"", NULL);
return TCL_ERROR;
}
pipePtr = NULL;
@@ -177,7 +174,7 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (i >= MAX_PIPES) {
- Tcl_AppendResult(interp, "bad index ", argv[2], (char *) NULL);
+ Tcl_AppendResult(interp, "bad index ", argv[2], NULL);
return TCL_ERROR;
}
pipePtr = &testPipes[i];
@@ -195,16 +192,16 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
} else if (strcmp(argv[1], "clear") == 0) {
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " clear index\"", (char *) NULL);
+ argv[0], " clear index\"", NULL);
return TCL_ERROR;
}
pipePtr->readCount = pipePtr->writeCount = 0;
} else if (strcmp(argv[1], "counts") == 0) {
char buf[TCL_INTEGER_SPACE * 2];
-
+
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " counts index\"", (char *) NULL);
+ argv[0], " counts index\"", NULL);
return TCL_ERROR;
}
sprintf(buf, "%d %d", pipePtr->readCount, pipePtr->writeCount);
@@ -212,14 +209,13 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
} else if (strcmp(argv[1], "create") == 0) {
if (argc != 5) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " create index readMode writeMode\"",
- (char *) NULL);
+ argv[0], " create index readMode writeMode\"", NULL);
return TCL_ERROR;
}
if (pipePtr->readFile == NULL) {
if (!TclpCreatePipe(&pipePtr->readFile, &pipePtr->writeFile)) {
Tcl_AppendResult(interp, "couldn't open pipe: ",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
#ifdef O_NONBLOCK
@@ -243,8 +239,7 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
Tcl_CreateFileHandler(GetFd(pipePtr->readFile), 0,
TestFileHandlerProc, (ClientData) pipePtr);
} else {
- Tcl_AppendResult(interp, "bad read mode \"", argv[3], "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad read mode \"", argv[3], "\"", NULL);
return TCL_ERROR;
}
if (strcmp(argv[4], "writable") == 0) {
@@ -256,14 +251,13 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
Tcl_CreateFileHandler(GetFd(pipePtr->writeFile), 0,
TestFileHandlerProc, (ClientData) pipePtr);
} else {
- Tcl_AppendResult(interp, "bad read mode \"", argv[4], "\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "bad read mode \"", argv[4], "\"", NULL);
return TCL_ERROR;
}
} else if (strcmp(argv[1], "empty") == 0) {
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " empty index\"", (char *) NULL);
+ argv[0], " empty index\"", NULL);
return TCL_ERROR;
}
@@ -273,7 +267,7 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
} else if (strcmp(argv[1], "fill") == 0) {
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " fill index\"", (char *) NULL);
+ argv[0], " fill index\"", NULL);
return TCL_ERROR;
}
@@ -283,10 +277,10 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
}
} else if (strcmp(argv[1], "fillpartial") == 0) {
char buf[TCL_INTEGER_SPACE];
-
+
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " fillpartial index\"", (char *) NULL);
+ argv[0], " fillpartial index\"", NULL);
return TCL_ERROR;
}
@@ -298,13 +292,11 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
} else if (strcmp(argv[1], "wait") == 0) {
if (argc != 5) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"",
- argv[0], " wait index readable|writable timeout\"",
- (char *) NULL);
+ argv[0], " wait index readable|writable timeout\"", NULL);
return TCL_ERROR;
}
if (pipePtr->readFile == NULL) {
- Tcl_AppendResult(interp, "pipe ", argv[2], " doesn't exist",
- (char *) NULL);
+ Tcl_AppendResult(interp, "pipe ", argv[2], " doesn't exist", NULL);
return TCL_ERROR;
}
if (strcmp(argv[3], "readable") == 0) {
@@ -329,16 +321,16 @@ TestfilehandlerCmd(clientData, interp, argc, argv)
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": must be close, clear, counts, create, empty, fill, ",
- "fillpartial, oneevent, wait, or windowevent",
- (char *) NULL);
+ "fillpartial, oneevent, wait, or windowevent", NULL);
return TCL_ERROR;
}
return TCL_OK;
}
-static void TestFileHandlerProc(clientData, mask)
- ClientData clientData; /* Points to a Pipe structure. */
- int mask; /* Indicates which events happened:
+static void
+TestFileHandlerProc(
+ ClientData clientData, /* Points to a Pipe structure. */
+ int mask) /* Indicates which events happened:
* TCL_READABLE or TCL_WRITABLE. */
{
Pipe *pipePtr = (Pipe *) clientData;
@@ -356,8 +348,8 @@ static void TestFileHandlerProc(clientData, mask)
*
* TestfilewaitCmd --
*
- * This procedure implements the "testfilewait" command. It is
- * used to test TclUnixWaitForFile.
+ * This function implements the "testfilewait" command. It is used to
+ * test TclUnixWaitForFile.
*
* Results:
* A standard Tcl result.
@@ -369,11 +361,11 @@ static void TestFileHandlerProc(clientData, mask)
*/
static int
-TestfilewaitCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestfilewaitCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
int mask, result, timeout;
Tcl_Channel channel;
@@ -382,7 +374,7 @@ TestfilewaitCmd(clientData, interp, argc, argv)
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
- " file readable|writable|both timeout\"", (char *) NULL);
+ " file readable|writable|both timeout\"", NULL);
return TCL_ERROR;
}
channel = Tcl_GetChannel(interp, argv[1], NULL);
@@ -397,10 +389,10 @@ TestfilewaitCmd(clientData, interp, argc, argv)
mask = TCL_WRITABLE|TCL_READABLE;
} else {
Tcl_AppendResult(interp, "bad argument \"", argv[2],
- "\": must be readable, writable, or both", (char *) NULL);
+ "\": must be readable, writable, or both", NULL);
return TCL_ERROR;
}
- if (Tcl_GetChannelHandle(channel,
+ if (Tcl_GetChannelHandle(channel,
(mask & TCL_READABLE) ? TCL_READABLE : TCL_WRITABLE,
(ClientData*) &data) != TCL_OK) {
Tcl_SetResult(interp, "couldn't get channel file", TCL_STATIC);
@@ -425,8 +417,8 @@ TestfilewaitCmd(clientData, interp, argc, argv)
*
* TestfindexecutableCmd --
*
- * This procedure implements the "testfindexecutable" command. It is
- * used to test TclpFindExecutable.
+ * This function implements the "testfindexecutable" command. It is used
+ * to test TclpFindExecutable.
*
* Results:
* A standard Tcl result.
@@ -438,17 +430,17 @@ TestfilewaitCmd(clientData, interp, argc, argv)
*/
static int
-TestfindexecutableCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestfindexecutableCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
Tcl_Obj *saveName;
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
- " argv0\"", (char *) NULL);
+ " argv0\"", NULL);
return TCL_ERROR;
}
@@ -468,8 +460,8 @@ TestfindexecutableCmd(clientData, interp, argc, argv)
*
* TestgetopenfileCmd --
*
- * This procedure implements the "testgetopenfile" command. It is
- * used to get a FILE * value from a registered channel.
+ * This function implements the "testgetopenfile" command. It is used to
+ * get a FILE * value from a registered channel.
*
* Results:
* A standard Tcl result.
@@ -481,19 +473,17 @@ TestfindexecutableCmd(clientData, interp, argc, argv)
*/
static int
-TestgetopenfileCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestgetopenfileCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
ClientData filePtr;
if (argc != 3) {
- Tcl_AppendResult(interp,
- "wrong # args: should be \"", argv[0],
- " channelName forWriting\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " channelName forWriting\"", NULL);
return TCL_ERROR;
}
if (Tcl_GetOpenFile(interp, argv[1], atoi(argv[2]), 1, &filePtr)
@@ -502,7 +492,7 @@ TestgetopenfileCmd(clientData, interp, argc, argv)
}
if (filePtr == (ClientData) NULL) {
Tcl_AppendResult(interp,
- "Tcl_GetOpenFile succeeded but FILE * NULL!", (char *) NULL);
+ "Tcl_GetOpenFile succeeded but FILE * NULL!", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -513,8 +503,8 @@ TestgetopenfileCmd(clientData, interp, argc, argv)
*
* TestsetdefencdirCmd --
*
- * This procedure implements the "testsetdefenc" command. It is
- * used to test Tcl_SetDefaultEncodingDir().
+ * This function implements the "testsetdefenc" command. It is used to
+ * test Tcl_SetDefaultEncodingDir().
*
* Results:
* A standard Tcl result.
@@ -526,17 +516,15 @@ TestgetopenfileCmd(clientData, interp, argc, argv)
*/
static int
-TestsetdefencdirCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestsetdefencdirCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
if (argc != 2) {
- Tcl_AppendResult(interp,
- "wrong # args: should be \"", argv[0],
- " defaultDir\"",
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " defaultDir\"", NULL);
return TCL_ERROR;
}
@@ -549,8 +537,8 @@ TestsetdefencdirCmd(clientData, interp, argc, argv)
*
* TestgetdefencdirCmd --
*
- * This procedure implements the "testgetdefenc" command. It is
- * used to test Tcl_GetDefaultEncodingDir().
+ * This function implements the "testgetdefenc" command. It is used to
+ * test Tcl_GetDefaultEncodingDir().
*
* Results:
* A standard Tcl result.
@@ -562,30 +550,29 @@ TestsetdefencdirCmd(clientData, interp, argc, argv)
*/
static int
-TestgetdefencdirCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestgetdefencdirCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
if (argc != 1) {
- Tcl_AppendResult(interp,
- "wrong # args: should be \"", argv[0],
- (char *) NULL);
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], NULL);
return TCL_ERROR;
}
- Tcl_AppendResult(interp, Tcl_GetDefaultEncodingDir(), (char *) NULL);
+ Tcl_AppendResult(interp, Tcl_GetDefaultEncodingDir(), NULL);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
+ *
* TestalarmCmd --
*
- * Test that EINTR is handled correctly by generating and
- * handling a signal. This requires using the SA_RESTART
- * flag when registering the signal handler.
+ * Test that EINTR is handled correctly by generating and handling a
+ * signal. This requires using the SA_RESTART flag when registering the
+ * signal handler.
*
* Results:
* None.
@@ -597,11 +584,11 @@ TestgetdefencdirCmd(clientData, interp, argc, argv)
*/
static int
-TestalarmCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestalarmCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
#ifdef SA_RESTART
unsigned int sec;
@@ -614,21 +601,24 @@ TestalarmCmd(clientData, interp, argc, argv)
}
/*
- * Setup the signal handling that automatically retries
- * any interupted I/O system calls.
+ * Setup the signal handling that automatically retries any interrupted
+ * I/O system calls.
*/
+
action.sa_handler = AlarmHandler;
- memset((void *)&action.sa_mask, 0, sizeof(sigset_t));
+ memset((void *) &action.sa_mask, 0, sizeof(sigset_t));
action.sa_flags = SA_RESTART;
if (sigaction(SIGALRM, &action, NULL) < 0) {
Tcl_AppendResult(interp, "sigaction: ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
- (void)alarm(sec);
+ (void) alarm(sec);
return TCL_OK;
#else
- Tcl_AppendResult(interp, "warning: sigaction SA_RESTART not support on this platform", NULL);
+ Tcl_AppendResult(interp,
+ "warning: sigaction SA_RESTART not support on this platform",
+ NULL);
return TCL_ERROR;
#endif
}
@@ -650,14 +640,15 @@ TestalarmCmd(clientData, interp, argc, argv)
*/
static void
-AlarmHandler(signum)
- int signum;
+AlarmHandler(
+ int signum)
{
gotsig = "1";
}
/*
*----------------------------------------------------------------------
+ *
* TestgotsigCmd --
*
* Verify the signal was handled after the testalarm command.
@@ -672,13 +663,13 @@ AlarmHandler(signum)
*/
static int
-TestgotsigCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TestgotsigCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
- Tcl_AppendResult(interp, gotsig, (char *) NULL);
+ Tcl_AppendResult(interp, gotsig, NULL);
gotsig = "0";
return TCL_OK;
}
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index 3d068e5..f8131c0 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclUnixThrd.c --
*
* This file implements the UNIX-specific thread support.
@@ -75,13 +75,13 @@ static pthread_mutex_t *allocLockPtr = &allocLock;
*/
int
-TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
- Tcl_ThreadId *idPtr; /* Return, the ID of the thread */
- Tcl_ThreadCreateProc proc; /* Main() function of the thread */
- ClientData clientData; /* The one argument to Main() */
- int stackSize; /* Size of stack for the new thread */
- int flags; /* Flags controlling behaviour of the
- * new thread. */
+TclpThreadCreate(
+ Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
+ Tcl_ThreadCreateProc proc, /* Main() function of the thread */
+ ClientData clientData, /* The one argument to Main() */
+ int stackSize, /* Size of stack for the new thread */
+ int flags) /* Flags controlling behaviour of the new
+ * thread. */
{
#ifdef TCL_THREADS
pthread_attr_t attr;
@@ -154,16 +154,16 @@ TclpThreadCreate(idPtr, proc, clientData, stackSize, flags)
*/
int
-Tcl_JoinThread(threadId, state)
- Tcl_ThreadId threadId; /* Id of the thread to wait upon. */
- int *state; /* Reference to the storage the result of the
+Tcl_JoinThread(
+ Tcl_ThreadId threadId, /* Id of the thread to wait upon. */
+ int *state) /* Reference to the storage the result of the
* thread we wait upon will be written
* into. */
{
#ifdef TCL_THREADS
int result;
- result = pthread_join ((pthread_t) threadId, (VOID**) state);
+ result = pthread_join((pthread_t) threadId, (void**) state);
return (result == 0) ? TCL_OK : TCL_ERROR;
#else
return TCL_ERROR;
@@ -188,8 +188,8 @@ Tcl_JoinThread(threadId, state)
*/
void
-TclpThreadExit(status)
- int status;
+TclpThreadExit(
+ int status)
{
pthread_exit((VOID *)status);
}
@@ -213,7 +213,7 @@ TclpThreadExit(status)
*/
int
-TclpThreadGetStackSize()
+TclpThreadGetStackSize(void)
{
#if defined(HAVE_PTHREAD_SETSTACKSIZE) && defined(TclpPthreadGetAttrs)
pthread_attr_t threadAttr; /* This will hold the thread attributes for
@@ -261,7 +261,7 @@ TclpThreadGetStackSize()
*/
Tcl_ThreadId
-Tcl_GetCurrentThread()
+Tcl_GetCurrentThread(void)
{
#ifdef TCL_THREADS
return (Tcl_ThreadId) pthread_self();
@@ -269,7 +269,6 @@ Tcl_GetCurrentThread()
return (Tcl_ThreadId) 0;
#endif
}
-
/*
*----------------------------------------------------------------------
@@ -291,7 +290,7 @@ Tcl_GetCurrentThread()
*/
void
-TclpInitLock()
+TclpInitLock(void)
{
#ifdef TCL_THREADS
pthread_mutex_lock(&initLock);
@@ -317,7 +316,7 @@ TclpInitLock()
*/
void
-TclFinalizeLock ()
+TclFinalizeLock(void)
{
#ifdef TCL_THREADS
/*
@@ -348,7 +347,7 @@ TclFinalizeLock ()
*/
void
-TclpInitUnlock()
+TclpInitUnlock(void)
{
#ifdef TCL_THREADS
pthread_mutex_unlock(&initLock);
@@ -377,7 +376,7 @@ TclpInitUnlock()
*/
void
-TclpMasterLock()
+TclpMasterLock(void)
{
#ifdef TCL_THREADS
pthread_mutex_lock(&masterLock);
@@ -403,7 +402,7 @@ TclpMasterLock()
*/
void
-TclpMasterUnlock()
+TclpMasterUnlock(void)
{
#ifdef TCL_THREADS
pthread_mutex_unlock(&masterLock);
@@ -431,7 +430,7 @@ TclpMasterUnlock()
*/
Tcl_Mutex *
-Tcl_GetAllocMutex()
+Tcl_GetAllocMutex(void)
{
#ifdef TCL_THREADS
return (Tcl_Mutex *)&allocLockPtr;
@@ -464,17 +463,17 @@ Tcl_GetAllocMutex()
*/
void
-Tcl_MutexLock(mutexPtr)
- Tcl_Mutex *mutexPtr; /* Really (pthread_mutex_t **) */
+Tcl_MutexLock(
+ Tcl_Mutex *mutexPtr) /* Really (pthread_mutex_t **) */
{
pthread_mutex_t *pmutexPtr;
if (*mutexPtr == NULL) {
MASTER_LOCK;
if (*mutexPtr == NULL) {
- /*
+ /*
* Double inside master lock check to avoid a race condition.
*/
-
+
pmutexPtr = (pthread_mutex_t *)ckalloc(sizeof(pthread_mutex_t));
pthread_mutex_init(pmutexPtr, NULL);
*mutexPtr = (Tcl_Mutex)pmutexPtr;
@@ -485,7 +484,6 @@ Tcl_MutexLock(mutexPtr)
pmutexPtr = *((pthread_mutex_t **)mutexPtr);
pthread_mutex_lock(pmutexPtr);
}
-
/*
*----------------------------------------------------------------------
@@ -505,13 +503,12 @@ Tcl_MutexLock(mutexPtr)
*/
void
-Tcl_MutexUnlock(mutexPtr)
- Tcl_Mutex *mutexPtr; /* Really (pthread_mutex_t **) */
+Tcl_MutexUnlock(
+ Tcl_Mutex *mutexPtr) /* Really (pthread_mutex_t **) */
{
pthread_mutex_t *pmutexPtr = *(pthread_mutex_t **)mutexPtr;
pthread_mutex_unlock(pmutexPtr);
}
-
/*
*----------------------------------------------------------------------
@@ -533,13 +530,13 @@ Tcl_MutexUnlock(mutexPtr)
*/
void
-TclpFinalizeMutex(mutexPtr)
- Tcl_Mutex *mutexPtr;
+TclpFinalizeMutex(
+ Tcl_Mutex *mutexPtr)
{
pthread_mutex_t *pmutexPtr = *(pthread_mutex_t **)mutexPtr;
if (pmutexPtr != NULL) {
pthread_mutex_destroy(pmutexPtr);
- ckfree((char *)pmutexPtr);
+ ckfree((char *) pmutexPtr);
*mutexPtr = NULL;
}
}
@@ -567,10 +564,10 @@ TclpFinalizeMutex(mutexPtr)
*/
void
-Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
- Tcl_Condition *condPtr; /* Really (pthread_cond_t **) */
- Tcl_Mutex *mutexPtr; /* Really (pthread_mutex_t **) */
- Tcl_Time *timePtr; /* Timeout on waiting period */
+Tcl_ConditionWait(
+ Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
+ Tcl_Mutex *mutexPtr, /* Really (pthread_mutex_t **) */
+ Tcl_Time *timePtr) /* Timeout on waiting period */
{
pthread_cond_t *pcondPtr;
pthread_mutex_t *pmutexPtr;
@@ -579,13 +576,13 @@ Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
if (*condPtr == NULL) {
MASTER_LOCK;
- /*
+ /*
* Double check inside mutex to avoid race, then initialize condition
* variable if necessary.
*/
if (*condPtr == NULL) {
- pcondPtr = (pthread_cond_t *)ckalloc(sizeof(pthread_cond_t));
+ pcondPtr = (pthread_cond_t *) ckalloc(sizeof(pthread_cond_t));
pthread_cond_init(pcondPtr, NULL);
*condPtr = (Tcl_Condition)pcondPtr;
TclRememberCondition(condPtr);
@@ -632,8 +629,8 @@ Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
*/
void
-Tcl_ConditionNotify(condPtr)
- Tcl_Condition *condPtr;
+Tcl_ConditionNotify(
+ Tcl_Condition *condPtr)
{
pthread_cond_t *pcondPtr = *((pthread_cond_t **)condPtr);
if (pcondPtr != NULL) {
@@ -644,7 +641,6 @@ Tcl_ConditionNotify(condPtr)
*/
}
}
-
/*
*----------------------------------------------------------------------
@@ -666,13 +662,13 @@ Tcl_ConditionNotify(condPtr)
*/
void
-TclpFinalizeCondition(condPtr)
- Tcl_Condition *condPtr;
+TclpFinalizeCondition(
+ Tcl_Condition *condPtr)
{
pthread_cond_t *pcondPtr = *(pthread_cond_t **)condPtr;
if (pcondPtr != NULL) {
pthread_cond_destroy(pcondPtr);
- ckfree((char *)pcondPtr);
+ ckfree((char *) pcondPtr);
*condPtr = NULL;
}
}
@@ -700,13 +696,15 @@ TclpFinalizeCondition(condPtr)
*/
Tcl_DirEntry *
-TclpReaddir(DIR * dir)
+TclpReaddir(
+ DIR * dir)
{
return TclOSreaddir(dir);
}
char *
-TclpInetNtoa(struct in_addr addr)
+TclpInetNtoa(
+ struct in_addr addr)
{
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -714,7 +712,7 @@ TclpInetNtoa(struct in_addr addr)
unsigned long l;
unsigned char b[4];
} u;
-
+
u.l = (unsigned long) addr.s_addr;
sprintf(tsdPtr->nabuf, "%u.%u.%u.%u", u.b[0], u.b[1], u.b[2], u.b[3]);
return tsdPtr->nabuf;
@@ -730,7 +728,7 @@ TclpInetNtoa(struct in_addr addr)
#ifdef USE_THREAD_ALLOC
static volatile int initialized = 0;
-static pthread_key_t key;
+static pthread_key_t key;
typedef struct allocMutex {
Tcl_Mutex tlock;
@@ -752,8 +750,8 @@ TclpNewAllocMutex(void)
}
void
-TclpFreeAllocMutex(mutex)
- Tcl_Mutex *mutex; /* The alloc mutex to free. */
+TclpFreeAllocMutex(
+ Tcl_Mutex *mutex) /* The alloc mutex to free. */
{
allocMutex* lockPtr = (allocMutex*) mutex;
if (!lockPtr) {
@@ -763,8 +761,9 @@ TclpFreeAllocMutex(mutex)
free(lockPtr);
}
-void TclpFreeAllocCache(ptr)
- void *ptr;
+void
+TclpFreeAllocCache(
+ void *ptr)
{
if (ptr != NULL) {
/*
@@ -799,7 +798,8 @@ TclpGetAllocCache(void)
}
void
-TclpSetAllocCache(void *arg)
+TclpSetAllocCache(
+ void *arg)
{
pthread_setspecific(key, arg);
}
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 1ebec63..12ba965 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixTime.c,v 1.25 2005/07/20 23:16:01 dkf Exp $
+ * RCS: @(#) $Id: tclUnixTime.c,v 1.26 2005/11/02 23:26:50 dkf Exp $
*/
#include "tclInt.h"
@@ -44,12 +44,12 @@ static char *lastTZ = NULL; /* Holds the last setting of the TZ
* Static functions declared in this file.
*/
-static void SetTZIfNecessary _ANSI_ARGS_((void));
-static void CleanupMemory _ANSI_ARGS_((ClientData));
-static void NativeScaleTime _ANSI_ARGS_((Tcl_Time *timebuf,
- ClientData clientData));
-static void NativeGetTime _ANSI_ARGS_((Tcl_Time *timebuf,
- ClientData clientData));
+static void SetTZIfNecessary(void);
+static void CleanupMemory(ClientData clientData);
+static void NativeScaleTime(Tcl_Time *timebuf,
+ ClientData clientData);
+static void NativeGetTime(Tcl_Time *timebuf,
+ ClientData clientData);
/*
* TIP #233 (Virtualized Time): Data for the time hooks, if any.
@@ -77,9 +77,9 @@ ClientData tclTimeClientData = NULL;
*/
unsigned long
-TclpGetSeconds()
+TclpGetSeconds(void)
{
- return time((time_t *) NULL);
+ return time(NULL);
}
/*
@@ -102,7 +102,7 @@ TclpGetSeconds()
*/
unsigned long
-TclpGetClicks()
+TclpGetClicks(void)
{
unsigned long now;
@@ -149,8 +149,8 @@ TclpGetClicks()
*/
int
-TclpGetTimeZone(currentTime)
- unsigned long currentTime;
+TclpGetTimeZone(
+ unsigned long currentTime)
{
int timeZone;
@@ -172,7 +172,7 @@ TclpGetTimeZone(currentTime)
time_t curTime = (time_t) currentTime;
struct tm *timeDataPtr = TclpLocaltime(&curTime);
- timeZone = timeDataPtr->tm_tzadj / 60;
+ timeZone = timeDataPtr->tm_tzadj / 60;
if (timeDataPtr->tm_isdst) {
timeZone += 60;
}
@@ -267,8 +267,8 @@ TclpGetTimeZone(currentTime)
*/
void
-Tcl_GetTime(timePtr)
- Tcl_Time *timePtr; /* Location to store time information. */
+Tcl_GetTime(
+ Tcl_Time *timePtr) /* Location to store time information. */
{
(*tclGetTimeProcPtr) (timePtr, tclTimeClientData);
}
@@ -292,9 +292,9 @@ Tcl_GetTime(timePtr)
*/
struct tm *
-TclpGetDate(time, useGMT)
- CONST time_t *time;
- int useGMT;
+TclpGetDate(
+ CONST time_t *time,
+ int useGMT)
{
if (useGMT) {
return TclpGmtime(time);
@@ -321,8 +321,8 @@ TclpGetDate(time, useGMT)
*/
struct tm *
-TclpGmtime(timePtr)
- CONST time_t *timePtr; /* Pointer to the number of seconds since the
+TclpGmtime(
+ CONST time_t *timePtr) /* Pointer to the number of seconds since the
* local system's epoch */
{
/*
@@ -347,9 +347,9 @@ TclpGmtime(timePtr)
* Forwarder for obsolete item in Stubs
*/
-struct tm*
-TclpGmtime_unix(timePtr)
- CONST time_t *timePtr;
+struct tm *
+TclpGmtime_unix(
+ CONST time_t *timePtr)
{
return TclpGmtime(timePtr);
}
@@ -372,8 +372,8 @@ TclpGmtime_unix(timePtr)
*/
struct tm *
-TclpLocaltime(timePtr)
- CONST time_t *timePtr; /* Pointer to the number of seconds since the
+TclpLocaltime(
+ CONST time_t *timePtr) /* Pointer to the number of seconds since the
* local system's epoch */
{
/*
@@ -398,8 +398,8 @@ TclpLocaltime(timePtr)
* Forwarder for obsolete item in Stubs
*/
struct tm*
-TclpLocaltime_unix(timePtr)
- CONST time_t *timePtr;
+TclpLocaltime_unix(
+ CONST time_t *timePtr)
{
return TclpLocaltime(timePtr);
}
@@ -422,10 +422,10 @@ TclpLocaltime_unix(timePtr)
*/
void
-Tcl_SetTimeProc(getProc, scaleProc, clientData)
- Tcl_GetTimeProc *getProc;
- Tcl_ScaleTimeProc *scaleProc;
- ClientData clientData;
+Tcl_SetTimeProc(
+ Tcl_GetTimeProc *getProc,
+ Tcl_ScaleTimeProc *scaleProc,
+ ClientData clientData)
{
tclGetTimeProcPtr = getProc;
tclScaleTimeProcPtr = scaleProc;
@@ -449,10 +449,10 @@ Tcl_SetTimeProc(getProc, scaleProc, clientData)
*/
void
-Tcl_QueryTimeProc(getProc, scaleProc, clientData)
- Tcl_GetTimeProc **getProc;
- Tcl_ScaleTimeProc **scaleProc;
- ClientData *clientData;
+Tcl_QueryTimeProc(
+ Tcl_GetTimeProc **getProc,
+ Tcl_ScaleTimeProc **scaleProc,
+ ClientData *clientData)
{
if (getProc) {
*getProc = tclGetTimeProcPtr;
@@ -483,9 +483,9 @@ Tcl_QueryTimeProc(getProc, scaleProc, clientData)
*/
static void
-NativeScaleTime(timePtr, clientData)
- Tcl_Time *timePtr;
- ClientData clientData;
+NativeScaleTime(
+ Tcl_Time *timePtr,
+ ClientData clientData)
{
/* Native scale is 1:1. Nothing is done */
}
@@ -508,9 +508,9 @@ NativeScaleTime(timePtr, clientData)
*/
static void
-NativeGetTime(timePtr, clientData)
- Tcl_Time *timePtr;
- ClientData clientData;
+NativeGetTime(
+ Tcl_Time *timePtr,
+ ClientData clientData)
{
struct timeval tv;
struct timezone tz;
@@ -539,7 +539,7 @@ NativeGetTime(timePtr, clientData)
*/
static void
-SetTZIfNecessary()
+SetTZIfNecessary(void)
{
CONST char *newTZ = getenv("TZ");
@@ -578,7 +578,8 @@ SetTZIfNecessary()
*/
static void
-CleanupMemory(ClientData ignored)
+CleanupMemory(
+ ClientData ignored)
{
Tcl_Free(lastTZ);
}
diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c
index 05b854e..3a8a749 100644
--- a/unix/tclXtNotify.c
+++ b/unix/tclXtNotify.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclXtNotify.c,v 1.7 2005/07/24 22:56:45 dkf Exp $
+ * RCS: @(#) $Id: tclXtNotify.c,v 1.8 2005/11/02 23:26:50 dkf Exp $
*/
#include <X11/Intrinsic.h>
@@ -75,26 +75,23 @@ static int initialized = 0;
* Static routines defined in this file.
*/
-static int FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr,
- int flags));
-static void FileProc _ANSI_ARGS_((caddr_t clientData,
- int *source, XtInputId *id));
-void InitNotifier _ANSI_ARGS_((void));
-static void NotifierExitHandler _ANSI_ARGS_((
- ClientData clientData));
-static void TimerProc _ANSI_ARGS_((caddr_t clientData,
- XtIntervalId *id));
-static void CreateFileHandler _ANSI_ARGS_((int fd, int mask,
- Tcl_FileProc * proc, ClientData clientData));
-static void DeleteFileHandler _ANSI_ARGS_((int fd));
-static void SetTimer _ANSI_ARGS_((Tcl_Time * timePtr));
-static int WaitForEvent _ANSI_ARGS_((Tcl_Time * timePtr));
+static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
+static void FileProc(caddr_t clientData, int *source,
+ XtInputId *id);
+void InitNotifier(void);
+static void NotifierExitHandler(ClientData clientData);
+static void TimerProc(caddr_t clientData, XtIntervalId *id);
+static void CreateFileHandler(int fd, int mask,
+ Tcl_FileProc * proc, ClientData clientData);
+static void DeleteFileHandler(int fd);
+static void SetTimer(Tcl_Time * timePtr);
+static int WaitForEvent(Tcl_Time * timePtr);
/*
* Functions defined in this file for use by users of the Xt Notifier:
*/
-EXTERN XtAppContext TclSetAppContext _ANSI_ARGS_((XtAppContext ctx));
+EXTERN XtAppContext TclSetAppContext(XtAppContext ctx);
/*
*----------------------------------------------------------------------
diff --git a/unix/tclXtTest.c b/unix/tclXtTest.c
index d0b07a5..425726d 100644
--- a/unix/tclXtTest.c
+++ b/unix/tclXtTest.c
@@ -5,32 +5,31 @@
*
* Copyright (c) 1997 by Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclXtTest.c,v 1.5 2002/08/05 03:24:41 dgp Exp $
+ * RCS: @(#) $Id: tclXtTest.c,v 1.6 2005/11/02 23:26:50 dkf Exp $
*/
#include <X11/Intrinsic.h>
#include "tcl.h"
-static int TesteventloopCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, CONST char **argv));
-extern void InitNotifier _ANSI_ARGS_((void));
-
+static int TesteventloopCmd(ClientData clientData,
+ Tcl_Interp *interp, int argc, CONST char **argv);
+extern void InitNotifier(void);
/*
*----------------------------------------------------------------------
*
* Tclxttest_Init --
*
- * This procedure performs application-specific initialization.
- * Most applications, especially those that incorporate additional
- * packages, will have their own version of this procedure.
+ * This procedure performs application-specific initialization. Most
+ * applications, especially those that incorporate additional packages,
+ * will have their own version of this procedure.
*
* Results:
- * Returns a standard Tcl completion code, and leaves an error
- * message in the interp's result if an error occurs.
+ * Returns a standard Tcl completion code, and leaves an error message in
+ * the interp's result if an error occurs.
*
* Side effects:
* Depends on the startup script.
@@ -39,8 +38,8 @@ extern void InitNotifier _ANSI_ARGS_((void));
*/
int
-Tclxttest_Init(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tclxttest_Init(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
return TCL_ERROR;
@@ -48,7 +47,7 @@ Tclxttest_Init(interp)
XtToolkitInitialize();
InitNotifier();
Tcl_CreateCommand(interp, "testeventloop", TesteventloopCmd,
- (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ (ClientData) 0, NULL);
return TCL_OK;
}
@@ -57,9 +56,9 @@ Tclxttest_Init(interp)
*
* TesteventloopCmd --
*
- * This procedure implements the "testeventloop" command. It is
- * used to test the Tcl notifier from an "external" event loop
- * (i.e. not Tcl_DoOneEvent()).
+ * This procedure implements the "testeventloop" command. It is used to
+ * test the Tcl notifier from an "external" event loop (i.e. not
+ * Tcl_DoOneEvent()).
*
* Results:
* A standard Tcl result.
@@ -71,19 +70,19 @@ Tclxttest_Init(interp)
*/
static int
-TesteventloopCmd(clientData, interp, argc, argv)
- ClientData clientData; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- CONST char **argv; /* Argument strings. */
+TesteventloopCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ CONST char **argv) /* Argument strings. */
{
- static int *framePtr = NULL; /* Pointer to integer on stack frame of
- * innermost invocation of the "wait"
- * subcommand. */
+ static int *framePtr = NULL;/* Pointer to integer on stack frame of
+ * innermost invocation of the "wait"
+ * subcommand. */
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0],
- " option ... \"", (char *) NULL);
+ " option ... \"", NULL);
return TCL_ERROR;
}
if (strcmp(argv[1], "done") == 0) {
@@ -101,8 +100,8 @@ TesteventloopCmd(clientData, interp, argc, argv)
framePtr = &done;
/*
- * Enter an Xt event loop until the flag changes.
- * Note that we do not explicitly call Tcl_ServiceEvent().
+ * Enter an Xt event loop until the flag changes. Note that we do not
+ * explicitly call Tcl_ServiceEvent().
*/
done = 0;
@@ -113,7 +112,7 @@ TesteventloopCmd(clientData, interp, argc, argv)
framePtr = oldFramePtr;
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be done or wait", (char *) NULL);
+ "\": must be done or wait", NULL);
return TCL_ERROR;
}
return TCL_OK;